<?
include_once("mysql.php");
include_once("include/antixak.php");
include_once("include/zag.php");
include_once("include/ini.php");
include_once("include/sesi.php");
if (isset($user)) {

switch($go) {

default:
echo"<b>Скилы</b><br/>";

if(@file("MySql/base123/mag/$log.dat")){
$file = @file("MySql/base123/mag/$log.dat");
$total = count($file);

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

$file = @file("MySql/base123/mag/$log.dat");
$file = array_reverse($file);
$data = explode("||",$file[$i]);
$i2=round($i+1);

$id=$total-$i-1;

$data[8]=trim($data[8]);

echo"$data[8] (<a href=\"deletemag.php?$sd&id=$id&go=del&name=$data[8]\">del</a>)<br/>";

}

if($total=="0"){echo"Магии нет";}
}else{echo"Магии нет";}
if ($start != 0) {echo '<a href="deletemag.php?start='.($start - 5).'&'.$sd.'&go=list">Назад</a> ';}

if ($total > $start + 5) {echo ' <a href="deletemag.php?start='.($start + 5).'&'.$sd.'&go=list">Далее</a>';}
echo"*Удалённые скилы не востановляютса";
break;

case 'del':
$text = @file("MySql/base123/mag/$log.dat");
$count=count($text);

for($i=0; $i<$count; $i++){
$data = explode("||",$text[$i]);
if($name==$data[8]){
$file=file("MySql/base123/mag/$log.dat");
$fp=fopen("MySql/base123/mag/$log.dat","w");
flock ($fp,LOCK_EX);
unset($file[$id]);
fputs($fp, implode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);
echo "Магия удалена";
include 'include/down.php';
exit;}}
echo"Магии нет";
break;
}}else{echo"<small>Пароль или логин неверен!</small>";}
include 'include/down.php';
?>



