File size: 3.2Kb
<?php
########################################
## WAP-ENGINE ##
########################################
## ##
## Автор : CHUMA (Токарев Владимир) ##
## e-mail : [email protected] ##
## WAP : http://wap-engine.ru ##
## ##
########################################
## ВЫ НЕ ИМЕЕТЕ ПРАВО ##
## ИЗМЕНЯТЬ КОД СКРИПТА ##
## ДЛЯ ДАЛЬНЕЙШЕГО РАСПРОСТРАНЕНИЯ! ##
########################################
include ('../../config.php');
include ('../../templates/run.php');
include ('../../templates/func.php');
####################
$id = filter($_GET['id']);
$str = filter($_GET['str']);
$vote = filter($_POST['vote']);
$razdel_data = '../../data/votes/votes.php';
$razdel_f = file($razdel_data);
$razdel_arr = explode('|', $razdel_f[$str]);
$id_data = '../../data/votes/'.$id.'.php';
$id_f = @file($id_data);
$id_count = count($id_f);
$voted_f = @file('../../data/votes/'.$id.'_voted.php');
$voted_count = count($voted_f);
####################
if(isset($_SESSION['sespass']) && isset($passw) && $_SESSION['sespass'] == $passw)
{
if($razdel_arr[0] == $id)
{
$voted_est = 0;
for($i=2; $i < $voted_count - 2; $i++)
{
if(strstr($voted_f[$i], $login))
{
$voted_est = 1;
break;
}
else
{
$voted_users[] = $voted_f[$i];
}
}
if($voted_est == 1)
{
header ('Location: showvote.php?err=1&id='.$id.'&str='.$str.'&'.session_name().'='.session_id().'');
exit;
}
for($i=2; $i < $id_count - 2; $i++)
{
if($i == $vote)
{
$id_arr_exp = explode('|', $id_f[$i]);
$vote_num = trim($id_arr_exp[1]) + 1;
$id_arr[] = trim($id_arr_exp[0].'|'.$vote_num);
}
else
{
$id_arr[] = trim($id_f[$i]);
}
}
if(!empty($id_arr))
{ $id_n_str = trim(implode("\r\n", $id_arr)); } else
{ $id_n_str = ''; }
$str_put = "<?php\r\n/*\r\n$id_n_str\r\n*/\r\n?>";
write_to_file($id_data, $str_put);
$vo_count = count($voted_users);
$vo_to_file = "$login\r\n";
for($i=0; $i < $vo_count; $i++)
{
$vo_to_file .= trim($voted_users[$i])."\r\n";
}
$vo_to_file = trim($vo_to_file);
write_to_file('../../data/votes/'.$id.'_voted.php', "<?php\r\n/*\r\n$vo_to_file\r\n*/\r\n?>");
header ('Location: showvote.php?set=1&id='.$id.'&str='.$str.'&'.session_name().'='.session_id().'');
}
else
{
echo'<p class="err">ОШИБКА!!! Такого опроса не существует.</p>';
}
}
else
{
include '../../themes/'.$themes.'.php';
echo'<p class="err">Вы не авторизованы!!! Войдите в личный кабинет.<br /></p>';
echo'<p><a href="../kabinet/index.php?'.session_name().'='.session_id().'">В кабинет</a><br /></p>';
include '../../templates/foot.php';
}
####################
?>