Файл: region_clean/elections/index.php
Строк: 518
<?php
#######################################
## Mod By KoT (borispol) [76-75-072] ##
#######################################
require_once "../start.php";
require_once "../sid.php";
header("Cache-Control: no-cache");
if ($ver == "wml") header ("Content-type:text/vnd.wap.wml; charset=utf-8");
else header("Content-Type:text/html; charset=UTF-8");
require_once "../inc.php";
$link = connect_db();
list($row, $id, $ps, $fsize1, $fsize2) = check_login($link);
require_once "../version.php";
if ($ver == "wml") {
echo $xml;
echo $dtd;
echo "<wml>
<card id="index" title="Выборы чата">
<p align="center">";
} else {
echo "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="../css/$css.css"/>
<title>Выборы чата</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
<div align="center">";
}
$config_bookpost = 5;
$day = date("d.m.y");
$timer = date("H:i");
$idsd = $_SESSION['id'];
echo '<div class="c4">Меню выборов чата</div><br/>';
if ($action == "") {
$file = file("../dataelections/list.lst");
$total = count($file);
if (empty($_GET['start'])) $start = 0;
else $start = intval($_GET['start']);
if ($total < $start + $config_bookpost) { $end = $total; }
else { $end = $start + $config_bookpost; }
for ($fm = $start; $fm < $end; $fm++) {
$file = file("../dataelections/list.lst");
$file = array_reverse($file);
$dt = explode("|",$file[$fm]);
$num = $total-$fm-1;
if ($fm >= 0) {
echo 'Название: <b>'.$dt[1].'</b><br/>Создан: <b>'.$dt[2].' / '. $dt[3].'</b><br/>Условия: '.$dt[0].'<br/>';
echo 'Автор: <b>'. $dt[5].'</b><br/>';
if ($dt[4] == 0) { $types = "Закрыто"; $mod = 0; }
if ($dt[4] == 1) { $types = "Открыто"; $mod = 1; }
$proverka = file("../elections_d/$dt[6].dat");
$ster = strlen($dt[6]);
if (empty($proverka) or $ster < 1) {
{
$countxd = 0;
}
} else {
$filex = file("../elections_d/$dt[6].dat");
$countxd = count($filex);
}
echo 'Голосование: <b>'.$types.'</b><br/>';
$filex = file("adminlist.dat");
$countx = count($filex);
$switchx = 0;
$wordx = "$idsd";
for ($ix = 0; $ix < $countx; $ix++) {
if (trim($filex[$ix]) == $wordx) { $switchx=1; } }
if ($switchx == 1)
{
echo '<a href="index.php?action=go&rd='.$num.'&uid='.$dt[6].'&'.$ses.'&ref='.$ref.'">[Добавить кандидата]</a><br/>';
}
echo '<a href="index.php?action=list&uid='.$dt[6].'&'.$ses.'&ref='.$ref.'">[Посмотреть кандидатов]</a> ['.$countxd.']';
if ($mod == 1) { echo '<br/><a href="index.php?action=votelist&uid='.$dt[6].'&'.$ses.'&ref='.$ref.'">[Голосовать!]</a>';
}
if ($mod == 0) { echo '<br/>Голосование пока закрыто';
}
echo '<br/><br/>';
}
}
if ($total < 1) { echo '<br/><b>Выборов еще нет!</b><br/>'; }
echo $divide;
if ($start != 0) { echo '<a href="index.php?start='.($start - $config_bookpost).'&'.$ses.'&ref='.$ref.'"><-Назад </a> '; }else { echo'<-Назад '; }
echo '|';
if ($total > $start + $config_bookpost) { echo ' <a href="index.php?start='.($start + $config_bookpost).'&'.$ses.'&ref='.$ref.'">Далее-></a>';
} else {
echo ' Далее->';
}
$ba=ceil($total/$config_bookpost);
$ba2=$ba*$config_bookpost-$config_bookpost;
echo '<br/>Страницы:';
$asd2=$start+($config_bookpost*4);
if ($asd < $total and $asd > 0) { echo ' <a href="index.php?start=0&'.$ses.'&ref='.$ref.'">1</a> ... '; }
for($i=$asd; $i < $asd2;)
{
if ($i < $total and $i >= 0) {
$ii=floor(1+$i/$config_bookpost);
if ($start == $i) {
echo ' <b>('.$ii.')</b>';
} else {
echo ' <a href="index.php?start='.$i.'&'.$ses.'&ref='.$ref.'">'.$ii.'</a>';
}
}
$i=$i+$config_bookpost;
}
if ($asd2 < $total) {
echo ' ... <a href="index.php?start='.$ba2.'&'.$ses.'&ref='.$ref.'">'.$ba.'</a>';
}
echo '<br/><br/>Всего выборов : <b>'.(int)$total.'</b><br/>';
}
//---------------------------------------- РЕДАКТИРОВАНИЕ -------------------------------------------//
if ($action == "go") {
$filex = file("adminlist.dat");
$countx = count($filex);
$switchx = 0;
$wordx = "$idsd";
for ($ix = 0; $ix < $countx; $ix++) {
if (trim($filex[$ix]) == $wordx) { $switchx=1; } }
if ($switchx == 1)
{
$id = $row['id'];
$r = mysql_query ("select id,user,level from users where id='$id';");
$arr = mysql_fetch_array($r);
$login = $arr['user'];
$usid = $arr['id'];
$lev = $arr['level'];
$rd = intval($_GET['rd']);
$lines = file("../dataelections/list.lst");
if (isset($rd)) {
$dt = explode("|", $lines[$rd]);
echo 'Подача своей работы на голосование: <b>'.$dt[1].'</b><br/><br/>';
if ($ver != "wml") {
echo '<form action="index.php?action=addedit&'.$ses.'&ref='.$ref.'" method="POST">';
echo 'ID кандидата:<br/><input name="ids" value=""/><br/>
Текст резюме:<br/>
<textarea cols="30" rows="3" name="msg"></textarea><br/>
<input type="hidden" name="uid" value="'.$dt[6].'">
<input type="hidden" name="nick" value="'.$login.'">
<br/><input type="submit" class="ibutton" value="Отправить!"></form>';
} else {
echo '<br/>--------------------<br/>
ID кандидата:<br/><input name="ids" value=""/><br/>
Условие:<br/>
<input name="msg" value=""/><br/>
<anchor>Отправить
<go href="index.php?action=addedit&'.$ses.'&ref='.$ref.'" method="post">
<postfield name="msg" value="$(msg)"/>
<postfield name="ids" value="$(ids)"/>
<postfield name="uid" value="'.$dt[6].'"/>
<postfield name="nick" value="'.$login.'"/>
</go></anchor><br/>--------------------<br/>';
}
}
else { echo 'Произошла ошибка...<br/><br/>'; }
} else {
echo 'Ты не Админ выборов!!!<br/><br/>';
}
}
//---------------------------------------- ИЗМЕНЕНИЕ СООБЩЕНИЯ -------------------------------------------//
if ($action == "addedit") {
$msg = htmlspecialchars(check($msg));
$uid = intval($uid);
$nick = htmlspecialchars(check($nick));
$ids = intval($ids);
$rand = rand(10000000,99999999);
if (empty($msg) or empty($ids)) {
echo 'Ошибка! Не заполнено поле ID или резюме!<br/>';
include_once '../foot.php';
exit;
}
$text = $msg.'|'.$nick.'|'.$day.'|'.$timer.'|'.$rand.'|'.$ids.'|';
$text = preg_replace ("|[rn]+|si","",$text);
$Data = file("../elections_d/$uid.dat");
foreach($Data as $str) {
$ids = explode("|",$str);
if ($ids[5] == $_POST['ids']) {
echo 'Ошибка! Этот кандидат уже притствует.<br/>';
include_once '../foot.php';
exit;
}
}
$fp = fopen("../elections_d/$uid.dat","a+");
flock ($fp,LOCK_EX);
fputs($fp,"$textrn");
flock ($fp,LOCK_UN);
fclose($fp);
echo 'Кандидат прибыл!<br/><br/>';
}
//---------------------------------------- ИЗМЕНЕНИЕ СООБЩЕНИЯ -------------------------------------------//
if ($action == "vote") {
$id = $row['id'];
$filexxx = file("../elections_dvote/".$uid."_ip.dat");
$countxxx = count($filexxx);
$switchxxx = 0;
$wordxxx = "$id";
for ($ixxx = 0; $ixxx < $countxxx; $ixxx++) {
if (trim($filexxx[$ixxx]) == $wordxxx) { $switchxxx = 1; } }
if ($switchxxx == 1)
{
echo 'Не нужно дважды голосовать!';
echo '<br/><a href="index.php?action=list&uid='.$uidx.'&'.$ses.'&ref='.$ref.'">Вернуться</a><br/><br/>';
}
else
{
$msg = htmlspecialchars(check($msg));
$uid = intval($uid);
$nick = htmlspecialchars(check($nick));
$f = file("../elections_dvote/$uid.dat");
$u = explode("|",$f[0]);
$u[0]++;
$t = $u[0].'|';
$fp = fopen("../elections_dvote/$uid.dat","a+");
flock ($fp,LOCK_EX);
ftruncate ($fp,0);
fputs($fp,$t);
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
$fp = fopen("../elections_dvote/".$uid."_ip.dat","a+");
flock ($fp,LOCK_EX);
fputs($fp,"$idrn");
flock ($fp,LOCK_UN);
fclose($fp);
echo 'Твой голос принят!<br/><br/>';
}
}
if ($action == "votelist") {
if (!is_numeric($uid))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font>
<br/><br/><a href="index.php?'.$ses.'&ref='.$ref.'">К выборам</a><br/>
<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
exit;
}
$uid = intval($uid);
$file = file("../elections_d/$uid.dat");
$total = count($file);
if (empty($_GET['start'])) $start = 0;
else $start = intval($_GET['start']);
if ($total < $start + $config_bookpost) { $end = $total; }
else
{
$end = $start + $config_bookpost;
}
for ($fm = $start; $fm < $end; $fm++) {
$file = file("../elections_d/$uid.dat");
$file = array_reverse($file);
$dt = explode("|",$file[$fm]);
$num = $total-$fm-1;
if ($fm >= 0) {
$proverka = file("../elections_d/$uid.dat");
$ster = strlen($uid);
if (empty($proverka) or $ster < 1) {
{
$total = 0;
}
} else {
$r = mysql_query ("select user from users where id='".$dt[5]."';");
$arr = mysql_fetch_array($r);
$uz = $arr['user'];
echo '<a href="index.php?action=view&uidx='.$uid.'&uid='.$dt[4].'&ids='.$num.'&'.$ses.'&ref='.$ref.'"><b>'.$uz.'</b></a> ('.$dt[2].' / '. $dt[3].')';
$filex = file("../elections_dvote/$dt[4].dat");
$dtx = explode("|",$filex[0]);
$xxx2 = $dtx[0];
if ($xxx2 == "") { $xxx2 = 0; }
echo '<br/><a href="index.php?action=vote&uid='.$dt[4].'&'.$ses.'&ref='.$ref.'">[Голосовать!]</a> ['.$xxx2.']<br/>';
$filex = file("adminlist.dat");
$countx = count($filex);
$switchx = 0;
$wordx = "$idsd";
for ($ix = 0; $ix < $countx; $ix++) {
if (trim($filex[$ix]) == $wordx) { $switchx = 1; } }
if ($switchx == 1)
{
echo '<br/><a href="index.php?action=dells&uid='.$uid.'&rd='.$num.'&'.$ses.'&ref='.$ref.'">[Удалить кандидата]</a>';
}
echo '<br/>';
}
}
}
if ($total < 1) {
echo '<b>Кандидатов пока что нет...</b><br/>';
}
echo $divide;
if ($start != 0) {
echo '<a href="index.php?action=votelist&uid='.$uid.'&start='.($start - $config_bookpost).'&'.$ses.'&ref='.$ref.'"><-Назад </a> ';
} else {
echo '<-Назад ';
}
echo '|';
if ($total > $start + $config_bookpost) {
echo ' <a href="index.php?action=votelist&uid='.$uid.'&start='.($start + $config_bookpost).'&'.$ses.'&ref='.$ref.'">Далее-></a>';
} else {
echo ' Далее->';
}
$ba=ceil($total/$config_bookpost);
$ba2=$ba*$config_bookpost-$config_bookpost;
echo '<br/>Страницы:';
$asd2=$start+($config_bookpost*4);
if ($asd < $total and $asd > 0) {
echo ' <a href="index.php?action=votelist&uid='.$uid.'&start=0&'.$ses.'&ref='.$ref.'">1</a> ... ';
}
for($i = $asd; $i < $asd2;)
{
if ($i < $total and $i >= 0) {
$ii=floor(1+$i/$config_bookpost);
if ($start == $i) {
echo ' <b>('.$ii.')</b>';
} else {
echo ' <a href="index.php?action=votelist&uid='.$uid.'&start='.$i.'&'.$ses.'&ref='.$ref.'">'.$ii.'</a>';
}
}
$i=$i+$config_bookpost;
}
if ($asd2 < $total) {
echo ' ... <a href="index.php?action=votelist&uid='.$uid.'&start='.$ba2.'&'.$ses.'&ref='.$ref.'">'.$ba.'</a>';
}
echo '<br/><br/>Всего представлено кандидатов : <b>'.(int)$total.'</b><br/>';
$filex = file("adminlist.dat");
$countx = count($filex);
$switchx = 0;
$wordx = "$idsd";
for ($ix = 0; $ix < $countx; $ix++) {
if (trim($filex[$ix]) == $wordx) { $switchx = 1; } }
if ($switchx == 1)
{
if ($total > 1) {
echo '<br/><a href="index.php?uid='.$uid.'&action=alldel&'.$ses.'&ref='.$ref.'">Удалить всех!</a><br/>';
}
}
}
if ($action == "list") {
if (!is_numeric($uid))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font>
<br/><br/><a href="index.php?'.$ses.'&ref='.$ref.'">К выборам</a><br/>
<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
exit;
}
$uid = intval($uid);
$file = file("../elections_d/$uid.dat");
$total = count($file);
if (empty($_GET['start'])) $start = 0;
else $start = intval($_GET['start']);
if ($total < $start + $config_bookpost) { $end = $total; }
else
{
$end = $start + $config_bookpost;
}
for ($fm = $start; $fm < $end; $fm++) {
$file = file("../elections_d/$uid.dat");
$file = array_reverse($file);
$dt = explode("|",$file[$fm]);
$num = $total-$fm-1;
if ($fm >= 0) {
$proverka = file("../elections_d/$uid.dat");
$ster = strlen($uid);
if (empty($proverka) or $ster < 1) {
{
$total = 0;
}
} else {
$r = mysql_query ("select user from users where id='".$dt[5]."';");
$arr = mysql_fetch_array($r);
$uz = $arr['user'];
echo '<a href="index.php?action=view&uidx='.$uid.'&uid='.$dt[4].'&ids='.$num.'&'.$ses.'&ref='.$ref.'"><b>'.$uz.'</b></a> ('.$dt[2].' / '. $dt[3].')';
$filex = file("../elections_dvote/$dt[4].dat");
$dtx = explode("|",$filex[0]);
$xxx2 = $dtx[0];
if ($xxx2 == "") { $xxx2 = 0; }
echo '<br/>[Кол-во голосов: '.$xxx2.']';
$filex = file("adminlist.dat");
$countx = count($filex);
$switchx = 0;
$wordx = "$idsd";
for ($ix = 0; $ix < $countx; $ix++) {
if (trim($filex[$ix]) == $wordx) { $switchx = 1; } }
if ($switchx == 1)
{
echo'<br/><a href="index.php?action=viewvote&uidx='.$uid.'&uid='.$dt[4].'&ids='.$num.'&'.$ses.'&ref='.$ref.'">[Просмотр голосовавших]</a><br/><a href="index.php?action=dells&uid='.$uid.'&rd='.$num.'&'.$ses.'&ref='.$ref.'">[Удалить кандидата]</a>';
}
echo '<br/>';
}
}
}
if ($total < 1) {
echo '<b>Кандидатов пока что нет.</b><br/>';
}
echo $divide;
if ($start != 0) {
echo '<a href="index.php?action=list&uid='.$uid.'&start='.($start - $config_bookpost).'&'.$ses.'&ref='.$ref.'"><-Назад </a> ';
} else {
echo '<-Назад ';
}
echo '|';
if ($total > $start + $config_bookpost) {
echo ' <a href="index.php?action=list&uid='.$uid.'&start='.($start + $config_bookpost).'&'.$ses.'&ref='.$ref.'">Далее-></a>';
} else {
echo ' Далее->';
}
$ba=ceil($total/$config_bookpost);
$ba2=$ba*$config_bookpost-$config_bookpost;
echo '<br/>Страницы:';
$asd2=$start+($config_bookpost*4);
if ($asd < $total and $asd > 0) {
echo ' <a href="index.php?action=list&uid='.$uid.'&start=0&'.$ses.'&ref='.$ref.'">1</a> ... ';
}
for($i = $asd; $i < $asd2;)
{
if ($i < $total and $i >= 0) {
$ii=floor(1+$i/$config_bookpost);
if ($start == $i) {
echo ' <b>('.$ii.')</b>';
} else {
echo ' <a href="index.php?action=list&uid='.$uid.'&start='.$i.'&'.$ses.'&ref='.$ref.'">'.$ii.'</a>';
}
}
$i=$i+$config_bookpost;
}
if ($asd2 < $total) {
echo ' ... <a href="index.php?action=list&uid='.$uid.'&start='.$ba2.'&'.$ses.'&ref='.$ref.'">'.$ba.'</a>';
}
echo '<br/><br/>Всего представлено кандидатов : <b>'.(int)$total.'</b><br/>';
$filex = file("adminlist.dat");
$countx = count($filex);
$switchx = 0;
$wordx = "$idsd";
for ($ix = 0; $ix < $countx; $ix++) {
if (trim($filex[$ix]) == $wordx)
{
$switchx = 1;
}
}
if ($switchx == 1)
{
if ($total > 1) {
echo '<br/><a href="index.php?uid='.$uid.'&action=alldel&'.$ses.'&ref='.$ref.'">Удалить всех!</a><br/>';
}
}
}
if ($action == "view") {
if (!is_numeric($uid) or !is_numeric($uidx))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font>
<br/><br/><a href="index.php?'.$ses.'&ref='.$ref.'">К выборам</a><br/>
<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
exit;
}
$id = $row['id'];
$r = mysql_query ("select id,user,level from users where id='$id';");
$arr = mysql_fetch_array($r);
$login = $arr['user'];
$usid = $arr['id'];
$lev = $arr['level'];
$rd = intval($_GET['ids']);
$lines = file("../elections_d/$uidx.dat");
if (isset($rd)) {
$dt = explode("|", $lines[$rd]);
$r = mysql_query ("select user from users where id='".$dt[5]."';");
$arr = mysql_fetch_array($r);
$uz = $arr['user'];
echo 'Просмотр резюме кандидата: <b>'.col_n($uz).'</b><br/><br/>';
echo "<b>Дата размещения:</b> $dt[2] / $dt[3]<br/><b>Содержание:</b> $dt[0]<br/><br/>";
$proverka = file("../elections_dkomm/$uid.dat");
$ster = strlen($uid);
if (empty($proverka) or $ster < 1) {
{
$xxx = 0;
}
} else {
$file = file("../elections_dkomm/$uid.dat");
$xxx = count($file);
}
$filex = file("../elections_dvote/$uid.dat");
$dtx = explode("|",$filex[0]);
$xxx2 = $dtx[0];
if ($xxx2 == "") { $xxx2 = 0; }
echo '[Кол-во голосов: '.$xxx2.']<br/>';
echo '<a href="index.php?action=komm&uid='.$uid.'&'.$ses.'&ref='.$ref.'">[Мнения о кандидате]</a> ['.$xxx.'] <br/><br/>';
}
else
{
echo 'Произошла ошибка...<br/><br/>';
}
echo '<a href="index.php?uid='.$uidx.'&action=list&'.$ses.'&ref='.$ref.'">К текущему голосованию</a><br/>';
}
if ($action == "viewvote") {
if (!is_numeric($uid) or !is_numeric($uidx) or !is_numeric($ids))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font>
<br/><br/><a href="index.php?'.$ses.'&ref='.$ref.'">К выборам</a><br/>
<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
exit;
}
echo '<b>Кто голосовал:</b><br/>';
$file = file("../elections_dvote/".$uid."_ip.dat");
$total = count($file);
if (empty($_GET['start'])) $start = 0;
else $start = intval($_GET['start']);
if ($total < $start + $config_bookpost) { $end = $total;}
else
{
$end = $start + $config_bookpost;
}
for ($fm = $start; $fm < $end; $fm++) {
$file = file("../elections_dvote/".$uid."_ip.dat");
$file = array_reverse($file);
$dt = explode("|",$file[$fm]);
$num = $total-$fm-1;
if ($fm >= 0) {
$rx = mysql_query ("select user from users where id ='".$dt[0]."';");
$arrx = mysql_fetch_array($rx);
$userx = $arrx[0];
echo "<a href="../info.php?$ses&nk=$idx&ref=$ref"><b>".col_n($userx)."</b></a>";
echo '<br/>';
}
}
if ($total < 1) { echo '<br/><b>Голосов еще нет!</b><br/>'; }
echo $divide;
if ($start != 0) { echo '<a href="index.php?action=viewvote&uid='.$uid.'&start='.($start - $config_bookpost).'&'.$ses.'&ref='.$ref.'"><-Назад </a> ';
} else {
echo '<-Назад ';
}
echo '|';
if ($total > $start + $config_bookpost) {
echo ' <a href="index.php?action=viewvote&uid='.$uid.'&start='.($start + $config_bookpost).'&'.$ses.'&ref='.$ref.'">Далее-></a>';
} else {
echo ' Далее->';
}
$ba=ceil($total/$config_bookpost);
$ba2=$ba*$config_bookpost-$config_bookpost;
echo '<br/>Страницы:';
$asd2=$start+($config_bookpost*4);
if ($asd < $total and $asd > 0) {
echo ' <a href="index.php?action=viewvote&uid='.$uid.'&start=0&'.$ses.'&ref='.$ref.'">1</a> ... ';
}
for($i = $asd; $i < $asd2;)
{
if ($i < $total and $i >= 0) {
$ii=floor(1+$i/$config_bookpost);
if ($start == $i) {
echo ' <b>('.$ii.')</b>';
} else {
echo ' <a href="index.php?action=viewvote&uid='.$uid.'&start='.$i.'&'.$ses.'&ref='.$ref.'">'.$ii.'</a>';
}
}
$i=$i+$config_bookpost;
}
if ($asd2 < $total) {
echo ' ... <a href="index.php?action=viewvote&uid='.$uid.'&start='.$ba2.'&'.$ses.'&ref='.$ref.'">'.$ba.'</a>';
}
echo '<br/><br/>Всего голосов : <b>'.(int)$total.'</b><br/><a href="index.php?action=view&uid='.$uid.'&uidx='.$uidx.'&ids='.$ids.'&'.$ses.'&ref='.$ref.'">К кандидату</a><br/>';
}
//---------------------------------------- УДАЛЕНИЕ СООБЩЕНИЯ -------------------------------------------//
if ($action == "dells") {
if (!is_numeric($uid))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font>
<br/><br/><a href="index.php?'.$ses.'&ref='.$ref.'">К выборам</a><br/>
<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
exit;
}
$filex = file("adminlist.dat");
$countx = count($filex);
$switchx = 0;
$wordx = "$idsd";
for ($ix = 0; $ix < $countx; $ix++) {
if (trim($filex[$ix]) == $wordx) { $switchx = 1; } }
if ($switchx == 1)
{
if (isset($rd)) {
$file = file("../elections_d/$uid.dat");
$fp = fopen("../elections_d/$uid.dat","w");
flock ($fp,LOCK_EX);
for ($i = 0; $i < sizeof($file); $i++) {
if ($i == $rd) { unset($file[$i]); } }
fputs($fp, implode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);
}
echo 'Работа удалена<br/><br/>';
}
else { echo 'Ты не Админ выборов!<br/><br/>'; }
}
if ($action == "alldel") {
if (!is_numeric($uid))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font>
<br/><br/><a href="index.php?'.$ses.'&ref='.$ref.'">К выборам</a><br/>
<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
exit;
}
$filex = file("adminlist.dat");
$countx = count($filex);
$switchx = 0;
$wordx = "$idsd";
for ($ix = 0; $ix < $countx; $ix++) {
if (trim($filex[$ix]) == $wordx) { $switchx = 1; } }
if ($switchx == 1)
{
$file = file("../elections_d/$uid.dat");
$fp = fopen("../elections_d/$uid.dat","a+");
flock ($fp,LOCK_EX);
ftruncate ($fp,0);
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
echo 'Все работы Голосований удалены!<br/><br/>';
}
else { echo 'Ты не Админ выборов!<br/><br/>'; }
}
if ($action == "komm") {
if (!is_numeric($uid))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font>
<br/><br/><a href="index.php?'.$ses.'&ref='.$ref.'">К выборам</a><br/>
<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
exit;
}
$id = $row['id'];
$r = mysql_query ("select id,user,level from users where id='$id';");
$arr = mysql_fetch_array($r);
$login = $arr['user'];
$usid = $arr['id'];
$lev = $arr['level'];
if ($ver != "wml") {
echo '<form action="index.php?action=addkomm&uid='.$uid.'&'.$ses.'&ref='.$ref.'" method="POST">';
echo 'Текст:<br/>
<textarea cols="30" rows="3" name="msg">'.$dt[0].'</textarea><br/>
<input type="hidden" name="uid" value="'.$uid.'">
<input type="hidden" name="nick" value="'.$login.'">
<br/><input type="submit" class="ibutton" value="Отправить!"></form>';
} else {
echo '<br/>--------------------<br/>
Текст:<br/>
<input name="msg" value="'.$dt[0].'"/><br/>
<anchor>Отправить!
<go href="index.php?action=addkomm&uid='.$uid.'&'.$ses.'&ref='.$ref.'" method="post">
<postfield name="msg" value="$(msg)"/>
<postfield name="uid" value="'.$uid.'"/>
<postfield name="nick" value="'.$login.'"/>
</go></anchor><br/>--------------------<br/>';
}
$file = file("../elections_dkomm/$uid.dat");
$total = count($file);
if (empty($_GET['start'])) $start = 0;
else $start = intval($_GET['start']);
if ($total < $start + $config_bookpost) { $end = $total; }
else
{
$end = $start + $config_bookpost;
}
for ($fm = $start; $fm < $end; $fm++) {
$file = file("../elections_dkomm/$uid.dat");
$file = array_reverse($file);
$dt = explode("|",$file[$fm]);
$num = $total-$fm-1;
if ($fm >= 0) {
$proverka = file("../elections_dkomm/$uid.dat");
$ster = strlen($uid);
if (empty($proverka) or $ster < 1) {
{
echo 'Пусто...<br/>';
}
} else {
echo '<b>'.$dt[1].'</b> ('.$dt[2].' / '. $dt[3].') <br/>'.$dt[0].'<br/>';
$filex = file("adminlist.dat");
$countx = count($filex);
$switchx = 0;
$wordx = "$idsd";
for ($ix = 0; $ix < $countx; $ix++) {
if (trim($filex[$ix]) == $wordx) { $switchx = 1; } }
if ($switchx == 1)
{
echo '<a href="index.php?action=del&rd='.$num.'&uid='.$uid.'&'.$ses.'&ref='.$ref.'">[Удалить]</a><br/>';
}
echo '<br/>';
}
}
}
echo $divide;
if ($start != 0) {
echo '<a href="index.php?action=komm&uid='.$uid.'&start='.($start - $config_bookpost).'&'.$ses.'&ref='.$ref.'"><-Назад </a> ';
} else {
echo '<-Назад ' ;
}
echo '|';
if ($total > $start + $config_bookpost) {
echo ' <a href="index.php?action=komm&uid='.$uid.'&start='.($start + $config_bookpost).'&'.$ses.'&ref='.$ref.'">Далее-></a>';
} else {
echo ' Далее->';
}
$ba=ceil($total/$config_bookpost);
$ba2=$ba*$config_bookpost-$config_bookpost;
echo '<br/>Страницы:';
$asd2=$start+($config_bookpost*4);
if ($asd < $total and $asd > 0) {
echo ' <a href="index.php?action=komm&uid='.$uid.'&start=0&'.$ses.'&ref='.$ref.'">1</a> ... ';
}
for($i = $asd; $i < $asd2;)
{
if ($i < $total and $i >= 0) {
$ii=floor(1+$i/$config_bookpost);
if ($start == $i) {
echo ' <b>('.$ii.')</b>';
} else {
echo ' <a href="index.php?action=komm&uid='.$uid.'&start='.$i.'&'.$ses.'&ref='.$ref.'">'.$ii.'</a>';
}
}
$i=$i+$config_bookpost;
}
if ($asd2 < $total) {
echo ' ... <a href="index.php?action=komm&uid='.$uid.'&start='.$ba2.'&'.$ses.'&ref='.$ref.'">'.$ba.'</a>';
}
echo '<br/><br/>Всего комментов : <b>'.(int)$total.'</b><br/>';
$filex = file("adminlist.dat");
$countx = count($filex);
$switchx = 0;
$wordx = "$idsd";
for ($ix = 0; $ix < $countx; $ix++) {
if (trim($filex[$ix]) == $wordx) { $switchx = 1; } }
if ($switchx == 1)
{
if ($total > 1) {
echo '<br/><a href="index.php?action=delkomm&uid='.$uid.'&'.$ses.'&ref='.$ref.'">Удалить все комменты!</a><br/>'; } }
}
//---------------------------------------- УДАЛЕНИЕ СООБЩЕНИЯ -------------------------------------------//
if ($action == "del") {
if (!is_numeric($uid))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font>
<br/><br/><a href="index.php?'.$ses.'&ref='.$ref.'">К выборам</a><br/>
<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
exit;
}
$filex = file("adminlist.dat");
$countx = count($filex);
$switchx = 0;
$wordx = "$idsd";
for ($ix = 0; $ix < $countx; $ix++) {
if (trim($filex[$ix]) == $wordx) { $switchx = 1; } }
if ($switchx == 1)
{
if (isset($rd)) {
$file = file("../elections_dkomm/$uid.dat");
$fp = fopen("../elections_dkomm/$uid.dat","w");
flock ($fp,LOCK_EX);
for ($i = 0; $i < sizeof($file); $i++) {
if ($i == $rd) { unset($file[$i]); } }
fputs($fp, implode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);
}
echo 'Коммент удален<br/><br/>';
}
else { echo 'Ты не Админ выборов!<br/><br/>'; }
}
if ($action == "delkomm") {
if (!is_numeric($uid))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font>
<br/><br/><a href="index.php?'.$ses.'&ref='.$ref.'">К выборам</a><br/>
<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
exit;
}
$filex = file("adminlist.dat");
$countx = count($filex);
$switchx = 0;
$wordx = "$idsd";
for ($ix = 0; $ix < $countx; $ix++) {
if (trim($filex[$ix]) == $wordx) { $switchx = 1; } }
if ($switchx == 1)
{
$file = file("../elections_dkomm/$uid.dat");
$fp = fopen("../elections_dkomm/$uid.dat","a+");
flock ($fp,LOCK_EX);
ftruncate ($fp,0);
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
echo 'Все комменты работы Голосований удалены!<br/><br/>';
}
else { echo 'Ты не Админ выборов!<br/><br/>'; }
}
if ($action == "addkomm") {
if (!is_numeric($uid))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font>
<br/><br/><a href="index.php?'.$ses.'&ref='.$ref.'">К выборам</a><br/>
<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
exit;
}
$msg = htmlspecialchars(check($msg));
$uid = intval($uid);
$nick = htmlspecialchars(check($nick));
$text = $msg.'|'.$nick.'|'.$day.'|'.$timer.'|';
$text = preg_replace ("|[rn]+|si","",$text);
$fp = fopen("../elections_dkomm/$uid.dat","a+");
flock ($fp,LOCK_EX);
fputs($fp,"$textrn");
flock ($fp,LOCK_UN);
fclose($fp);
echo 'Твой комментарий принят!<br/><br/>';
}
echo '<div class = "d1"><a href="index.php?'.$ses.'&ref='.$ref.'">К выборам</a><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a></div>';
include_once "../foot.php";
ob_end_flush();
exit;
?>