Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Registr!</title>
- <META http-equiv=content-type content="text/html; charset=windows-1251">
- <LINK href="css/style2.css" type=text/css rel=stylesheet>
- </head>
- <body>
- <CENTER>
- <?php
- session_start();
- if (isset($_POST['login'])) { $login = $_POST['login']; if ($login == '') { unset($login);} } //заносим введенный пользователем логин в переменную $login, если он пустой, то уничтожаем переменную
- if (isset($_POST['password'])) { $password=$_POST['password']; if ($password =='') { unset($password);} }//заносим введенный пользователем пароль в переменную $password, если он пустой, то уничтожаем переменную
- if (empty($login) or empty($password)) //если пользователь не ввел логин или пароль, то выдаем ошибку и останавливаем скрипт
- {
- echo "<script>alert('Вы ввели не всю информацию, вернитесь назад и заполните все поля!'); location.href='index.php?go=reg';</script>"; exit;
- }
- if (!preg_match("|^[a-z_-]+$|i", $login)) //проверка логина регулярными выражениями на корректность
- {echo "<script>alert('Логин может содержать только латинские буквы, цифры и _!'); location.href='index.php?go=reg';</script>"; exit;}
- if (isset($_POST['email'])) { $aMail = $_POST['email']; if ($aMail == '') { unset($aMail);} } //заносим введенный пользователем e-mail, если он пустой, то уничтожаем переменную
- if (empty($aMail) or empty($aMail))
- {
- echo "<script>alert('Вы ввели не всю информацию, вернитесь назад и заполните все поля!'); location.href='index.php?go=reg';</script>"; exit; //останавливаем выполнение сценариев
- }
- if (!preg_match("/[0-9a-z_]+@[0-9a-z_^\.]+\.[a-z]{2,3}/i", $aMail)) //проверка е-mail адреса регулярными выражениями на корректность
- { echo "<script>alert('Неверно введен е-mail!'); location.href='index.php?go=reg';</script>"; exit; }
- $ip=getenv("HTTP_X_FORWARDED_FOR");
- if (empty($ip) || $ip=='unknown') { $ip=getenv("REMOTE_ADDR"); }
- $vozvrat = " <a href='index.php?go=reg'>Вернуться назад!</a>";
- $vozvrat2 = " <a href='index.php'>На главную!</a>";
- $aLogin = $_POST['login'];
- $aLogin = trim($aLogin);
- $aLogin = stripslashes($aLogin);
- $aLogin = htmlspecialchars($aLogin);
- if (strlen($aLogin) < 3 or strlen($aLogin) > 15) {echo "<script>alert('Логин должен состоять не менее чем из 3 символов и не более чем из 15.'); location.href='index.php?go=reg';</script>"; exit;}
- $aPassword = $_POST['password'];
- $aPassword = trim($aPassword);
- $aPassword = stripslashes($aPassword);
- $aPassword = htmlspecialchars($aPassword);
- if (strlen($aPassword) < 6 or strlen($aPassword) > 15) {echo "<script>alert('Пароль должен состоять не менее чем из 6 символов и не более чем из 15.'); location.href='index.php?go=reg';</script>"; exit;}
- $aInfo = $_POST['info'];
- $aMail = $_POST['email'];
- $aYear = $_POST['year'];
- $aMonth = $_POST['month'];
- $aDay = $_POST['day'];
- $aDate = $aYear."-".$aMonth."-".$aDay;
- $aAnswer = $_POST['answer'];
- $aGender = $_POST['gender'];
- if ($aGender=='Мужской'){$aUserGender = 1;}else{$aUserGender = 2;}
- $aCity = $_POST['city'];
- $aICQ = $_POST['icq'];
- $aRang = "Новичок";
- $md5code = $_POST['check'];
- $code = $_POST['digits'];
- $aInfo = trim($aInfo);$aInfo = stripslashes($aInfo);$aInfo = htmlspecialchars($aInfo);
- $aMail = trim($aMail);$aMail = stripslashes($aMail);$aMail = htmlspecialchars($aMail);
- $aYear = trim($aYear);$aYear = stripslashes($aYear);$aYear = htmlspecialchars($aYear);
- $aMonth = trim($aMonth);$aMonth = stripslashes($aMonth);$aMonth = htmlspecialchars($aMonth);
- $aDay = trim($aDay);$aDay = stripslashes($aDay);$aDay = htmlspecialchars($aDay);
- $aAnswer = trim($aAnswer);$aAnswer = stripslashes($aAnswer);$aAnswer = htmlspecialchars($aAnswer);
- $aGender = trim($aGender);$aGender = stripslashes($aGender);$aGender = htmlspecialchars($aGender);
- $aCity = trim($aCity);$aCity = stripslashes($aCity);$aCity = htmlspecialchars($aCity);
- $aICQ = trim($aICQ);$aICQ = stripslashes($aICQ);$aICQ = htmlspecialchars($aICQ);
- $md5code = trim($md5code);$md5code = stripslashes($md5code);$md5code = htmlspecialchars($md5code);
- $code = trim($code);$code = stripslashes($code);$code = htmlspecialchars($code);
- $date = date('Y-m-d',time());
- $aPassword = md5($aPassword);//шифруем пароль
- $aPassword = strrev($aPassword);
- $aPassword = $aPassword."b3p6f";
- if ($_SESSION['captcha_code'] === $code)){
- $num_rows = first('SELECT id FROM users where MATCH (login) AGAINST ("%s")',$login);
- if(!$num_rows){
- insert('users',array(
- 'login'=>$aLogin,
- 'password'=>$aPassword,
- 'User_Birth_Day'=>$date,
- 'Character_Birth_Day'=>$aDate,
- 'Security_Answer'=>$aAnswer,
- 'User_Gender'=>$aUserGender,
- 'User_City'=>$aCity,
- 'ICQ_Number'=>$aICQ,
- 'Rang'=>$aRang,
- 'info'=>$aInfo,
- 'avatar'=>001,
- 'soboi'=>1,
- 'email'=>$aMail,
- 'ip'=>$ip,
- 'count_poke'=>1,
- 'groups'=>11
- ));
- $user2 = mysql_insert_id();
- $Base_id = $_POST['poke'];
- $Base_id = trim($Base_id);$Base_id = stripslashes($Base_id);$Base_id = htmlspecialchars($Base_id);
- if ($Base_id=='1'){$Base_id2 = '1';} else
- if ($Base_id=='4'){$Base_id2 = '4';} else
- if ($Base_id=='7'){$Base_id2 = '7';} else
- if ($Base_id=='152'){$Base_id2 = '152';} else
- if ($Base_id=='155'){$Base_id2 = '155';} else
- if ($Base_id=='158'){$Base_id2 = '158';} else
- if ($Base_id=='252'){$Base_id2 = '252';} else
- if ($Base_id=='255'){$Base_id2 = '255';} else
- if ($Base_id=='258'){$Base_id2 = '258';} else
- if ($Base_id=='387'){$Base_id2 = '387';} else
- if ($Base_id=='390'){$Base_id2 = '390';} else
- if ($Base_id=='393'){$Base_id2 = '393';} else
- if ($Base_id=='495'){$Base_id2 = '495';} else
- if ($Base_id=='498'){$Base_id2 = '498';} else
- if ($Base_id=='501'){$Base_id2 = '501';} else
- {$Base_id2 = '1';}
- $BID = $Base_id2;
- if ($BID == '') { exit ("<script>alert('Вы невыбрали покемона!'); location.href='index.php?go=reg';</script>"); exit;}
- $user_reg = $user2;
- $lvl = "4";
- $iv = "28";
- $ev = "16";
- $ev2 = "0";
- $sex = ''.mt_rand(1,2);
- $pok = first('SELECT * FROM poke_base WHERE id=%d LIMIT 1',$BID);
- $hp = (($iv+($pok['hp']*2)+($ev/4)+100)*($lvl/100))+10;
- $atk = ((($iv+($pok['atk']*2)+($ev/4))*($lvl/100))+5)*1;
- $def = ((($iv+($pok['def']*2)+($ev/4))*($lvl/100))+5)*1;
- $satk = ((($iv+($pok['satk']*2)+($ev/4))*($lvl/100))+5)*1;
- $sdef = ((($iv+($pok['sdef']*2)+($ev/4))*($lvl/100))+5)*1;
- $speed = ((($iv+($pok['speed']*2)+($ev/4))*($lvl/100))+5)*1;
- $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']);
- insert('pokemon_user',array(
- 'base_id'=>$pok['id'],
- 'name'=>$pok['title'],
- 'user'=>$user_reg,
- 'img_pok'=>$pok['img'],
- 'level'=>$lvl,
- 'sex'=>$sex,
- 'har'=>13,
- 'hp_now'=>$hp,
- 'hp_max'=>$hp,
- 'hp_iv'=>$iv,
- 'atk'=>$atk,
- 'atk_iv'=>$iv,
- 'def'=>$def,
- 'def_iv'=>$iv,
- 'satk'=>$satk,
- 'satk_iv'=>$iv,
- 'sdef'=>$sdef,
- 'sdef_iv'=>$iv,
- 'speed'=>$speed,
- 'speed_iv'=>$iv,
- 'start_new'=>1,
- 'endurance_min'=>100,
- 'endurance_max'=>100,
- 'ev'=>$ev,
- 'exp'=>50,
- 'exp_b'=>150,
- 'start'=>1,
- 'active'=>1,
- 'razveden'=>1,
- 'atc_one'=>$atk_zapr['atac_id'],
- ));
- insert('items_users',array(
- 'item_id'=>1,
- 'user_id'=>$user_reg,
- 'count'=>500));
- insert('items_users',array(
- 'item_id'=>23,
- 'user_id'=>$user_reg,
- 'count'=>15));
- print("<span style=\"color: black;\">Пользователь: $aLogin, Датой рождения: $aDate удачно зарегистрирован! <br><br> $vozvrat2 </span>");} else {
- print("<span style=\"color: black;\">Пользователь с логином: $aLogin уже есть в игре, выберите другой логин! <br><br> $vozvrat </span>");}
- mysql_close();
- }else
- {
- echo "<script>alert('Вы ввели неправильные цифры с картинки!'); location.href='index.php?go=reg';</script>"; exit;} ?>
- </CENTER>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement