Файл: reg.php
Строк: 93
<?php
include('files/zag.php');
if(isset($_COOKIE['aut']) && $_COOKIE['aut'] == 1){
echo 'Эта страница заблокирована администрацией игры.';
}else{
switch($_GET['go']){
case 'go':
$_POST['input1'] = check::text($_POST['input1']);
$_POST['input2'] = check::text($_POST['input2']);
$_POST['input3'] = check::text($_POST['input3']);
$_POST['input4'] = check::text($_POST['input4']);
$_POST['input5'] = check::text($_POST['input5']);
if(file_exists('data/reg/'.$_POST['input1'].'.dat')) $err[] = 'такой логин уже существут, придумайте другой.';
if(empty($_POST['input1'])) $err[] = 'поле логин осталось пустым.';
if(empty($_POST['input2'])) $err[] = 'поле пароль осталось пустым.';
if(empty($_POST['input3'])) $err[] = 'поле выбора рассы осталось пустым.';
if(empty($_POST['input4'])) $err[] = 'поле выбора класса осталось пустым.';
if(empty($_POST['input5'])) $err[] = 'поле выбора пола осталось пустым.';
if($err){
echo 'В регистрации обнаружены ошибки:<br>';
foreach($err as $err_info){
echo '<font color="red">*</font>'.$err_info.'<br>';
}
}else{
if($_POST['input3'] == 1) $race = 'human';
elseif($_POST['input3'] == 2) $race = 'dwarf';
elseif($_POST['input3'] == 3) $race = 'elf';
elseif($_POST['input3'] == 4) $race = 'delf';
elseif($_POST['input3'] == 5) $race = 'ork';
if($_POST['input4'] == 1) $class = 'wizard'; else $class = 'fighert';
if($race
== 'orc') $gorod = 'Orc Village';
elseif($race
== 'elf') $gorod = 'Elven Village';
elseif($race
== 'delf') $gorod = 'Dark Elven Village';
elseif($race
== 'human') $gorod = 'Talking Island Village';
elseif($race
== 'dwarf') $gorod = 'Dwarven Village';
$text = ''.$_POST['input1'].':||:'.$_POST['input2'].':||:'.$_POST['input5'].':||:3:||:4:||:5:||:0:||:0:||:0:||:1:||:0:||::||:12:||:13:||:14:||:15:||:50:||:50:||::||:1:||:'.$gorod.':||:21:||:0:||::||:24:||::||:'.$race.':||:'.$class.':||:'.time().':||:50:||:50:||:1:||:32:||::||:34:||:35:||:0:||:37:||:38:||:39:||:40:||:'.(time()-360).':||:'.$gorod.':||:20:||:20:||:20:||:20:||:0:||::||:0:||::||::||::||::||::||::||::||::||::||::||::||::||::||::||:0:||:0:||:';
$fp = fopen('data/reg/'.$_POST['input1'].'.dat', 'w');
flock($fp,LOCK_EX);
fputs($fp, $text);
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);
echo '
<center>
<font color="#66cc66">Спасибо за регистрацию!</font><br><br>
<form action="enter.php" method="post">
<input name="log" type="hidden" value="'.$_POST['input1'].'"/>
<input name="pas" type="hidden" value="'.$_POST['input2'].'"/>
<input type="submit" value="В игру" style="background:none; color:#af9878; border:0;"/>
</form>
</center>
';
}
break;
default:
echo '
<form action="/reg.php?go=go" method="post">
Логин <br> <input name="input1" style="width:96%;"><br>
Пароль <br> <input name="input2" style="width:96%;"><br>
Расса <br>
<select name="input3" style="width:99%;">
<option value="1">Человек</option>
<option value="2">Гном</option>
<option value="3">Светлый эльф</option>
<option value="4">Тёмный эльф</option>
<option value="5">Орк</option>
</select><br>
Класс <br>
<select name="input4" style="width:99%;">
<option value="1">Маг</option>
<option value="2">Воин</option>
</select> <br>
Пол <br>
<select name="input5" style="width:99%;">
<option value="1">Мужской</option>
<option value="2">Женский</option>
</select> <br> <br>
Регистрируясь, вы принимаете <a href="/rules.php">правила</a> игры.<br><br>
<input type="submit" name="submit" value="Регистрация"/>
</form>
';
break;
}
}
include('files/down.php');
?>