Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.16 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>FnF-Pk Account Register</title>
  4. <style>
  5. body {
  6. color: #003300;
  7. font-family: Verdana, Arial, Serif;
  8. font-size: 10pt;
  9. }
  10. input {
  11. border: 1px solid #003300;
  12. color: #003300;
  13. background: #DDDDDD;
  14. font-family: Verdana, Arial, Serif;
  15. font-size: 10pt;
  16. }
  17. tr {
  18. font-size: 10pt;
  19. }
  20. a:link {
  21. text-decoration: none;
  22. color: #003300;
  23. }
  24. a:visited {
  25. text-decoration: none;
  26. color: #003300;
  27. }
  28. a:active {
  29. text-decoration: none;
  30. color: #003300;
  31. }
  32. a:hover {
  33. text-decoration: none;
  34. color: #FF6600;
  35. }
  36. </style>
  37. </head>
  38. <body>
  39. <div align="center">
  40. <?php
  41. $mysql_user = "test";
  42. $mysql_pass = "test";
  43. $mysql_database = "test";
  44. $mysql_host = "test";
  45. ?>
  46. <FORM METHOD=POST ACTION="<?php echo $_SERVER['PHP_SELF']; ?>?act=register">
  47. <table cellspacing=0 border=0>
  48. <tr>
  49. <td colspan=2 style="border: 1px solid #003300; background: #990000;"><CENTER>
  50. FnF-Pk Account Register
  51. </CENTER></td>
  52. </tr>
  53. <tr>
  54. <td style="border-left: 1px solid #003300">&nbsp;Account:</td>
  55. <td style="border-right: 1px solid #003300"><INPUT TYPE="text" NAME="login"&nbsp;></td>
  56. </tr>
  57. <tr>
  58. <td style="border-left: 1px solid #003300">&nbsp;Password:</td>
  59. <td style="border-right: 1px solid #003300"><INPUT TYPE="password" NAME="senha1">&nbsp;</td>
  60. </tr>
  61. <tr>
  62. <td style="border-left: 1px solid #003300">&nbsp;Retype Password:&nbsp;</td>
  63. <td style="border-right: 1px solid #003300"><INPUT TYPE="password" NAME="senha2">&nbsp;</td>
  64. </tr>
  65. <tr>
  66. <td style="border-left: 1px solid #003300">&nbsp;Email:</td>
  67. <td style="border-right: 1px solid #003300"><INPUT TYPE="text" NAME="email">&nbsp;</td>
  68. </tr>
  69. <tr>
  70. <td style="border-left: 1px solid #003300">&nbsp;Sec. Question:</td>
  71. <td style="border-right: 1px solid #003300"><INPUT TYPE="text" NAME="test">&nbsp;</td>
  72. </tr>
  73. <tr>
  74. <td style="border-left: 1px solid #003300">&nbsp;Sec. Answer:</td>
  75. <td style="border-right: 1px solid #003300"><INPUT TYPE="text" NAME="test2">&nbsp;</td>
  76. </tr>
  77. <tr>
  78. <td style="border: 1px solid #003300; border-top: 0px;" colspan=2><CENTER><INPUT NAME="Register" VALUE="Register" TYPE="submit"></CENTER></td>
  79. </tr>
  80. </table>
  81. </FORM>
  82. <?php
  83.  
  84. if ($_GET['act'] == 'register')
  85. {
  86. $conn = mysql_connect($mysql_host, $mysql_user, $mysql_pass);
  87. mysql_select_db($mysql_database);
  88. $user = anti_injection($_POST['login']);
  89. $pass1 = anti_injection($_POST['senha1']);
  90. $pass2 = anti_injection($_POST['senha2']);
  91. $email = anti_injection($_POST['email']);
  92. $test = anti_injection($_POST['test']);
  93. $test2 = anti_injection($_POST['test2']);
  94. if (valida(Array($user,$pass1,$pass2,$email,$test,$test2)) == true)
  95. {
  96. if ($pass1 == $pass2)
  97. {
  98. if (ereg("([0-9,a-z,A-Z])", $user))
  99. {
  100. if (ereg("^([0-9,a-z,A-Z]+)([.,_]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2}([0-9,a-z,A-Z])?$", $email))
  101. {
  102. $query = mysql_query("SELECT * FROM accounts WHERE login='$user'");
  103. $num_rows = mysql_num_rows($query);
  104. if ($num_rows == 0)
  105. {
  106. $query = mysql_query("SELECT * FROM accounts WHERE email='$email'");
  107. $num_rows = mysql_num_rows($query);
  108. if ($num_rows == 0)
  109. {
  110. $query = mysql_query("INSERT INTO accounts (login, password, email, status, secquestion, secanswer) VALUES ('$user','$pass1','$email','0','$test','$test2')");
  111. if (!$query)
  112. {
  113. echo ":: Error on trying to register account ::";
  114. }
  115. else
  116. {
  117. echo ":: Your Account has been added , it will be activ in the next 30min ::";
  118. }
  119. }
  120. else
  121. {
  122. echo ":: The Email is alredy in use ::";
  123. }
  124. }
  125. else
  126. {
  127. echo ":: The Accountname is alredy in use ::";
  128. }
  129. }
  130. else
  131. {
  132. echo ":: Invalid Email type ::";
  133. }
  134. }
  135. else
  136. {
  137. echo ":: Use only numbers(0-9) and letters(a-z) ::";
  138. }
  139. }
  140. else
  141. {
  142. echo ":: The password is not equal ::";
  143. }
  144. }
  145. }
  146.  
  147. // Função Anti Injection
  148.  
  149. function anti_injection($sql)
  150. {
  151. $sql = preg_replace(sql_regcase("/(from|select|insert|delete|where|drop table|show tables|#|\*|--|\\\\)/"),"",$sql);
  152. $sql = trim($sql);
  153. $sql = strip_tags($sql);
  154. $sql = addslashes($sql);
  155. return $sql;
  156. }
  157.  
  158. // Verificar Campos Vazios
  159.  
  160. function valida($campos){
  161. foreach($campos as $c){
  162. if(empty($c)){
  163. echo ":: Write all fields ::<br>";
  164. return false;
  165. }else{
  166. return true;
  167. }
  168. }
  169. }
  170. ?>
  171. </div>
  172. </body>
  173. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement