<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>Регистрация</title>
<link rel="stylesheet" type="text/css" href="/reg.css" />
<script type="text/javascript" src="/JS/reg.js"></script>
<script type="text/javascript" src="/JS/ajax.js"></script>
</head>
<body>
<? if (empty($_REQUEST["regstep"]) || !isset($_REQUEST["regstep"])): ?>
<form action="/reg.php" method="post" onsubmit="return check_form(1);">
<table width="500" border="1" cellpadding="3" cellspacing="0">
<tr><td colspan="2" align="center">Регистрация: шаг 1 из 3</td></tr>
<tr><td width="180">Логин:</td><td><input type="text" id="login" name="login" onblur="check_login();" /></td></tr>
<tr><td>Пароль:</td><td><input type="password" id="pass1" name="pass1"  /></td></tr>
<tr><td>Повторите пароль:</td><td><input type="password" id="pass2" name="pass2" /></td></tr>
<tr><td>E-mail:</td><td><input type="text" id="email" name="email" /></td></tr>
<tr><td>Имя:</td><td><input type="text" id="name" name="name" /></td></tr>
<tr><td>Пол:</td><td><input type="radio" name="pol" id="pol1" value="male" class="radio" /><label for="pol1">Мужской</label><input type="radio" name="pol" id="pol2" value="female" class="radio" style="margin-left:50px;" /><label for="pol2">Женский</label></td></tr>
<tr><td>Дата рождения:</td><td>
<select name="b_day" id="b_day"><option value="0" selected="selected"></option>
<? for ($a=1,$b=31;$a<=$b;$a++):
echo '<option value="'.$a.'">'.$a.'</option>';
endfor; ?>
</select>&nbsp;
<select name="b_mon" id="b_mon">
<option value="0" selected="selected"></option>
<option value="1">января</option>
<option value="2">февраля</option>
<option value="3">марта</option>
<option value="4">апреля</option>
<option value="5">мая</option>
<option value="6">июня</option>
<option value="7">июля</option>
<option value="8">августа</option>
<option value="9">сентября</option>
<option value="10">октября</option>
<option value="11">ноября</option>
<option value="12">декабря</option>
</select>&nbsp;
<select name="b_yea" id="b_yea">
<option value="0" selected="selected"></option>
<? for ($a=1960,$b=2003;$a<=$b;$a++):
echo '<option value="'.$a.'">'.$a.'</option>';
endfor; ?>
</select>
</td></tr>
<tr><td>Страна:</td><td><input type="text" id="country" name="country" /></td></tr>
<tr><td>Город:</td><td><input type="text" id="city" name="city" /></td></tr>
<tr><td colspan="2" align="center"><input type="hidden" name="regstep" value="2" /><input type="submit"  value="Далее" style="width:40%"/></td></tr>
</table>
</form>
<? elseif ($_REQUEST["regstep"]==2): ?>
<form action="/reg.php" method="post">
<table width="550" border="1" cellpadding="3" cellspacing="0">
<tr><td align="center">Регистрация: шаг 2 из 3</td></tr>
<tr><td>Выберите расу:<br />
<img src="/images/race/<?=$_REQUEST["pol"]?>_man_warrior.jpg" onclick="select_race(this);" class="in" name="race" id="man_war" vspace="2" hspace="2" alt="Человек-воин" title="Человек-воин" />
<img src="/images/race/<?=$_REQUEST["pol"]?>_man_warrior.jpg" onclick="select_race(this);" class="in" name="race" id="man_mag" vspace="2" hspace="2" alt="Человек-маг" title="Человек-маг" />
<img src="/images/race/<?=$_REQUEST["pol"]?>_elf_warrior.jpg" onclick="select_race(this);" class="in" name="race" id="elf_war" vspace="2" hspace="2" alt="Эльф-воин" title="Эльф-воин" />
<img src="/images/race/<?=$_REQUEST["pol"]?>_elf_warrior.jpg" onclick="select_race(this);" class="in" name="race" id="elf_mag" vspace="2" hspace="2" alt="Эльф-маг" title="Эльф-маг" />
<img src="/images/race/<?=$_REQUEST["pol"]?>_dwarf_warrior.jpg" onclick="select_race(this);" class="in" name="race" id="dwa_war" vspace="2" hspace="2" alt="Гном" title="Гном" />
</td></tr>
<tr><td id="race_desc" style="font-size:11px; text-align:justify;"></td></tr>
<tr><td colspan="2" align="center"><input type="hidden" name="regstep" value="3" /><input type="hidden" name="sel_race" id="sel_race" /><input type="hidden" name="f_step" value='<?=serialize($_REQUEST)?>' /><input type="submit"  value="Далее" style="width:40%"/></td></tr>
</table>
</form>
<? elseif ($_REQUEST["regstep"]==3): ?>
<form action="/reg.php" method="post">
<table width="550" border="1" cellpadding="3" cellspacing="0">
<tr><td align="center">Регистрация: шаг 3 из 3</td></tr>
<tr><td>Выберите родной город:<br />
<img src="/images/race/male_man_warrior.jpg" onclick="select_city(this);" class="in" name="city" id="idrios" vspace="2" hspace="2" alt="Человек-воин" title="Человек-воин" />
</td></tr>
<tr><td id="city_desc" style="font-size:11px; text-align:justify;"></td></tr>
<tr><td colspan="2" align="center"><input type="hidden" name="regstep" value="4" /><input type="hidden" name="sel_city" id="sel_city" /><input type="hidden" name="s_step" value='<?=serialize($_REQUEST)?>' /><input type="submit"  value="Далее" style="width:40%"/></td></tr>
</table>
</form>
<? elseif ($_REQUEST["regstep"]==4): ?>
<table width="550" border="1" cellpadding="3" cellspacing="0">
<tr><td align="center">Регистрация завершена</td></tr>
<tr><td>
<?
$s_step = unserialize(stripslashes($_REQUEST["s_step"]));
$f_step = unserialize(stripslashes($s_step["f_step"])); 
if (is_array($_REQUEST) && is_array($s_step) && is_array($f_step)): 
	require ($_SERVER['DOCUMENT_ROOT'].'/maintenance/dbconn.php');
	mysql_query ("INSERT INTO `users` (`uid`, `user`, `pass`, `email`, `race`, `gcity`, `name`, `sex`, `bday`, `country`, `city`) VALUES ('', '".$f_step["login"]."', '".md5($f_step["pass1"])."', '".$f_step["email"]."', '".$s_step["sel_race"]."', '".$_REQUEST["sel_city"]."', '".$f_step["name"]."', '".$f_step["pol"]."', '".$f_step["b_day"].":".$f_step["b_mon"].":".$f_step["b_yea"]."', '".$f_step["country"]."', '".$f_step["city"]."')");
	$res = 'Спасибо за регистрацию!';
else:
	$res = 'В процессе регистрации произошла ошибка. Попробуйте еще раз.';
endif; ?>
<?=$res?>
</td></tr>
<tr><td colspan="2" align="center"><input type="button"  value="Закрыть" style="width:40%"/></td></tr>
</table>

<? endif; ?>
</body>
</html>