View file ascalon/work.php

File size: 4.61Kb
<?php
$numb=11;
if(isset($_GET['ses'])){
$ses=htmlspecialchars(stripslashes($_GET['ses']));
$dbhost='localhost';
$dbname='db_l2gracia';
$dbusers='db_l2gracia';
$dbpass='FaGw6cgz';
$link=mysql_connect($dbhost,$dbusers,$dbpass) or die ('error connecting');
mysql_select_db($dbname,$link) or die('error selecting db');
$mt=mt_rand(100000,999999);
$onli=date("U")-600;
$col=mysql_query("SELECT * FROM users WHERE ses=\"$ses\" && online>\"$onli\"") or die('error');
$har=mysql_fetch_array($col);
if(isset($har['nick'])){
$access=(int)$har['access'];
$nick=$har['nick'];
$time=(int)$har['time'];
$online=(int)$har['online'];
$avatar=(int)$har['avatar'];
$nastr=(int)$har['nastr'];
$nastrt=(int)$har['nastrt'];
} else { header("Location:log.php?mt=$mt"); exit;}
} else { header("Location:log.php?mt=$mt"); exit;}
$bac=date("U");
$online=$bac;
$sq=mysql_query("SELECT * FROM ban WHERE nick=\"$nick\"")or die('error');
$ro=mysql_fetch_array($sq);
if(isset($ro['nick'])){
$p1=(int)$ro['char1'];
$p2=(int)$ro['char2'];
$p3=(int)$ro['char3'];
if($p3>=$bac){ $razn=$p3-$bac; $why=$ro['kom3']; echo"<p align=\"center\"><font color=\"red\">Ваш персораж забанен! Причина: $why! Время до окончания бана: $razn сек!</font></p>"; exit;}
if($p2<=0){ header("Location:index.php?ses=$ses&amp;mt=$mt"); exit;}
} else { header("Location:index.php?ses=$ses&amp;mt=$mt"); exit;}

echo'<html><head><title>Каторга</title>'; require"css.php"; echo'</head><body>';
if(isset($_GET['move'])) $move=htmlspecialchars(stripslashes($_GET['move'])); else $move='start';

if($move=='work'){
$razn=$bac-$time; $ost=30-$razn;
if($razn>30){
$rand=mt_rand(1,30);
$p2=$p2-$rand;
mysql_query("UPDATE ban SET char2=\"$p2\" WHERE nick=\"$nick\"")or die('error');
$echo="<div class=search>$nick добыл $rand урана!</div>"; $time=$bac;
} else $echo="<div class=death>$nick, таймаут действий $ost сек.</div>";
$echo="0:||:$echo\r\n"; $mon=@file("room11.dat");
$zis=sizeof($mon); $mon[$zis]=$echo; $o=@implode("",$mon);
$n=@fopen("room11.dat","w"); fputs($n,$o); fclose($n);
$move='start';
}

if($move=='say'){
echo"<div class=kto>Сказать</div><div class=text>
<form action=\"work.php?ses=$ses&amp;move=prov&amp;mt=$mt\" method=\"post\">
Сказать:<br>
<input type=\"text\" name=\"say\"><br>
<input type=\"submit\" value=\"ok\">
</form></div><br>* * * * *<br>
<div class=kto><a href=\"work.php?ses=$ses&amp;mt=$mt\">назад</a></div></body></html>";
exit;}

if($move=='prov'){
if(isset($_POST['say']) && $_POST['say']){
$say=htmlspecialchars(stripslashes($_POST['say']));
$say=substr($say,0,255);
$say=str_replace("\r\n", "", $say);
$say=str_replace(":||:","",$say);
$say=str_replace(":|||:","",$say);
$message=$say;
require"filtr.php";
require"filtrmat.php";
$say=$message;
$echo="$nick:||:$avatar:||:$say\r\n";
$ex=@file("room11.dat");
$liner=sizeof($ex);
$ex[$liner]=$echo;
$kex=@implode("",$ex);
$mex=@fopen("room11.dat","w");
fputs($mex,$kex);
fclose($mex);
}
$move='start';
}

if($move=='start'){
mysql_query("UPDATE users SET online=\"$online\", time=\"$time\" WHERE nick=\"$nick\"")or die('error');
echo'<div class=kto>Kтo здecь:<div class=on>';
$onl=date("U")-600;
$sq=mysql_query("SELECT * FROM ban")or die('error');
while($ro=mysql_fetch_array($sq)){ $res=$ro['char2']; $nickk=$ro['nick'];
$col2=mysql_query("SELECT * FROM users WHERE nick=\"$nickk\" && online>\"$onl\" && lok=\"$lok\" && thp>0") or die('error');
$row2=mysql_fetch_array($col2);
if(isset($ro['nick'])) echo"$nickk<font color=\"blue\">[$res]</font>, ";
}
echo'</div></div>';
$ran=mt_rand(10000,99999);
echo"<a href=\"work.php?ses=$ses&amp;move=work&amp;mt=$mt\">
<b>копать</b></a>";
echo"<br>* * * * *<br>
<a href=\"work.php?ses=$ses&amp;move=say&amp;mt=$mt\">cкaзaть</a>|<a href=\"work.php?ses=$ses&amp;ran=$ran\">oбнoвить</a>
<br>* * * * *<br><div class=text>";
$ghi=@file("room11.dat");
$sig=sizeof($ghi);
$sig=$sig-1;
if($sig>0){
if($sig<20) $gop=$sig; else $gop=19;
while($sig>=0){
$gh=$ghi[$sig];
$cheh[$gop]=$ghi[$sig];
if($gop==0) $sig=0;
$jef=@explode(":||:",$gh);
if($jef[0]!="0"){
if($nastrs==0){
if(isset($jef[2])) require"smile.php";}
echo'<div class=font>';
if($nastr==0) echo"<img src=\"avatars/$jef[1].png\" alt=\"pic\">";
echo"$jef[0]: $jef[2]</div>";
} else echo"$jef[1]";
$gop=$gop-1;
$sig=$sig-1;
}
ksort($cheh);
$skif=@implode("",$cheh);
$zu=@fopen("room11.dat","w");
fputs($zu,$skif);
fclose($zu);
}
echo"</div><br>* * * * *<br><div class=kto>
<a href=\"http://online.wen.ru\">выход</a>
</div></body></html>";
}
?>