Вход Регистрация
Файл: darkworld/forum.php
Строк: 194
<?
Error_Reporting
(E_ALL & ~E_NOTICE);
$rand=rand(100,1000000);
header("Content-type:text/vnd.wap.wml");
echo 
"<?xml version="1.0" encoding="UTF-8"?>";
echo 
"<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml12.dtd">";
echo "<wml>n";
echo 
"<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>";
echo 
"<card id="index" title="Форум">";
echo 
"<p align="left">";

$log htmlspecialchars(stripslashes($log));
$pas htmlspecialchars(stripslashes($pas));
/////////////////////////////////////////////////////
$text = @file("data/reg/$log.dat");
if (
$text!=""){
$udata explode(":||:",$text[0]);
$login=trim($udata[0]);
$password=trim($udata[1]);}
////////////////////////////////////////////////////////
if (md5($pas)==$password && $log==$login && $log!=="" && md5($pas)!=="") {
include(
"files/who.php");



switch(
$go) {

default:

$u explode(".",$login);

if(
$log=="$u[0].GM"){
echo
"<small><a href="forum.php?log=$log&amp;pas=$pas&amp;go=addforum">Добавить форум</a></small><br/>";
}

$text = @file("data/forum/count.dat");
$udata explode("||",$text[0]);
$count=trim($udata[0]);
for(
$i=0$i<$count$i++){

$text = @file("data/forum/$i/name.dat");
$udata explode("||",$text[0]);
$name=trim($udata[0]);
$tem=trim($udata[1]);
$msg=trim($udata[2]);

echo
"<small><br/><a href="forum.php?log=$log&amp;pas=$pas&amp;go=forum&amp;id=$i">$name</a> [$tem/$msg]</small>";

}

break;

case 
'addforum':

$u explode(".",$login);

if(
$log=="$u[0].GM"){

echo 
"<small>Название форума:</small><br/>";
echo 
"<input name="nameforum" maxlength="99" title="nameforum"/><br/>";
echo 
"<small><anchor title="go">OK<go href="forum.php?log=$log&amp;pas=$pas&amp;go=saveforum" method="post">";
echo 
"<postfield name="nameforum" value="$(nameforum)"/>";
echo 
"</go></anchor></small><br/>";

}else{echo
"<small>Вам суда доступ запрещен!</small>";}
break;

case 
'saveforum':

$u explode(".",$login);

if(
$log=="$u[0].GM"){

$text = @file("data/forum/count.dat");
$udata explode("||",$text[0]);
$count=trim($udata[0]);

$newdir=mkdir("data/forum/$count",0777);
if(
$newdir){echo"<small>Создание папки - OK.</small>";}else{
echo
"<small>Создание папки - ERROR.</small>";}

$fp=fopen("data/forum/$count/name.dat","w");
flock($fp,LOCK_EX);
ftruncate($fp,0);
fputs($fp,"$nameforum||0||0||");
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);
chmod ("data/forum/$count/name.dat"0666);

$count=$count+1;

$fp=fopen("data/forum/count.dat","w");
flock($fp,LOCK_EX);
ftruncate($fp,0);
fputs($fp,"$count||");
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);
chmod ("data/forum/count.dat"0666);

}else{echo
"<small>Вам суда доступ запрещен!</small>";}
break;

case 
'forum':

$id htmlspecialchars(stripslashes(addslashes($id)));

if(!@
file("data/forum/$id/name.dat")){echo"<small>Такой подфорум несуществует!</small>";include_once"files/down.php";exit;}


$text = @file("data/forum/$id/name.dat");

$udata explode("||",$text[0]);
$name=trim($udata[0]);
$tem=trim($udata[1]);
$msg=trim($udata[2]);
echo
"<small><a href="forum.php?log=$log&amp;pas=$pas&amp;go=addtem&amp;id=$id">Новая тема</a><br/>- - -</small><br/>";


if(
$tem=="0"){echo"<small>Форум пуст.</small>"; include_once"files/down.php"; exit;}


for(
$i=0$i<$tem$i++){


$text = @file("data/forum/$id/$i.dat");
$count=count($text);
$count=$count-1;
$udata explode("||",$text[0]);
$udata2 explode("||",$text[1]);

$kol[]=$count;
$date[]=$udata2[2];
$nick[]=$udata2[0];
$topic[]=$udata[0];
$sort[]=$udata2[3];
$nomer[]=$i;
arsort($sort);
}

foreach(
$sort as $k=>$v)
{
$name=$nick[$k];    $tema=$topic[$k];
$datet=$date[$k]; $i=$nomer[$k];
$num=$kol[$k];


$u explode(".",$login);


$data[]="<small><b><a href="search.php?log=$log&amp;pas=$pas&amp;nick=$name">$name</a></b> $datet<br/><a href="forum.php?log=$log&amp;pas=$pas&amp;go=tema&amp;id=$id&amp;tema=$i">$tema</a> ($num)<br/></small>";
}

