Advertisement
halleman017

reg page | vadim

Feb 21st, 2017
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.12 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Registr!</title>
  4. <META http-equiv=content-type content="text/html; charset=windows-1251">
  5. <LINK href="css/style2.css" type=text/css rel=stylesheet>
  6. </head>
  7. <body>
  8. <CENTER>
  9.   <?php
  10.  
  11.   session_start();
  12.  
  13. if (isset($_POST['login'])) { $login = $_POST['login']; if ($login == '') { unset($login);} } //заносим введенный пользователем логин в переменную $login, если он пустой, то уничтожаем переменную
  14. if (isset($_POST['password'])) { $password=$_POST['password']; if ($password =='') { unset($password);} }//заносим введенный пользователем пароль в переменную $password, если он пустой, то уничтожаем переменную
  15.  
  16. if (empty($login) or empty($password)) //если пользователь не ввел логин или пароль, то выдаем ошибку и останавливаем скрипт
  17.     {
  18.      echo "<script>alert('Вы ввели не всю информацию, вернитесь назад и заполните все поля!'); location.href='index.php?go=reg';</script>"; exit;
  19.     }                  
  20.     if    (!preg_match("|^[a-z_-]+$|i", $login)) //проверка логина регулярными выражениями на корректность
  21.     {echo "<script>alert('Логин может содержать только латинские буквы, цифры и _!'); location.href='index.php?go=reg';</script>"; exit;}
  22.    
  23. if    (isset($_POST['email'])) { $aMail = $_POST['email']; if ($aMail == '') {    unset($aMail);} } //заносим введенный пользователем e-mail, если он    пустой, то уничтожаем переменную
  24. if    (empty($aMail) or empty($aMail))
  25.             {
  26.             echo "<script>alert('Вы ввели не всю информацию, вернитесь назад и заполните все поля!'); location.href='index.php?go=reg';</script>";  exit; //останавливаем    выполнение сценариев
  27.             }
  28.             if    (!preg_match("/[0-9a-z_]+@[0-9a-z_^\.]+\.[a-z]{2,3}/i", $aMail)) //проверка    е-mail адреса регулярными выражениями на корректность
  29.            
  30.             { echo "<script>alert('Неверно введен е-mail!'); location.href='index.php?go=reg';</script>";  exit; }    
  31.   $ip=getenv("HTTP_X_FORWARDED_FOR");
  32.   if (empty($ip) || $ip=='unknown') { $ip=getenv("REMOTE_ADDR"); }  
  33.     $vozvrat = " <a href='index.php?go=reg'>Вернуться назад!</a>";
  34.     $vozvrat2 = " <a href='index.php'>На главную!</a>";
  35.     $aLogin = $_POST['login'];
  36.     $aLogin = trim($aLogin);
  37.     $aLogin = stripslashes($aLogin);
  38.     $aLogin = htmlspecialchars($aLogin);      
  39.     if (strlen($aLogin) < 3 or strlen($aLogin) > 15) {echo "<script>alert('Логин должен состоять не менее чем из 3 символов и не более чем из 15.'); location.href='index.php?go=reg';</script>";  exit;}
  40.     $aPassword = $_POST['password'];
  41.     $aPassword = trim($aPassword);
  42.     $aPassword = stripslashes($aPassword);
  43.     $aPassword = htmlspecialchars($aPassword);
  44.     if (strlen($aPassword) < 6 or strlen($aPassword) > 15) {echo "<script>alert('Пароль должен состоять не менее чем из 6 символов и не более чем из 15.'); location.href='index.php?go=reg';</script>";  exit;}    
  45.    
  46.     $aInfo = $_POST['info'];
  47.     $aMail = $_POST['email'];          
  48.     $aYear = $_POST['year'];
  49.     $aMonth = $_POST['month'];
  50.     $aDay = $_POST['day'];
  51.     $aDate = $aYear."-".$aMonth."-".$aDay;
  52.     $aAnswer = $_POST['answer'];
  53.     $aGender = $_POST['gender'];
  54.     if ($aGender=='Мужской'){$aUserGender = 1;}else{$aUserGender = 2;}
  55.     $aCity   = $_POST['city'];
  56.     $aICQ  = $_POST['icq'];
  57.     $aRang  = "Новичок";
  58.     $md5code = $_POST['check'];
  59.     $code = $_POST['digits'];
  60.    
  61.     $aInfo = trim($aInfo);$aInfo = stripslashes($aInfo);$aInfo = htmlspecialchars($aInfo);
  62.     $aMail = trim($aMail);$aMail = stripslashes($aMail);$aMail = htmlspecialchars($aMail);
  63.     $aYear = trim($aYear);$aYear = stripslashes($aYear);$aYear = htmlspecialchars($aYear);
  64.     $aMonth = trim($aMonth);$aMonth = stripslashes($aMonth);$aMonth = htmlspecialchars($aMonth);
  65.     $aDay = trim($aDay);$aDay = stripslashes($aDay);$aDay = htmlspecialchars($aDay);
  66.     $aAnswer = trim($aAnswer);$aAnswer = stripslashes($aAnswer);$aAnswer = htmlspecialchars($aAnswer);
  67.     $aGender = trim($aGender);$aGender = stripslashes($aGender);$aGender = htmlspecialchars($aGender);
  68.     $aCity = trim($aCity);$aCity = stripslashes($aCity);$aCity = htmlspecialchars($aCity);
  69.     $aICQ = trim($aICQ);$aICQ = stripslashes($aICQ);$aICQ = htmlspecialchars($aICQ);
  70.     $md5code = trim($md5code);$md5code = stripslashes($md5code);$md5code = htmlspecialchars($md5code);
  71.     $code = trim($code);$code = stripslashes($code);$code = htmlspecialchars($code);
  72.    
  73.        
  74.     $date = date('Y-m-d',time());                                                                  
  75.     $aPassword = md5($aPassword);//шифруем пароль
  76.     $aPassword = strrev($aPassword);
  77.     $aPassword = $aPassword."b3p6f";
  78.     if ($_SESSION['captcha_code'] === $code)){
  79.     $num_rows = first('SELECT id FROM users where MATCH (login) AGAINST ("%s")',$login);
  80.     if(!$num_rows){
  81.                              
  82.    insert('users',array(
  83.    'login'=>$aLogin,
  84.    'password'=>$aPassword,
  85.    'User_Birth_Day'=>$date,
  86.    'Character_Birth_Day'=>$aDate,
  87.    'Security_Answer'=>$aAnswer,
  88.    'User_Gender'=>$aUserGender,
  89.    'User_City'=>$aCity,
  90.    'ICQ_Number'=>$aICQ,
  91.    'Rang'=>$aRang,
  92.    'info'=>$aInfo,
  93.    'avatar'=>001,
  94.    'soboi'=>1,
  95.    'email'=>$aMail,
  96.    'ip'=>$ip,
  97.    'count_poke'=>1,
  98.    'groups'=>11
  99.    ));
  100.     $user2 = mysql_insert_id();
  101.    
  102.     $Base_id = $_POST['poke'];
  103.     $Base_id = trim($Base_id);$Base_id = stripslashes($Base_id);$Base_id = htmlspecialchars($Base_id);
  104.    
  105.     if ($Base_id=='1'){$Base_id2 = '1';} else
  106.     if ($Base_id=='4'){$Base_id2 = '4';} else
  107.     if ($Base_id=='7'){$Base_id2 = '7';} else
  108.     if ($Base_id=='152'){$Base_id2 = '152';} else
  109.     if ($Base_id=='155'){$Base_id2 = '155';} else
  110.     if ($Base_id=='158'){$Base_id2 = '158';} else
  111.     if ($Base_id=='252'){$Base_id2 = '252';} else
  112.     if ($Base_id=='255'){$Base_id2 = '255';} else
  113.     if ($Base_id=='258'){$Base_id2 = '258';} else
  114.     if ($Base_id=='387'){$Base_id2 = '387';} else
  115.     if ($Base_id=='390'){$Base_id2 = '390';} else
  116.     if ($Base_id=='393'){$Base_id2 = '393';} else
  117.     if ($Base_id=='495'){$Base_id2 = '495';} else
  118.     if ($Base_id=='498'){$Base_id2 = '498';} else
  119.     if ($Base_id=='501'){$Base_id2 = '501';} else
  120.     {$Base_id2 = '1';}
  121.      
  122. $BID = $Base_id2;
  123. if ($BID == '') { exit ("<script>alert('Вы невыбрали покемона!');  location.href='index.php?go=reg';</script>"); exit;}
  124. $user_reg = $user2;
  125.    $lvl = "4";
  126.    $iv = "28";
  127.    $ev = "16";
  128.    $ev2 = "0";
  129.    $sex = ''.mt_rand(1,2);
  130.    $pok = first('SELECT * FROM poke_base WHERE id=%d LIMIT 1',$BID);
  131.    $hp = (($iv+($pok['hp']*2)+($ev/4)+100)*($lvl/100))+10;
  132.    $atk = ((($iv+($pok['atk']*2)+($ev/4))*($lvl/100))+5)*1;
  133.    $def = ((($iv+($pok['def']*2)+($ev/4))*($lvl/100))+5)*1;
  134.    $satk = ((($iv+($pok['satk']*2)+($ev/4))*($lvl/100))+5)*1;
  135.    $sdef = ((($iv+($pok['sdef']*2)+($ev/4))*($lvl/100))+5)*1;
  136.    $speed = ((($iv+($pok['speed']*2)+($ev/4))*($lvl/100))+5)*1;
  137.    $atk_zapr = first('SELECT *, CEIL(RAND()*atac_id) as chance FROM attac_poke WHERE poke_base_id=%d AND atc_lvl < 4 ORDER BY chance DESC',$pok['id']);
  138.    insert('pokemon_user',array(
  139.    'base_id'=>$pok['id'],
  140.    'name'=>$pok['title'],
  141.    'user'=>$user_reg,
  142.    'img_pok'=>$pok['img'],
  143.    'level'=>$lvl,
  144.    'sex'=>$sex,
  145.    'har'=>13,
  146.    'hp_now'=>$hp,
  147.    'hp_max'=>$hp,
  148.    'hp_iv'=>$iv,
  149.    'atk'=>$atk,
  150.    'atk_iv'=>$iv,
  151.    'def'=>$def,
  152.    'def_iv'=>$iv,
  153.    'satk'=>$satk,
  154.    'satk_iv'=>$iv,
  155.    'sdef'=>$sdef,
  156.    'sdef_iv'=>$iv,
  157.    'speed'=>$speed,
  158.    'speed_iv'=>$iv,
  159.    'start_new'=>1,
  160.    'endurance_min'=>100,    
  161.    'endurance_max'=>100,
  162.    'ev'=>$ev,
  163.    'exp'=>50,
  164.    'exp_b'=>150,
  165.    'start'=>1,
  166.    'active'=>1,
  167.    'razveden'=>1,
  168.    'atc_one'=>$atk_zapr['atac_id'],
  169.    ));
  170.    
  171.    insert('items_users',array(
  172.    'item_id'=>1,
  173.    'user_id'=>$user_reg,
  174.    'count'=>500));
  175.    insert('items_users',array(
  176.    'item_id'=>23,
  177.    'user_id'=>$user_reg,
  178.    'count'=>15));
  179.    
  180.    print("<span style=\"color: black;\">Пользователь: $aLogin, Датой рождения: $aDate удачно зарегистрирован! <br><br>  $vozvrat2 </span>");} else {
  181.    print("<span style=\"color: black;\">Пользователь с логином: $aLogin уже есть в игре, выберите другой логин! <br><br> $vozvrat </span>");}
  182.    mysql_close();
  183.    }else
  184.    {
  185.    echo "<script>alert('Вы ввели неправильные цифры с картинки!'); location.href='index.php?go=reg';</script>"; exit;} ?>
  186. </CENTER>
  187. </body>
  188. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement