Просмотр файла darkworld/sell.php

Размер файла: 5.57Kb
<?
Error_Reporting(E_ALL & ~E_NOTICE);
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\">";
$id=$_GET['id'];
$vesh=$_GET['vesh'];
$num=$_GET['num'];
$tip=$_GET['tip'];
$tip = htmlspecialchars(stripslashes($tip));
$num = htmlspecialchars(stripslashes($num));
$vesh = htmlspecialchars(stripslashes($vesh));
$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)!=="") {

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



if($uda[10]==$vesh){ echo"&#x421;&#x43D;&#x430;&#x447;&#x430;&#x43B;&#x43E; &#x441;&#x43D;&#x438;&#x43C;&#x438;&#x442;&#x435; &#x432;&#x435;&#x449;&#x44C;, &#x43F;&#x43E;&#x442;&#x43E;&#x43C; &#x43F;&#x440;&#x43E;&#x434;&#x430;&#x432;&#x430;&#x439;&#x442;&#x435;."; echo "</p></card></wml>";  exit;}
if($uda[11]==$vesh){ echo"&#x421;&#x43D;&#x430;&#x447;&#x430;&#x43B;&#x43E; &#x441;&#x43D;&#x438;&#x43C;&#x438;&#x442;&#x435; &#x432;&#x435;&#x449;&#x44C;, &#x43F;&#x43E;&#x442;&#x43E;&#x43C; &#x43F;&#x440;&#x43E;&#x434;&#x430;&#x432;&#x430;&#x439;&#x442;&#x435;."; echo "</p></card></wml>";  exit;}
if($uda[12]==$vesh){ echo"&#x421;&#x43D;&#x430;&#x447;&#x430;&#x43B;&#x43E; &#x441;&#x43D;&#x438;&#x43C;&#x438;&#x442;&#x435; &#x432;&#x435;&#x449;&#x44C;, &#x43F;&#x43E;&#x442;&#x43E;&#x43C; &#x43F;&#x440;&#x43E;&#x434;&#x430;&#x432;&#x430;&#x439;&#x442;&#x435;."; echo "</p></card></wml>";  exit;}
if($uda[13]==$vesh){ echo"&#x421;&#x43D;&#x430;&#x447;&#x430;&#x43B;&#x43E; &#x441;&#x43D;&#x438;&#x43C;&#x438;&#x442;&#x435; &#x432;&#x435;&#x449;&#x44C;, &#x43F;&#x43E;&#x442;&#x43E;&#x43C; &#x43F;&#x440;&#x43E;&#x434;&#x430;&#x432;&#x430;&#x439;&#x442;&#x435;."; echo "</p></card></wml>";  exit;}

$file = @file("data/item/$log.dat");
$total = count($file);  

$file = @file("data/item/$log.dat");
$file = array_reverse($file);
$data = explode(":||:",$file[$id]);




$cena=$data[1]/2;

if($vesh!==$data[4]){echo"&#x423; &#x432;&#x430;&#x441; &#x43D;&#x435;&#x442; &#x44D;&#x442;&#x43E;&#x439; &#x432;&#x435;&#x449;&#x438;!"; echo "</p></card></wml>";  exit; }


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

if($tip=="vesh"){

echo "<small>&#x421;&#x43A;&#x43B;&#x44C;&#x43A;&#x43E;?:</small><br/>";
echo "<input name=\"kol\" maxlength=\"10\" title=\"*N\" emptyok=\"true\"/><br/>";
echo "<small><anchor title=\"go\">&#x41F;&#x440;&#x43E;&#x434;&#x430;&#x442;&#x44C;<go href=\"sellvesh.php?log=$log&amp;pas=$pas&amp;id=$id&amp;vesh=$vesh&amp;num=$num\" method=\"post\">";
echo "<postfield name=\"kol\" value=\"$(kol)\"/>";
echo "</go></anchor></small>";

echo "</p></card></wml>"; 
exit;
}

if($tip=="vesh2"){

echo "<small>&#x421;&#x43A;&#x43B;&#x44C;&#x43A;&#x43E;?:</small><br/>";
echo "<input name=\"kol\" maxlength=\"10\" title=\"*N\" emptyok=\"true\"/><br/>";
echo "<small><anchor title=\"go\">&#x41F;&#x440;&#x43E;&#x434;&#x430;&#x442;&#x44C;<go href=\"sellvesh2.php?log=$log&amp;pas=$pas&amp;id=$id&amp;vesh=$vesh&amp;num=$num\" method=\"post\">";
echo "<postfield name=\"kol\" value=\"$(kol)\"/>";
echo "</go></anchor></small>";

echo "</p></card></wml>"; 
exit;
}


if($tip!=="vesh"){ 

$total2=$total-1;


if($id=="0"){$id=$total-1;}else{$id=$total-$id-1;}

$file=file("data/item/$log.dat"); 

$fp=fopen("data/item/$log.dat","w");
flock ($fp,LOCK_EX);
for ($i=0;$i< sizeof($file);$i++) { if ($i==$id) {unset($file[$i]);} }
fputs($fp, implode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);

$text2 = @file("data/reg/$log.dat"); 
$udat = explode(":||:",$text2[0]);
$aden=trim($udat[8]);



$aden=$aden+$cena;

$text=$udat[0].':||:'.$udat[1].':||:'.$udat[2].':||:'.$udat[3].':||:'.$udat[4].':||:'.$udat[5].':||:'.$udat[6].':||:'.$udat[7].':||:'.$aden.':||:'.$udat[9].':||:'.$udat[10].':||:'.$udat[11].':||:'.$udat[12].':||:'.$udat[13].':||:'.$udat[14].':||:'.$udat[15].':||:'.$udat[16].':||:'.$udat[17].':||:'.$udat[18].':||:'.$udat[19].':||:'.$udat[20].':||:'.$udat[21].':||:'.$udat[22].':||:'.$udat[23].':||:'.$udat[24].':||:'.$udat[25].':||:'.$udat[26].':||:'.$udat[27].':||:'.$udat[28].':||:'.$udat[29].':||:'.$udat[30].':||:'.$udat[31].':||:'.$udat[32].':||:'.$udat[33].':||:'.$udat[34].':||:'.$udat[35].':||:'.$udat[36].':||:'.$udat[37].':||:'.$udat[38].':||:'.$udat[39].':||:'.$udat[40].':||:';

$fp=fopen("data/reg/$log.dat","a+");
flock($fp,LOCK_EX);           
ftruncate($fp,0);                                                                 
fputs($fp,"$text\r\n");
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp); 
///////////////////////////////////////////////////////////////////////////////////////////////
echo"&#x41F;&#x440;&#x43E;&#x434;&#x430;&#x43D;&#x43E; &#x437;&#x430; $cena.";

}


}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>";}

echo "</p></card></wml>"; 
?>