<?
include 'mysql.php';
error_reporting(0);
include_once("include/zag.php");
include_once("include/ini.php");
include_once("include/sesi.php");
if (isset($user)) {
echo"Окрестности: <u>$udata[37]</u><br/>";


$dir = opendir ("MySql/base123/mob");
while ($file = readdir ($dir))
{if (( $file != ".") && ($file != ".."))
{$a[]=$file;}}
closedir ($dir);
$total = count($a);

for ($i = 0; $i < $total; $i++){
$tex = @file("MySql/base123/mob/$a[$i]");
$data = explode("||",$tex[0]);

$a[$i]=str_replace(".dat","",$a[$i]);

if($data[4]==$udata[37]){

$data_0[]=$data[0];
$data_1[]=$data[1];
$data_2[]=$data[2];
$data_id[]=$a[$i];
}}

foreach($data_0 as $k=>$v)
{
{
$text="1:||:";

$fp=fopen("MySql/base123/respaun/bishop.dat","w");
flock($fp,LOCK_EX);
ftruncate($fp,0);
fputs($fp,"$text");
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);

$text="1:||:";

$fp=fopen("MySql/base123/respaun2/bishop.dat","w");
flock($fp,LOCK_EX);
ftruncate($fp,0);
fputs($fp,"$text");
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);

$zahvat = @file("MySql/base123/respaun2/$data_id[$k].dat");
$zadat = explode(":||:",$zahvat[0]);
$dzzz=$zadat[1];
$ffd = $udata[20];
$zahvat = @file("MySql/base123/respaun2/$data_id[$k]");
$zadat = explode(":||:",$zahvat[0]);
$dzzz=$zadat[1];
$dzzs=$zadat[0];
$fr=array_merge(glob("MySql/base123/respaun2/*.dat"));
foreach ($fr as $file)
{if((time()- filectime($file)) > 180)unlink ($file);}
$fr=array_merge(glob("MySql/base123/respaun/*.dat"));
foreach ($fr as $file)
{if((time()- filectime($file)) > 180)unlink ($file);}

if ($zahvat!==false){
$dat_screen[]="[<a href=\"infomob.php?$sd&id=$data_id[$k]\">i</a>] <a href=\"go.php?$sd&id=$data_id[$k]\">$data_0[$k]</a> [$data_1[$k] lvl / $data_2[$k] HP]<br/>";
}}
if (!@file("MySql/base123/respaun2/$data_id[$k].dat")){
$dat_screen[]="[<a href=\"infomob.php?$sd&id=$data_id[$k]\">i</a>] <a href=\"go.php?$sd&id=$data_id[$k]\">$data_0[$k]</a> [$data_1[$k] lvl / $data_2[$k] HP]<br/>";
}
}
$total = count($dat_screen);

if (empty($_GET['vp'])) $vp = 0;
else $vp = $_GET['vp'];
if ($total < $vp + 8){ $end = $total; }
else {$end = $vp + 8; }
for ($i = $vp; $i < $end; $i++){

echo"$dat_screen[$i]";

}
if ($vp !== 0) {echo '<a href="okrestnosti.php?vp='.($vp - 5).'&'.$sd.'">Пройти назад</a>&#8194;<br /> ';}
if ($total > $vp + 8) {echo ' <a href="okrestnosti.php?vp='.($vp + 5).'&'.$sd.'">Пройти дальше</a>&#8194;<br />';}
echo"<small>- - -<br/><a href=\"fish.php?$sd\">Озеро</a><br/>- - -</small><br/>";

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

include_once"include/downok.php";
?>




