Файл: register.php
Строк: 49
<?php
include_once('inc/top.php');
if(!isset($_GET['process'])) $_GET['process'] = '';
else
{
$lfu = mysql_query("
SELECT *
FROM user
WHERE login='".$_POST['login']."'");
$csel = mysql_query("
SELECT *
FROM config");
$co = mysql_fetch_assoc($csel);
$race = addslashes($_POST['race']);
if($race == 'human')
{
$loc = $co['hsl'];
$posx = $co['hsl_x'];
$posy = $co['hsl_y'];
}
elseif($race == 'orc')
{
$loc = $co['osl'];
$posx = $co['osl_x'];
$posy = $co['osl_y'];
}
elseif($race == 'elf')
{
$loc = $co['esl'];
$posx = $co['esl_x'];
$posy = $co['esl_y'];
}
else
{
$loc = 'buger';
$posx = '1';
$posy = '1';
}
if(empty($_POST['sex'])) $_POST['sex'] = 'man';
if(empty($_POST['login']) OR strlen($_POST['login']) < 3)
{
echo '<div class="error">'.LNG_LOGIN_SHORT.'</div>';
}
elseif(mysql_num_rows($lfu) !== 0)
{
echo '<div class="error">'.LNG_LOGIN_EXISTS.'</div>';
}
elseif(empty($_POST['password']) OR strlen($_POST['password']) < 6)
{
echo '<div class="error">'.LNG_PASSWORD_SHORT.'</div>';
}
elseif($_POST['password'] !== $_POST['passwordagain'])
{
echo '<div class="error">'.LNG_PASSWORD_NOT_MATCH.'</div>';
}
elseif(!filter_var($_POST['mail'], FILTER_VALIDATE_EMAIL))
{
echo '<div class="error">'.LNG_MAIL_WRONG.'</div>';
}
else
{
if($_POST['sex'] == 'man')
{
$avatar = 'm.png';
}
else
{
$avatar = 'w.png';
}
$mreg = mysql_query("
INSERT INTO `user`
(`login`, `phash`, `mail`, `sex`, `rdate`, `rtime`, `ip`, `pos`, `posx`, `posy`, `server`, `loc`, `avatar`, `race`)
VALUES(
'".addslashes($_POST['login'])."',
'".md5($_POST['password'])."',
'".addslashes($_POST['mail'])."',
'".addslashes($_POST['sex'])."',
'".date('d,m,Y')."',
'".date('H:i:s')."',
'".$_SERVER['REMOTE_ADDR']."',
'1',
'".$posx."',
'".$posy."',
'test',
'".$loc."',
'".$avatar."',
'".$race."')");
if(!$mreg)
{
echo '<div class="error">'.mysql_error().'</div>';
}
else
{
echo '<div class="ok">'.LNG_REGISTER_OK.'</div>';
}
}
}
?>
<form class="form" id="form" method="post" action="register.php?process">
<input type="text" name="login" placeholder="<?=LNG_LOGIN?>"><br>
<input type="password" name="password" placeholder="<?=LNG_PASSWORD?>"><br>
<input type="password" name="passwordagain" placeholder="<?=LNG_PASSWORD_AGAIN?>"><br>
<input type="text" name="mail" placeholder="<?=LNG_MAIL?>"><br>
<input type="radio" name="sex" value="man"><b><?=LNG_MAN?></b>
<input type="radio" name="sex" value="woman"><b><?=LNG_WOMAN?></b><br>
<select name="race">
<option value="human"><?=LNG_HUMAN?></option>
<option value="orc" disabled="yes"><?=LNG_ORC?></option>
<option value="elf" disabled="yes"><?=LNG_ELF?></option>
</select><br>
<input type="submit" class="submit" value="<?=LNG_REGISTER?>"><br>
</form>
<?=LNG_REG_DESC?><br>
<?php
include_once('inc/bottom.php');