if (
$start=="") {$start 0;}
if (
$tem $start 10){ $end $tem; }
else {
$end $start 10; }
for (
$i $start$i $end$i++){

echo 
$data[$i];
}


if (
$start != 0) {echo '<small><a href="forum.php?start='.($start 10).'&amp;log='.$log.'&amp;pas='.$pas.'&amp;id='.$id.'&amp;go=forum">Назад</a></small> ';}else{echo'<small>= = = =</small><br/>';}

if (
$tem $start 10) {echo ' <small><a href="forum.php?start='.($start 10).'&amp;log='.$log.'&amp;pas='.$pas.'&amp;id='.$id.'&amp;go=forum">Далее</a></small>';}



break;

case 
'addtem':
$id htmlspecialchars(stripslashes(addslashes($id)));

if(
$udata[36]=="on"){echo"<small>У вас бан чата и форума!</small></p></card></wml>"; exit;}

echo 
"<small>Название темы:</small><br/>";
echo 
"<input name="name$rand" maxlength="100" title="name"/><br/>";
echo 
"<small>Сообщение:</small><br/>";
echo 
"<input name="msg$rand" maxlength="300" title="msg"/><br/>";
echo 
"<small><anchor title="go">OK<go href="forum.php?log=$log&amp;pas=$pas&amp;go=savetem&amp;id=$id" method="post">";
echo 
"<postfield name="name" value="$(name$rand)"/>";
echo 
"<postfield name="msg" value="$(msg$rand)"/>";
echo 
"</go></anchor></small><br/>";

break;

case 
'savetem':



if(empty(
$name)){echo"<small>Вы не ввели название темы!</small>"; include_once"files/down.php"; exit;}
if(empty(
$msg)){echo"<small>Вы не ввели сообщение!</small>"; include_once"files/down.php"; exit;}

if (
$name=="" || strlen($name) > 100 || strlen($name) < 5) { echo"<small>Тема длинная или короткая!</small>"; include_once"files/down.php"; exit;}

if (
$msg=="" || strlen($msg) > 300 || strlen($msg) < 5) { echo"<small>Сообщение длинное или короткое!</small>"; include_once"files/down.php"; exit;}


$id htmlspecialchars(stripslashes(addslashes($id)));

$text = @file("data/forum/$id/name.dat");
$udata explode("||",$text[0]);
$forum=trim($udata[0]);
$tem=trim($udata[1]);
$msgg=trim($udata[2]);

$date=date("d.m.y");
$time=date("H:i");
$sort=time();

$msg htmlspecialchars(stripslashes(addslashes($msg)));

$fp=fopen("data/forum/$id/$tem.dat","w");
flock($fp,LOCK_EX);
fputs($fp,"$name||rn$log||$msg||[$time/$date]||$sort||rn");
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);
chmod ("data/forum/$id/$tem.dat"0666);

$tem=$tem+1;
$msgg=$msgg+1;

$fp=fopen("data/forum/$id/name.dat","w");
flock($fp,LOCK_EX);
fputs($fp,"$forum||$tem||$msgg||rn");
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);
chmod ("data/forum/$id/name.dat"0666);

echo
"<small>Тема успешно создана.</small><br/>";
echo
"<small><a href="forum.php?log=$log&amp;pas=$pas&amp;go=forum&amp;id=$id">Продолжить</a></small>";

break;

case 
'tema':

$id htmlspecialchars(stripslashes(addslashes($id)));
$tema htmlspecialchars(stripslashes(addslashes($tema)));

if(!@
file("data/forum/$id/$tema.dat")){echo"<small>Такой темы не существует!</small>"; include_once"files/down.php";exit;}

$text file("data/forum/$id/$tema.dat");
$count=count($text);


if (empty(
$_GET['start'])) $start 1;
else 
$start $_GET['start'];
if (
$count $start 10){ $end $count; }
else {
$end $start 10; }

for(
$i=$start$i<$end$i++){

$text file("data/forum/$id/$tema.dat");
$udata explode("||",$text[$i]);

$udata[1]=eregi_replace("((https?|ftp|http)://[[:alnum:]_=/-]+(\.[[:alnum:]_=/-]+)*(/[[:alnum:]+&._=/%]*(\?[[:alnum:]?+&_=/%]*)?)?).(ru|org|net|info|com)""Реклама запрещена"$udata[1]);
$udata[1]=eregi_replace("([[:alnum:]_=/-]+(\.[[:alnum:]_=/-]+)*(/[[:alnum:]+&._=/%]*(\?[[:alnum:]?+&_=/%]*)?)?).(ru|org|net|info|com)""Реклама запрещена"$udata[1]);


echo
"<small><b><a href="search.php?log=$log&amp;pas=$pas&amp;nick=$udata[0]">$udata[0]</a></b> $udata[2]<br/>$udata[1]</small><br/>";

}
if (
$start != 1) {echo '<small><a href="forum.php?start='.($start 10).'&amp;log='.$log.'&amp;pas='.$pas.'&amp;id='.$id.'&amp;tema='.$tema.'&amp;go=tema">Назад</a></small> ';}else{echo'<small>= = = =</small><br/>';}

