View file darkworld/pk.php

File size: 3.14Kb
<?
Error_Reporting(E_ALL & ~E_NOTICE);

list($msec,$sec)=explode(chr(32),microtime()); 
$HeadTime=$sec+$msec; 
include_once("files/antixak.php");
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=\"&#x41F;&#x435;&#x440;&#x441;&#x43E;&#x43D;&#x430;&#x436;\">";
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)!=="") {

$nick = htmlspecialchars(stripslashes($nick));

//echo"<small>Извините, PK отключено на неопределенный срок.</small>"; include_once"files/down.php"; exit;

if($nick==$log){echo"<small>Вы не можете напасть на самого себя!</small>";include_once"files/down.php";exit;} 

if(!@file("data/reg/$nick.dat")){echo"<small>Такого игрока не существует!</small>";include_once"files/down.php";exit;} 

if(eregi(".GM",$uzer)){echo"<small>Ошибка.</small>"; include_once"files/down.php"; exit;}


$file=@file("data/reg/$nick.dat");
$dat=explode(":||:",$file[0]);

if($dat[9]<="5"){echo"<small>На слабых игроков нельзя нападать!</small>";
include_once"files/down.php";exit;
}

$file=@file("data/who.dat");
$count=count($file);

$time=time()-30;

for($i=0; $i<$count; $i++){
$data=explode("|",$file[$i]);

if($nick==$data[0] && $data[1]!=="/okrestnosti.php"){

echo"<small>Нападать можно только в окрестностях.</small>";

include_once"files/down.php";
exit;
}

if($nick==$data[0] && $data[2]<$time){

echo"<small>Этот игрок в offline.</small>";

include_once"files/down.php";
exit;
}

if($nick==$data[0] && $data[2]>=$time){


$text="$log||";

$fp=fopen("data/pk/$nick.dat","w");  
flock($fp,LOCK_EX);                                                     
fputs($fp,"$text");
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp); 
chmod ("data/pk/$nick.dat", 0666); 

$text2="$nick||";

$fp=fopen("data/pk/$log.dat","w");  
flock($fp,LOCK_EX);                                                     
fputs($fp,"$text2");
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp); 
chmod ("data/pk/$log.dat", 0666); 

echo"<small><a href=\"combatpk.php?log=$log&amp;pas=$pas&amp;gorod=$gorod\">&#x41F;&#x440;&#x43E;&#x434;&#x43E;&#x43B;&#x436;&#x438;&#x442;&#x44C;</a></small>";

}}

}else{echo"<small>&#x41F;&#x430;&#x440;&#x43E;&#x43B;&#x44C; &#x438;&#x43B;&#x438; &#x43B;&#x43E;&#x433;&#x438;&#x43D; &#x43D;&#x435;&#x432;&#x435;&#x440;&#x435;&#x43D;!</small>";}

include_once"files/down.php";
?>