Файл: skill.php
Строк: 34
<?php
include_once("files/zag.php");
include_once("files/ini.php");
$polz=mysql_query("SELECT * FROM `users` WHERE `udata0`='$log' AND `udata1`='$pas' LIMIT 1");
if(mysql_num_rows($polz)==0){
header ("Location: index.php?error");
echo'<div class="p">Ошибка! Пользователь с таким логином и паролем не зарегистрирован, или пароль/логин неверен! <a href="index.php">На главную</a><br>';exit;
}else{
$name = htmlspecialchars(stripslashes(addslashes($name)));
$file=@file("data/mag/$log.dat");
$total=count($file);
for($i=0; $i<$total; $i++){
$data=explode("||",$file[$i]);
if(trim($data8)==$name){
echo"<small>Эта магия у вас уже изучена.</small>";
include_once"files/down.php";
exit;}}
$text = @file("data/mags/$name.dat");
$text = array_reverse($text);
$mag = explode("||",$text[0]);
if($mag[5]!=$udata33){echo"Ошибка.</small>"; include_once"files/down.php"; exit;}
if($udata9<$mag[8]){echo"Ошибка.</small>"; include_once"files/down.php"; exit;}
if($udata31<$mag[2]){echo"<small>У вас не хватает SP.</small>"; include_once"files/down.php"; exit;}
$udat[31]=$udata31-$mag[2];
mysql_query("UPDATE `users` SET `udata31`='$udat[31]' WHERE `udata0`='$log'");
if($mag[4]=="summoner"){
$text="$mag[0]||";
$fp=fopen("data/summoner/$log.dat","a+");
flock($fp,LOCK_EX);
ftruncate($fp,0);
fputs($fp,"$text");
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);
}
mysql_query("INSERT INTO `mag` VALUES ('', '$mag[0]', '$mag[1]', '$mag[2]' , '$mag[3]' , '$mag[4]' , '' , '$mag[5]' , '$mag[6]', '$mag[7]', '$mag[8]', '$log' )") or die(mysql_error());
echo"<small>Вы выучли $mag[7]</small>";
}
include_once"files/down.php";
?>