if (
$count $start 10) {echo ' <small><a href="forum.php?start='.($start 10).'&amp;log='.$log.'&amp;pas='.$pas.'&amp;id='.$id.'&amp;tema='.$tema.'&amp;go=tema">Далее</a></small>';}

echo
"<br/><small><a href="forum.php?log=$log&amp;pas=$pas&amp;go=msg&amp;id=$id&amp;tema=$tema">Ответить</a></small>";



break;

case 
'msg':

$id htmlspecialchars(stripslashes(addslashes($id)));
$tema htmlspecialchars(stripslashes(addslashes($tema)));

if(!@
file("data/forum/$id/$tema.dat")){echo"<small>Такой темы не существует!</small>";include_once"files/down.php";exit;}

echo 
"<small>Сообщение:</small><br/>";
echo 
"<input name="msg" maxlength="300" title="msg"/><br/>";
echo 
"<small><anchor title="go">OK<go href="forum.php?log=$log&amp;pas=$pas&amp;go=addmsg&amp;id=$id&amp;tema=$tema" method="post">";
echo 
"<postfield name="msg" value="$(msg)"/>";
echo 
"</go></anchor></small><br/>";

break;

case 
'addmsg':

$id htmlspecialchars(stripslashes(addslashes($id)));
$tema htmlspecialchars(stripslashes(addslashes($tema)));

if(!@
file("data/forum/$id/$tema.dat")){echo"<small>Такой темы не существует!</small>";include_once"files/down.php";exit;}

$msg htmlspecialchars(stripslashes(addslashes($msg)));
if (
$msg=="" || strlen($msg) > 300 || strlen($msg) < 5) { echo"<small>Сообщение длинное или короткое!</small>"; include_once"files/down.php"; exit;}

$date=date("d.m.y");
$time=date("H:i");
$sort=time();

$msg=str_replace("|","",$msg);

$fp=fopen("data/forum/$id/$tema.dat","a+");
flock($fp,LOCK_EX);
fputs($fp,"$log||$msg||[$time/$date]||$sort||rn");
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);


$text = @file("data/forum/$id/name.dat");
$udata explode("||",$text[0]);
$forum=trim($udata[0]);
$tem=trim($udata[1]);
$msgg=trim($udata[2]);

$msgg=$msgg+1;

$fp=fopen("data/forum/$id/name.dat","w");
flock($fp,LOCK_EX);
fputs($fp,"$forum||$tem||$msgg||rn");
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);
chmod ("data/forum/$id/name.dat"0666);

echo
"<small>Сообщение добавлено.</small><br/>";
echo
"<small><a href="forum.php?log=$log&amp;pas=$pas&amp;go=forum&amp;id=$id">Продолжить</a></small>";

break;

case 
'deltem':

$u explode(".",$login);

if(
$log=="$u[0].GM"){



$flag=stripslashes($flag);
$flag=htmlspecialchars($flag);
$flag=str_replace("\","",$flag);
$flag=str_replace("/","",$flag);
$flag=str_replace("|","",$flag);
$flag=str_replace("$","",$flag);
$flag=str_replace("&","",$flag);
$flag=str_replace("<","",$flag);
$flag=str_replace(">","",$flag);
$flag = @unlink ("data/forum/$id/$num.dat");


//////////////////////////////////

if(
$flag)
{
echo"
<small>Тема успешно удалена.</small>";
}else{ print"
<small>Ошибка при удалении темы.</small>"; }

$text = @file("data/forum/$id/name.dat");
$udata = explode("||",$text[0]);
$forum=trim($udata[0]);
$tem=trim($udata[1]);
$msgg=trim($udata[2]);

$msgg=$msgg-1;
$tem=$tem-1;

$fp=fopen("data/forum/$id/name.dat","w");
flock(
$fp,LOCK_EX);
fputs(
$fp,"$forum||$tem||$msgg||rn");
fflush(
$fp);
flock(
$fp,LOCK_UN);
fclose(
$fp);
chmod ("
data/forum/$id/name.dat", 0666);
}else{echo"
Доступ запрещен!";}


break;



}

echo"
<small><br/><br/><a href="forum.php?log=$log&amp;pas=$pas">Форум</a></small><br/>";

echo"
<small><a href="item.php?log=$log&amp;pas=$pas">Инвентарь</a></small><br/>";
echo"
<small><a href="gorod.php?log=$log&amp;pas=$pas&amp;gorod=$udataa[20]">В город</a></small>";
if(!empty(
$udata[23])){echo"<small><br/><a href="clanroom.php?log=$log&amp;pas=$pas">Комната клана</a></small>";}
echo"
<small><br/><a href="main.php?log=$log&amp;pas=$pas">Моё меню</a></small>";

}else{echo"
<small>Пароль или логин неверен!</small>";}



echo "
</p></card></wml>";
?>
Онлайн: 2
Реклама