<?
include 'mysql.php';
include_once("inclydings/sesi.php");
Error_Reporting(E_ALL & ~E_NOTICE);
include_once("inclydings/antixak.php");
$_title = 'Linewap2';
include 'inclydings/ini.php';
include 'inclydings/header.php';
$log = htmlspecialchars(stripslashes($log));
$pas = htmlspecialchars(stripslashes($pas));
/////////////////////////////////////////////////////
$text = @file("L2dbnam/esql2db/reg/$log.dat");
if ($text!=""){
$udata = explode(":||:",$text[0]);
$login=trim($udata[0]);
$password=trim($udata[1]);}
////////////////////////////////////////////////////////
if (isset($user)) {
if(!@file("L2dbnam/esql2db/sellrukcol/$log.dat")){echo"Ошибка"; include"inclydings/down.php"; exit;}
$file=@file("L2dbnam/esql2db/item/$log.dat");
$total=count($file);

$text = @file("L2dbnam/esql2db/sellrukcol/$log.dat");
$data = explode("||",$text[0]);

for($i=0; $i<$total; $i++){
$item = explode(":||:",$file[$i]);

if($item[4]==$data[4]){

$fp=fopen("L2dbnam/esql2db/item/$log.dat","w");
flock ($fp,LOCK_EX);
unset($file[$i]);
fputs($fp, implode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);

$all=$data[3]+$item[3];

$text="$data[0]:||:$data[1]:||:$data[2]:||:$all:||:$data[4]:||:";

$fp=fopen("L2dbnam/esql2db/item/$log.dat","a+");
flock($fp,LOCK_EX);
fputs($fp,"$text\r\n");
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);

unlink ("L2dbnam/esql2db/sellrukcol/$log.dat");
echo"Продажа отменена.";
echo" <br/><a href=\"town.php?$sd\">Продолжить</a>";
include_once"inclydings/down.php";

exit;

}else{

$text="$data[0]:||:$data[1]:||:$data[2]:||:$data[3]:||:$data[4]:||:";

$fp=fopen("L2dbnam/esql2db/item/$log.dat","a+");
flock($fp,LOCK_EX);
fputs($fp,"$text\r\n");
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);

unlink ("L2dbnam/esql2db/sellrukcol/$log.dat");

echo"Продажа отменена.";

include_once"inclydings/down.php";

exit;

}}



}else{echo"Пароль или ник неверен.Возможно сессия устарела.Попробуйте авторизироваться заново...";}

include_once"inclydings/down.php";
?>
