Advertisement
Guest User

Untitled

a guest
Oct 24th, 2017
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.05 KB | None | 0 0
  1. <html>
  2. <body background="background.jpg">
  3. <title>EngineWar - Closed Beta Registration</title>
  4. <?php
  5. if(isset($_POST['username']) && isset($_POST['nickname']) && isset($_POST['mail']) && isset($_POST['pass']) && isset($_POST['pass2']))
  6. {
  7. include("pages/connect.php");
  8. $tempUsername = strip_tags($_POST['username']);
  9. $tempPasswort = strip_tags($_POST['pass']);
  10. $Passwort_Confirm = strip_tags($_POST['pass2']);
  11.  
  12. function chkEmail($email)
  13. {
  14. // elimino spazi, "a capo" e altro alle estremità della stringa
  15. $email = trim($email);
  16.  
  17. // se la stringa è vuota sicuramente non è una mail
  18. if(!$email) {
  19. return false;
  20. }
  21.  
  22. // controllo che ci sia una sola @ nella stringa
  23. $num_at = count(explode( '@', $email )) - 1;
  24. if($num_at != 1) {
  25. return false;
  26. }
  27.  
  28. // controllo la presenza di ulteriori caratteri "pericolosi":
  29. if(strpos($email,';') || strpos($email,',') || strpos($email,' ')) {
  30. return false;
  31. }
  32.  
  33. // la stringa rispetta il formato classico di una mail?
  34. if(!preg_match( '/^[\w\.\-]+@\w+[\w\.\-]*?\.\w{1,4}$/', $email)) {
  35. return false;
  36. }
  37.  
  38. return true;
  39. }
  40.  
  41. function randomsalt($lunghezza2=5){
  42. $caratteri_disponibili2 ="1234567890abcdefghijklmnopqrstuvwxyz";
  43. //$caratteri_disponibili ="abcdefghijklmnopqrstuvwxyz";
  44. $refer2 = "";
  45. for($i = 0; $i<$lunghezza2; $i++){
  46. $refer2 = $refer2.substr($caratteri_disponibili2,rand(0,strlen($caratteri_disponibili2)-1),1);
  47. }
  48. return $refer2;
  49. }
  50. function randomcode($lunghezza22=12){
  51. $caratteri_disponibili22 ="1234567890abcdefghijklmnopqrstuvwxyz";
  52. //$caratteri_disponibili ="abcdefghijklmnopqrstuvwxyz";
  53. $refer22 = "";
  54. for($i = 0; $i<$lunghezza22; $i++){
  55. $refer22 = $refer22.substr($caratteri_disponibili22,rand(0,strlen($caratteri_disponibili22)-1),1);
  56. }
  57. return $refer22;
  58. }
  59. function randomcodesess($lunghezza222=12){
  60. $caratteri_disponibili222 ="1234567890abcdefghijklmnopqrstuvwxyz";
  61. //$caratteri_disponibili ="abcdefghijklmnopqrstuvwxyz";
  62. $refer222 = "";
  63. for($i = 0; $i<$lunghezza222; $i++){
  64. $refer222 = $refer222.substr($caratteri_disponibili222,rand(0,strlen($caratteri_disponibili222)-1),1);
  65. }
  66. return $refer222;
  67. }
  68. //controllo e modifico le mail farlocche
  69. $_POST['mail'] = str_replace("@nwldx.com", "", $_POST['mail']);
  70. $_POST['mail'] = str_replace("@mailmetrash.com", "", $_POST['mail']);
  71. $_POST['mail'] = str_replace("@anonymbox.com", "", $_POST['mail']);
  72. $_POST['mail'] = str_replace("@mailcatch.com", "", $_POST['mail']);
  73. $_POST['mail'] = str_replace("@no-spam.ws", "", $_POST['mail']);
  74. $_POST['mail'] = str_replace("@yopmail.com", "", $_POST['mail']);
  75. $_POST['mail'] = str_replace("@sharklasers.com", "", $_POST['mail']);
  76. $_POST['mail'] = str_replace("@filzmail.com", "", $_POST['mail']);
  77. $_POST['mail'] = str_replace("@mint.us.to", "", $_POST['mail']);
  78. $_POST['mail'] = str_replace("@spambox.us", "", $_POST['mail']);
  79. $_POST['mail'] = str_replace("@sofimail.com", "", $_POST['mail']);
  80. $_POST['mail'] = str_replace("@noclickemail.com", "", $_POST['mail']);
  81. $_POST['mail'] = str_replace("@mailinator.com", "", $_POST['mail']);
  82. $_POST['mail'] = str_replace("@meltmail.com", "", $_POST['mail']);
  83. $_POST['mail'] = str_replace("@TempEmail.net", "", $_POST['mail']);
  84. $_POST['mail'] = str_replace("@dunflimblag.mailexpire.com", "", $_POST['mail']);
  85. $_POST['mail'] = str_replace("@tittbit.in", "", $_POST['mail']);
  86. $_POST['mail'] = str_replace("@temporaryemail.us", "", $_POST['mail']);
  87. $_POST['mail'] = str_replace("@ixi.me", "", $_POST['mail']);
  88. $_POST['mail'] = str_replace("@tempthe.net", "", $_POST['mail']);
  89. $_POST['mail'] = str_replace("@emailthe.net", "", $_POST['mail']);
  90. $_POST['mail'] = str_replace("@trashmail.ws", "", $_POST['mail']);
  91. $_POST['mail'] = str_replace("@fakeinbox.com", "", $_POST['mail']);
  92. $_POST['mail'] = str_replace("@jetable.org", "", $_POST['mail']);
  93. //fine controllo
  94. $usrsess=randomcodesess();
  95. $code=randomcode();
  96. $salt=randomsalt();
  97. $nickname=strip_tags($_POST['nickname']);
  98. $email = strip_tags($_POST['mail']);
  99. $pass=strip_tags($_POST['pass']);
  100. $timestamp = (time()+ 864000); //equivale a 7 giorni in piu oltre la data attuale
  101. $orario = time(); //imposta il timestamp della data attuale
  102. /*echo "Timestamp: ";
  103. echo $timestamp;
  104. echo "<br>Username: ";
  105. echo $tempUsername;
  106. echo "<br>password in chiaro: ";
  107. echo $pass;
  108. echo "<br>Password criptata: ";
  109. echo $tempPasswort;
  110. echo "<br>Salt: ";
  111. echo $salt;
  112. echo "<br>Nickname: ";
  113. echo $nickname;
  114. echo "<br>Email: ";
  115. echo $email;
  116. Die();*/
  117.  
  118. if($nickname) {
  119. $nickname = str_replace("[GA]", "", $nickname);
  120. if(chkEmail($email)) {
  121.  
  122. if($Passwort_Confirm == $pass)
  123. {
  124. $tempUserLength = strlen($tempUsername);
  125. if($tempUserLength < 16)
  126. {
  127. if($tempUserLength > 3)
  128. {
  129. //controllo se esiste gia l'username
  130. $i_spieler="SELECT * FROM users where username='".$tempUsername."'";
  131. $i_spieler2=mysqli_query($con,$i_spieler)or die("MySQL ErrCode 1 - Username");
  132. $i_spieler3=mysqli_fetch_array($i_spieler2);
  133. //controllo se esiste gia il nickname
  134. $i_spieler1="SELECT * FROM users where nickname='".$nickname."'";
  135. $i_spieler21=mysqli_query($con,$i_spieler1)or die("MySQL ErrCode - Nickname");
  136. $i_spieler31=mysqli_fetch_array($i_spieler21);
  137. //controllo se esiste gia la mail
  138. $i_spieler11="SELECT * FROM users where email='".$email."'";
  139. $i_spieler211=mysqli_query($con,$i_spieler11)or die("MySQL ErrCode - Nickname");
  140. $i_spieler311=mysqli_fetch_array($i_spieler211);
  141.  
  142. if($i_spieler311)
  143. {
  144. echo '<table><br>
  145. <center><b><font color="red">This nickname has already taken!.</font><br><br>
  146. <a href="Register2.php">Go Back</a></table></font>';
  147. }
  148. else
  149. {
  150.  
  151. $userQuery = "INSERT INTO users(username,password,salt,nickname,email,premium,dinar,exp,kills,deaths,premiumExpire,cash) VALUES ('$tempUsername','$tempPasswort','$salt','$nickname','$email',3,100000,0,0,0,'$timestamp','20000')";
  152. mysqli_query($con,$userQuery) or die("MySQL ErrCode 2 - Account");
  153.  
  154. $idnuovo="SELECT id FROM users where username='". $tempUsername ."'";
  155. $iricevuto=mysqli_query($con,$idnuovo)or die("MySQL ErrCode 3 - ExistUsername");
  156. $idecuip=mysqli_fetch_array($iricevuto);
  157.  
  158. $idnumero= $idecuip['id'];
  159.  
  160. $equip = "INSERT INTO equipment(ownerid) VALUES ('".$idnumero."')";
  161. mysqli_query($con,$equip) or die("MySQL ErrCode 4 - Equipment");
  162.  
  163. echo '<table><br>
  164. <center><b><font color="lime">Registered successfully! Now you can login!</font><br><br>
  165. <a href="index.php">Go Back</a></table></font></center>';//header('Location: registerdone.php'); exit;
  166. }
  167.  
  168. }
  169. else
  170. {
  171. echo '<table><br>
  172. <center><b><font color="red">Username length is too short (min 4 characters)!</font><br><br>
  173. <a href="index.php">Go Back</a></table></font></center>'; //header('Location: registerfail2.php'); exit;
  174. }
  175. }
  176. else
  177. {
  178. echo '<table><br>
  179. <center><b><font color="red">Username too long (max 15 characters)!</font><br><br>
  180. <a href="index.php">Go Back</a></table></font></center>'; //header('Location: registerfail3.php'); exit;
  181. }
  182. }else
  183. {
  184. echo '<table><br>
  185. <center><b><font color="red">Both password aren not same!</font><br><br>
  186. <a href="index.php">Go Back</a></table></font></center>'; //header('Location: registerfail3.php'); exit;
  187. }
  188. }
  189. else {
  190. echo '<table><br>
  191. <center><b><font color="red">This email is not accepted or invalid from the system!</font><br><br>
  192. <a href="index.php">Go Back</a></table></font></center>';
  193. }
  194. }
  195. else {
  196. echo '<table><br>
  197. <center><b><font color="red">You did not put the nickname!</font><br><br>
  198. <a href="index.php">Go Back</a></table></font></center>';
  199. }
  200. }
  201. else
  202. {
  203. ?><center>
  204. <table>
  205. </td><td>
  206. <form action='index.php' method='post'>
  207. <table border='0'>
  208. <center><tr><td><b><font color='red'>Register for EliteWar!</td><td>
  209. </td></tr></center></table>
  210. <table border='0'>
  211. <tr><td><b><font color='white'>Username:</td><td>
  212. <input type='text' name='username' maxlength='15'>
  213. </td></tr>
  214. <tr><td><b><font color='white'>Nick in Game:</td><td>
  215. <input type='text' name='nickname' maxlength='15'>
  216. </td></tr>
  217. <tr><td><b><font color='white'>Email:</td><td>
  218. <input type='text' name='mail' maxlength='25'>
  219. </td></tr>
  220. <tr><td><b><font color='white'>Password: (max 10 char)</td><td>
  221. <input type='password' name='pass' maxlength='10'>
  222. </td></tr>
  223. <tr><td><b><font color='white'>Confirm Password: (max 10 char)</td><td>
  224. <input type='password' name='pass2' maxlength='10'>
  225. </td></tr>
  226. <tr><th colspan=2><input type='submit' name='submit'
  227. value='Register'></th></tr> </table></font>
  228. </form>
  229.  
  230. </th></tr> </table></font></center>
  231. <?php
  232. }
  233. ?>
  234. <form action='index.php' method='post'>
  235. <table border='0'>
  236. <center><tr><td><b><font color='red'></td><td>
  237. </td></tr></center></table>
  238. </body>
  239. </html>
  240. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement