<?php
require_once'../core/system.php';
require_once'../pumpitapi/pumpit-class.php';
require_once'../fs/resources/fotostrana.sdk.php';
echo reg();
$header = 'Первый шаг';
switch($act) {
default:
require_once '../core/head.php';
if($_SESSION['fs_id'] > 0 and $_SESSION['p_sid']==0 and $_SESSION['ok_id']==0 and $_SESSION['m_id']==0){
$inv = mysql_fetch_array(mysql_query("SELECT * FROM `user` where `id` = '".abs(intval($_GET['ref']))."'"));
$req = mysql_query("SELECT * FROM `user` WHERE `fs_id`=".$_SESSION['fs_id']."");
$nick = mysql_fetch_array($req);
$avto = mysql_num_rows($req);
if($avto==0){
echo'<table width="100%" border="0" cellpadding="0" cellspacing="0" style="color:#E5CBB7;font-size:11px;">
<tbody>
<tr>
<div class="mli">
<div class="empty2"></div>
<center>
Выбери, кем ты будешь в этом жестоком мире - храбрым и сильным воином или хрупкой, но прекрасной воительницей
</center>
<div class="empty2"></div>
</div>
<hr>
<td align="center" width="45%">
<div class="dli">
<div class="foot">
<a href="/start/step-1?act=m'.(!empty($inv['id'])?'&ref='.$inv['id']:null).'"><img src="/images/start/step-1-m.png"></a>
</td>
</div>
<td align="center" width="45%">
<div class="dli">
<div class="foot">
<a href="/start/step-1?act=w'.(!empty($inv['id'])?'&inv='.$inv['id']:null).'"><img src="/images/start/step-1-w.png"></a>
</div>
</td>
</tbody>
</table>
</div>';
} else {
setcookie('nick', $nick['nick'], time() + 84600 * 30, '/');
setcookie('pass', $nick['pass'], time() + 84600 * 30, '/');
header('Location: /');
exit();
}
}
if($_SESSION['p_sid'] > 0 and $_SESSION['fs_id']==0 and $_SESSION['ok_id']==0 and $_SESSION['m_id']==0){
$inv = mysql_fetch_array(mysql_query("SELECT * FROM `user` where `id` = '".abs(intval($_GET['ref']))."'"));
$req = mysql_query("SELECT * FROM `user` WHERE `pumpit`=".$_SESSION['pumpit_id']."");
$nick = mysql_fetch_array($req);
$avto = mysql_num_rows($req);
if($avto==0){
echo'<table width="100%" border="0" cellpadding="0" cellspacing="0" style="color:#E5CBB7;font-size:11px;">
<tbody>
<tr>
<div class="mli">
<div class="empty2"></div>
<center>
Выбери, кем ты будешь в этом жестоком мире - храбрым и сильным воином или хрупкой, но прекрасной воительницей
</center>
<div class="empty2"></div>
</div>
<hr>
<td align="center" width="45%">
<div class="dli">
<div class="foot">
<a href="/start/step-1?act=m'.(!empty($inv['id'])?'&ref='.$inv['id']:null).'"><img src="/images/start/step-1-m.png"></a>
</td>
</div>
<td align="center" width="45%">
<div class="dli">
<div class="foot">
<a href="/start/step-1?act=w'.(!empty($inv['id'])?'&inv='.$inv['id']:null).'"><img src="/images/start/step-1-w.png"></a>
</div>
</td>
</tbody>
</table>
</div>';
} else {
setcookie('nick', $nick['nick'], time() + 84600 * 30, '/');
setcookie('pass', $nick['pass'], time() + 84600 * 30, '/');
header('Location: /');
exit();
}
}
if($_SESSION['p_sid'] == 0 and $_SESSION['fs_id']==0 and $_SESSION['ok_id'] > 0 and $_SESSION['m_id'] == 0){
$inv = mysql_fetch_array(mysql_query("SELECT * FROM `user` where `id` = '".abs(intval($_GET['ref']))."'"));
$req = mysql_query("SELECT * FROM `user` WHERE `ok`=".$_SESSION['ok_id']."");
$nick = mysql_fetch_array($req);
$avto = mysql_num_rows($req);
if($avto==0){
echo'<table width="100%" border="0" cellpadding="0" cellspacing="0" style="color:#E5CBB7;font-size:11px;">
<tbody>
<tr>
<div class="mli">
<div class="empty2"></div>
<center>
Выбери, кем ты будешь в этом жестоком мире - храбрым и сильным воином или хрупкой, но прекрасной воительницей
</center>
<div class="empty2"></div>
</div>
<hr>
<td align="center" width="45%">
<div class="dli">
<div class="foot">
<a href="/start/step-1?act=m'.(!empty($inv['id'])?'&ref='.$inv['id']:null).'"><img src="/images/start/step-1-m.png"></a>
</td>
</div>
<td align="center" width="45%">
<div class="dli">
<div class="foot">
<a href="/start/step-1?act=w'.(!empty($inv['id'])?'&inv='.$inv['id']:null).'"><img src="/images/start/step-1-w.png"></a>
</div>
</td>
</tbody>
</table>
</div>';
} else {
setcookie('nick', $nick['nick'], time() + 84600 * 30, '/');
setcookie('pass', $nick['pass'], time() + 84600 * 30, '/');
header('Location: /');
exit();
}
}
if($_SESSION['p_sid'] == 0 and $_SESSION['fs_id']==0 and $_SESSION['ok_id'] == 0 and $_SESSION['m_id'] > 0){
$inv = mysql_fetch_array(mysql_query("SELECT * FROM `user` where `id` = '".abs(intval($_GET['ref']))."'"));
$req = mysql_query("SELECT * FROM `user` WHERE `mail`=".$_SESSION['m_id']."");
$nick = mysql_fetch_array($req);
$avto = mysql_num_rows($req);
if($avto==0){
echo'<table width="100%" border="0" cellpadding="0" cellspacing="0" style="color:#E5CBB7;font-size:11px;">
<tbody>
<tr>
<div class="mli">
<div class="empty2"></div>
<center>
Выбери, кем ты будешь в этом жестоком мире - храбрым и сильным воином или хрупкой, но прекрасной воительницей
</center>
<div class="empty2"></div>
</div>
<hr>
<td align="center" width="45%">
<div class="dli">
<div class="foot">
<a href="/start/step-1?act=m'.(!empty($inv['id'])?'&ref='.$inv['id']:null).'"><img src="/images/start/step-1-m.png"></a>
</td>
</div>
<td align="center" width="45%">
<div class="dli">
<div class="foot">
<a href="/start/step-1?act=w'.(!empty($inv['id'])?'&inv='.$inv['id']:null).'"><img src="/images/start/step-1-w.png"></a>
</div>
</td>
</tbody>
</table>
</div>';
} else {
setcookie('nick', $nick['nick'], time() + 84600 * 30, '/');
setcookie('pass', $nick['pass'], time() + 84600 * 30, '/');
header('Location: /');
exit();
}
}
if($_SESSION['p_sid']==0 and $_SESSION['fs_id']==0 and $_SESSION['ok_id']==0 and $_SESSION['m_id']==0){
$inv = mysql_fetch_array(mysql_query("SELECT * FROM `user` where `id` = '".abs(intval($_GET['ref']))."'"));
echo'<table width="100%" border="0" cellpadding="0" cellspacing="0" style="color:#E5CBB7;font-size:11px;">
<tbody>
<tr>
<div class="mli">
<div class="empty2"></div>
<center>
Выбери, кем ты будешь в этом жестоком мире - храбрым и сильным воином или хрупкой, но прекрасной воительницей
</center>
<div class="empty2"></div>
</div>
<hr>
<td align="center" width="45%">
<div class="dli">
<div class="foot">
<a href="/start/step-1?act=m'.(!empty($inv['id'])?'&ref='.$inv['id']:null).'"><img src="/images/start/step-1-m.png"></a>
</td>
</div>
<td align="center" width="45%">
<div class="dli">
<div class="foot">
<a href="/start/step-1?act=w'.(!empty($inv['id'])?'&inv='.$inv['id']:null).'"><img src="/images/start/step-1-w.png"></a>
</div>
</td>
</tbody>
</table>
</div>';
}
break;
case 'm':
if(!empty($_GET['act'])){
$req = mysql_query("SELECT `id` FROM `user`");
$idd = mysql_num_rows($req);
$id = $idd + 1;
$log = "Боец $id";
$pass = ''.md5('12345').'';
$pol = '1';
$time = date("H:i:s", time());
$inv = mysql_fetch_array(mysql_query("SELECT * from `user` where `id` = '".abs(intval($_GET['ref']))."'"));
if($user['step1'] > 0){
$_SESSION['err'] = 'Империя уже выбрана';
header('Location: /step-3');
exit();
}
if (!empty($_SERVER['HTTP_CLIENT_IP']))
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
}
$elfixuj = time()-30;
$ipelf = mysql_result(mysql_query("SELECT COUNT(id) from `user` where `ip` = '".$ip."' AND `datareg`>'".$elfixuj."'"),0);
$pumpelf = mysql_result(mysql_query("SELECT COUNT(id) from `user` where `pumpit`='".$_SESSION['pumpit_id']."'"),0);
if($ipelf > 0 AND empty($_SESSION['p_sid'])){
$_SESSION['err'] = 'Слишком много регистраций с данного IP';
header('Location: /');
exit();
}
if($pumpelf > 0 && isset($_SESSION['p_sid']) && !empty($_SESSION['p_sid'])){
$_SESSION['err'] = 'С одного кабинета можно зарегистрировать только одного персонажа!';
header('Location: /');
exit();
}
if(!isset($err)) {
$rand = rand(0,1);
if($rand==1){$imp='mol';}
if($rand==0){$imp='ogn';}
if (isset($_SESSION['p_sid']) && !empty($_SESSION['p_sid']))
{
mysql_query("INSERT INTO `user` SET `id`='$id', `nick` = '$log', `pass` = '$pass', `plem`='$imp', `pol` = '$pol', `datareg` = '".time()."', `mesto` = 'Обучение', `health` = 200, `max_health` = 200, `sila` = 20, `zashit` = 20,`pumpit`='".$_SESSION['pumpit_id']."'");
} elseif (isset($_SESSION['fs_id']) && !empty($_SESSION['fs_id'])) {
mysql_query("INSERT INTO `user` SET `id`='$id', `nick` = '$log', `pass` = '$pass', `plem`='$imp', `pol` = '$pol', `datareg` = '".time()."', `mesto` = 'Обучение', `health` = 200, `max_health` = 200, `sila` = 20, `zashit` = 20, `fs_id`='".$_SESSION['fs_id']."' ");
} elseif (isset($_SESSION['ok_id']) && !empty($_SESSION['ok_id'])) {
mysql_query("INSERT INTO `user` SET `id`='$id', `nick` = '$log', `pass` = '$pass', `plem`='$imp', `pol` = '$pol', `datareg` = '".time()."', `mesto` = 'Обучение', `health` = 200, `max_health` = 200, `sila` = 20, `zashit` = 20, `ok`='".$_SESSION['ok_id']."' ");
} elseif (isset($_SESSION['m_id']) && !empty($_SESSION['m_id'])) {
mysql_query("INSERT INTO `user` SET `id`='$id', `nick` = '$log', `pass` = '$pass', `plem`='$imp', `pol` = '$pol', `datareg` = '".time()."', `mesto` = 'Обучение', `health` = 200, `max_health` = 200, `sila` = 20, `zashit` = 20, `mail`='".$_SESSION['m_id']."' ");
}
else
{
mysql_query("INSERT INTO `user` SET `id`='$id', `nick` = '$log', `pass` = '$pass', `plem`='$imp', `pol` = '$pol', `datareg` = '".time()."', `mesto` = 'Обучение', `health` = 200, `max_health` = 200, `sila` = 20, `zashit` = 20");
}
if(isset($_GET['ref'])>0){
mysql_query("UPDATE `user` set `inv` = '".$inv['id']."' where `id` = '".$id."'");
}
$rest = mysql_result(mysql_query("SELECT COUNT(*) FROM `bonus` WHERE `usr` = '".$id."' and `name` = 'Бонус звания'"),0);
if($rest==0){mysql_query("INSERT INTO `bonus` set `usr` = ".$id.", `name` = 'Бонус звания',`kol`='10',`param`='all', `time` = '$t', `bonus`='+10 к параметрам', `image`='6',`typ`='1'");}
mysql_query("UPDATE `user` set `sila`=`sila`+'10',`max_health`=`max_health`+'100',`zashit`=`zashit`+'10', `zvan` = '1' where `id` = '$id'");
setcookie('nick', $log, time()+86400*365, '/');
setcookie('pass', $pass, time()+86400*365, '/');
header('Location: step-2?act=plem&pol=m'.(!empty($inv['id'])?'&inv='.$inv['id']:null).'');
exit();
} else {
header('Location: ?'); $_SESSION['err'] = $err;
exit();
}
} else {
header('Location: ?'); $_SESSION['err'] = 'Укажите данные';
exit();
}
break;
case 'w':
if(!empty($_GET['act'])){
$req = mysql_query("SELECT id FROM `user`");
$idd = mysql_num_rows($req);
$id=$idd+'1';
$log = "Боец $id";
$pass = ''.md5('12345').'';
$pol = '0';
$time=date("H:i:s", time());
$inv = mysql_fetch_array(mysql_query("SELECT * FROM `user` where `id` = '".abs(intval($_GET['ref']))."'"));
if($user['step1'] > 0){
$_SESSION['err'] = 'Империя уже выбрана';
header('Location: /step-3');
exit();
}
if (!empty($_SERVER['HTTP_CLIENT_IP']))
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
}
$elfixuj = time()-30;
$ipelf = mysql_result(mysql_query("SELECT COUNT(id) from `user` where `ip` = '".$ip."' AND `datareg`>'".$elfixuj."'"),0);
$pumpelf = mysql_result(mysql_query("SELECT COUNT(id) from `user` where `pumpit`='".$_SESSION['pumpit_id']."'"),0);
if($ipelf > 0 AND empty($_SESSION['p_sid'])){
$_SESSION['err'] = 'Слишком много регистраций с данного IP';
header('Location: /');
exit();
}
if($pumpelf > 0 && isset($_SESSION['p_sid']) && !empty($_SESSION['p_sid'])){
$_SESSION['err'] = 'С одного кабинета можно зарегистрировать только одного персонажа!';
header('Location: /');
exit();
}
if(!isset($err)) {
$rand=rand(0,1);
if($rand==1){$imp='mol';}
if($rand==0){$imp='ogn';}
if (isset($_SESSION['p_sid']) && !empty($_SESSION['p_sid']))
{
mysql_query("INSERT INTO `user` SET `id`='$id', `nick` = '$log', `pass` = '$pass', `plem`='$imp', `pol` = '$pol', `datareg` = '".time()."', `mesto` = 'Обучение', `health` = 200, `max_health` = 200, `sila` = 20, `zashit` = 20,`pumpit`='".$_SESSION['pumpit_id']."'");
} elseif (isset($_SESSION['fs_id']) && !empty($_SESSION['fs_id'])) {
mysql_query("INSERT INTO `user` SET `id`='$id', `nick` = '$log', `pass` = '$pass', `plem`='$imp', `pol` = '$pol', `datareg` = '".time()."', `mesto` = 'Обучение', `health` = 200, `max_health` = 200, `sila` = 20, `zashit` = 20, `fs_id`='".$_SESSION['fs_id']."' ");
} elseif (isset($_SESSION['ok_id']) && !empty($_SESSION['ok_id'])) {
mysql_query("INSERT INTO `user` SET `id`='$id', `nick` = '$log', `pass` = '$pass', `plem`='$imp', `pol` = '$pol', `datareg` = '".time()."', `mesto` = 'Обучение', `health` = 200, `max_health` = 200, `sila` = 20, `zashit` = 20, `ok`='".$_SESSION['ok_id']."' ");
}
else
{
mysql_query("INSERT INTO `user` SET `id`='$id', `nick` = '$log', `pass` = '$pass', `plem`='$imp', `pol` = '$pol', `datareg` = '".time()."', `mesto` = 'Обучение', `health` = 200, `max_health` = 200, `sila` = 20, `zashit` = 20");
}
if(!empty($inv['id'])){
mysql_query("UPDATE `user` set `inv` = '".$inv['id']."' where `id` = '".$id."'");
}
$rest = mysql_result(mysql_query("SELECT COUNT(*) FROM `bonus` WHERE `usr` = '".$id."' and `name` = 'Бонус звания'"),0);
if($rest==0){mysql_query("INSERT INTO `bonus` set `usr` = ".$id.", `name` = 'Бонус звания',`kol`='10',`param`='all', `time` = '$t', `bonus`='+10 к параметрам', `image`='6',`typ`='1'");}
mysql_query("UPDATE `user` set `sila`=`sila`+'10',`max_health`=`max_health`+'100',`zashit`=`zashit`+'10', `zvan` = '1' where `id` = '".$id."'");
setcookie('nick', $log, time()+86400*365, '/');
setcookie('pass', $pass, time()+86400*365, '/');
header('Location: step-2?act=plem&pol=w'.(!empty($inv['id'])?'&inv='.$inv['id']:null).'');
exit();
} else {
header('Location: ?'); $_SESSION['err'] = $err;
exit();
}
} else {
header('Location: ?'); $_SESSION['err'] = 'Укажите данные';
exit();
}
break;
}
require_once'../core/foot.php';
?>