|
|
|
|
|
для: Zack
(05.11.2005 в 17:35)
| | >Кажется получилось! Всем кто помогал большое спасибо!
Примите поздравления от автора приложения
Как защитить страничку? Лучше всего это можно сделать с помощью файлов .htaccess и .htpasswd
http://www.softtime.ru/info/articlephp.php?id_article=25 | |
|
|
|
|
|
|
|
для: antf
(05.11.2005 в 14:27)
| | Кажется получилось! Всем кто помогал большое спасибо! Кому интересно можете посмотреть http://www.oblivion.com.ru
Чуть не забыл, у меня остался ещё один вопрос: "Как защитить страничку администрирования от посторонних?" | |
|
|
|
|
|
|
|
для: Zack
(05.11.2005 в 13:00)
| | Попробуйте в качестве атрибута value кнопки присвоить значение "Результаты"
value='Результаты' | |
|
|
|
|
|
|
|
для: antf
(05.11.2005 в 12:12)
| | Что-то всё равно не так! Когда нажимаю на полученную картинку у меня высвечивается "Не выбрано ни одного действия" | |
|
|
|
|
|
|
|
для: Zack
(05.11.2005 в 11:43)
| | print "<td><input type=Image src='images/button.gif' name=ShowResults ></td>"; | |
|
|
|
|
|
|
|
для: antf
(04.11.2005 в 21:04)
| | Если вас это не затруднит, то можете привести пример? Например картинка button.gif лежит в папке /images/, а сам скрипт голосования находится в корневом каталоге. Как будет выглядеть код кнопки-картики "Результаты"? | |
|
|
|
|
|
|
|
для: Zack
(04.11.2005 в 19:11)
| | Боюсь, это невозможно, иначе пришлось бы передавать большое количество параметров методом $_GET (через адресную строку). В качестве альтернативы можно попробовать кнопки-картинки (input type='image') | |
|
|
|
|
|
|
|
для: antf
(04.11.2005 в 16:20)
| | Вроде работае! Но у меня возник еще один вопрос: Как переделать две кнопки "Архив" и "Результаты" в текстовые ссылки? Причем рассположить их под счетчиком "Всего проголосовало"?
Вот содержимое файла polls.php:
<?php
///////////////////////////////////////////////////
// Русский
// Система интернет-голосования Tabella
// 2005 (C) Федорченко А.А. (antf@inbox.ru)
// Franзais
// Systиme de sondages-internet Tabella
// 2005 (C) Fedortchenko A.A. (antf@inbox.ru)
///////////////////////////////////////////////////
?>
<?php
//include_once('paths.inc');
include_once('pollconfig.inc');
include_once("lng/rus_lng.inc");
include_once('functions.inc');
//Убираем пустые строки из массива Polls
if(($ProtSession == 'yes') || ($ProtCookie == 'yes'))
{
include_once('sessionstart.inc');
}
$dr = opendir('txt');
while($file = readdir($dr))
{
if(strpos($file, 'cp') !== false)
$PollFiles[] = $file;
}
closedir($dr);
if(!empty($PollFiles))
{
$MdInx = 0; //индекс многомерного массива
for($i = (count($PollFiles)-1); $i >= 0; $i--)
{
$Poll = file('txt/'.$PollFiles[$i]);
$TypeFile = "txt/".str_replace('cp', 'type', $PollFiles[$i]);
$TypeArr = @file($TypeFile);
if($TypeArr[0] == '') $TypeArr[0] = 'radio';
$PollsMD[$MdInx]['type'] = trim($TypeArr[0]);
$PollsMD[$MdInx]['min'] = trim($TypeArr[1]);
$PollsMD[$MdInx]['max'] = trim($TypeArr[2]);
for($b = 0; $b < count($Poll); $b++)
{
if(strpos($Poll[$b], '[quest]') !== false)
{
$PollsMD[$MdInx]['quest'] = trim(StripBBCode($Poll[$b]));
$PollsMD[$MdInx]['file'] = base64_encode($PollFiles[$i]);
}
if(ereg("\[var[0-9a-z]+\]", $Poll[$b]) !== false)
$PollsMD[$MdInx][$Variants][] = trim(StripBBCode($Poll[$b]));
if(strpos($Poll[$b], '[show]') !== false)
{
$PollsMD[$MdInx]['showstatus'] = trim(StripBBCode($Poll[$b]));
$ShowStatusStr .= $PollsMD[$MdInx]['showstatus'];
}
if(strpos($Poll[$b], '[protect]') !== false)
{
$PollsMD[$MdInx]['protect'] = trim(StripBBCode($Poll[$b]));
}
if(strpos($Poll[$b], '[time]') !== false)
{
$PollsMD[$MdInx]['time'] = trim(StripBBCode($Poll[$b]));
$MdInx++;
}
}
} //for($i = 0; $i < count($Polls); $i++)
} //if(file_exists($File_CurrentPoll) && (filesize($File_CurrentPoll)>3))
if(strpos($ShowStatusStr, '1') !== false)
{
for($i = 0; $i < count($PollsMD); $i++)
{
//print $PollsMD[$i]['initpos'];
if($PollsMD[$i]['showstatus'] == '1')
{
if($PollsMD[$i]['type'] == 'checkbox')
{
$Count = (count($PollsMD[$i][$Variants])) / 2;
if($Count < $PollsMD[$i]['max'])
$PollsMD[$i]['max'] = $Count;
$Tmp = $Cpt_chkbx_Limit;
$Tmp = str_replace('MIN', $PollsMD[$i]['min'], $Tmp);
$Tmp = str_replace('MAX', $PollsMD[$i]['max'], $Tmp);
print $Tmp;
}
print "<form name=PollForm{$i} method=post action=vote.php>";
$First = 'checked';
print "<table cellspacing=1 cellpadding=1 width=200 border=0>";
print "<tr><td>{$PollsMD[$i]['quest']}</td></tr>";
print "</table>";
//print count($PollsMD[$Variants]);
print "<table cellspacing=1 cellpadding=1 width=200 border=0>";
$Total = 0;
for($b = 0; $b < count($PollsMD[$i][$Variants]); $b = $b + 2)
{
$Tmp = (int)$PollsMD[$i][$Variants][($b+1)];
$Total += $Tmp;
print "<tr>";
if($PollsMD[$i]['type'] == 'checkbox')
print "<td width=20><input type=checkbox name=check[$b] {$First}></td>";
if($PollsMD[$i]['type'] == 'radio')
print "<td width=20><input type=radio name=variant value={$b} {$First}></td>";
print "<td>{$PollsMD[$i][$Variants][$b]}</td>";
print "</tr>";
$First = '';
}
print "</table>";
//выводим общее количество проголосовавших
if($ShowResultsOnFirst == 'yes')
{
print "<table cellspacing=1 cellpadding=1 width=200 border=0>";
print "<tr><td>{$Cpt_Total} {$Total}</td></tr>";
print "</table>";
}
//один пароль на всех
if($PollsMD[$i]['protect'] == 'pswrdall')
{
print "<table cellspacing=1 cellpadding=1 width=200 border=1>";
print "<tr>";
print "<td>{$Cpt_Password}</td>";
print "<td><input type=password name=password value='' size=35 maxlength=35></td>";
print "</tr>";
print "</table>";
}
//логин и пароль для каждого
if($PollsMD[$i]['protect'] == 'pswrdeach')
{
print "<table cellspacing=1 cellpadding=1 width=200 border=1>";
print "<tr>";
print "<td>{$Cpt_Login}</td>";
print "<td><input type=password name=login value='' size=35 maxlength=35></td>";
print "</tr>";
print "<tr>";
print "<td>{$Cpt_Password}</td>";
print "<td><input type=password name=password value='' size=35 maxlength=35></td>";
print "</tr>";
print "</table>";
}
//кнопки
$Time = base64_encode($PollsMD[$i]['time']);
print "<table cellspacing=1 cellpadding=1 width=200 border=0>";
print "<tr>";
print "<td><input type=Submit name=Vote value='{$Button_Vote}'></td>";
if($Total != 0)
print "<td><input type=Submit name=ShowResults value='{$Button_ShowResults}'></td>";
print "<td><input type=Submit name=PollArchive value='{$Button_ShowArchive}'></td>";
print "<input type=hidden name=blague value='{$PollsMD[$i]['file']}'>";
print "<input type=hidden name=time value='{$Time}'>";
print "</tr>";
print "</table>";
if($PollsMD[$i]['type'] == 'checkbox')
{
print "<input type=hidden name=MinChosenCount value={$PollsMD[$i]['min']}>";
print "<input type=hidden name=MaxChosenCount value={$PollsMD[$i]['max']}>";
}
print "</form>";
} //if($PollsMD['showstatus'] == 1)
} //for($i = 0; $i < count($PollsMD); $i++)
}
?>
|
Заранее спасибо! | |
|
|
|
|
|
|
|
для: antf
(04.11.2005 в 16:13)
| | Ай :) и еще, если вы уже используете сессии, тогда уберите нижеприведенный код из модуля polls.php, а если нет, тогда пропишите в самом начале index.php session_start();
Код, который нужно убрать
if(($ProtSession == 'yes') || ($ProtCookie == 'yes'))
{
include_once('sessionstart.inc');
} | |
|
|
|
|
|
|
|
для: Zack
(04.11.2005 в 13:44)
| | 1) Судя по всемы вы неправильно прописали путь к polls.php :), поскольку система не может его найти.
2) Я вижу, что система находится в директории voting, а подключаете вы ее через файл index.php, расположенный в корне. Тогда все пути будут рассчитываться относительно корня, что приведет к проблемам в функционировании приложения. Выход:
Перед в index.php прописать следующий код:
<?
chdir('voting');
include('voting/polls.php');
chdir('..');
?>
|
| |
|
|
|
|