Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
418
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.06 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Flying Penguin :: Registration</title>
  5. <?php
  6. //Make sure config.php is in the same folder as this, or else it will not work!
  7. include "config.php";
  8. $dbhost = "$a6331138_cpps";
  9. $dbname = "$a6331138_cpps";
  10. $dbuser = "$a6331138_cpps";
  11. $dbpass = "$parker";
  12. $username = "Fugi7";
  13. $email = "crosbyfan7@live.ca";
  14. $colour = 0;
  15.  
  16. function check_email_address($email) {
  17. if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
  18. return false;
  19. }
  20. $email_array = explode("@", $email);
  21. $local_array = explode(".", $email_array[0]);
  22. for ($i = 0; $i < sizeof($local_array); $i++) {
  23. if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&
  24. ?'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$",
  25. $local_array[$i])) {
  26. return false;
  27. }
  28. }
  29. if (!ereg("^[a-zA-Z0-9]*$", $_POST["username"]) ) {
  30. error('Your username may only contain letters, numbers, and valid characters.');
  31. }
  32.  
  33.  
  34. if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) {
  35. $domain_array = explode(".", $email_array[1]);
  36. if (sizeof($domain_array) < 2) {
  37. return false;
  38. }
  39. for ($i = 0; $i < sizeof($domain_array); $i++) {
  40. if
  41. (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|
  42. ?([A-Za-z0-9]+))$",
  43. $domain_array[$i])) {
  44. return false;
  45. }
  46. }
  47. }
  48. return true;
  49. }
  50. function error($error){
  51. $fullerror = "<h1> An Error Occurred</h1><p>".$error."</p>";
  52. die($fullerror);
  53. }
  54.  
  55.  
  56. mysql_connect($dbhost, $dbuser, $dbpass)or error("Could not connect: ".mysql_error());
  57. mysql_select_db($dbname) or error(mysql_error());
  58.  
  59. if (isset($_POST['submit'])) {
  60.  
  61. if (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] ) {
  62. error('You did not complete all of the required fields');
  63. }
  64. if($_POST['colour'] >= 16){
  65. error('Incorrect Colour');
  66. }
  67.  
  68. if (!get_magic_quotes_gpc()) {
  69. $_POST['username'] = addslashes($_POST['username']);
  70. }
  71. if(ereg("[^A-Za-z0-9_ #$%&'*+/=?^_`{|}~-<>]", $_POST['username'])){
  72. error("Your name is invalid. Please try using letters numbers, and a few special characters");
  73. }
  74. if(substr($_POST['username'], 0,1) == " " || substr(strrev($_POST['username']), 0,1) == " "){
  75. error('Error in Username');
  76. }
  77. $_POST['username'] = mysql_real_escape_string($_POST['username']);
  78. $_POST['pass'] = mysql_real_escape_string($_POST['pass']);
  79. $_POST['colour'] = mysql_real_escape_string($_POST['colour']);
  80. $_POST['email'] = mysql_real_escape_string($_POST['email']);
  81. if (!get_magic_quotes_gpc()) {
  82. $_POST['pass'] = addslashes($_POST['pass']);
  83. $_POST['email'] = addslashes($_POST['email']);
  84. $_POST['colour'] = addslashes($_POST['colour']);
  85. $_POST['username'] = addslashes($_POST['username']);
  86. }
  87. $usercheck = $_POST['username'];
  88. $check = mysql_query("SELECT username FROM $table WHERE username = '$usercheck'")
  89. or error(mysql_error());
  90. $check2 = mysql_num_rows($check);
  91. $mailcheck = $_POST['email'];
  92. $check3= mysql_query("SELECT email FROM $table WHERE email = '$mailcheck'")
  93. or error(mysql_error());
  94. $check4 = mysql_num_rows($check3);
  95. $ipcheck = $_SERVER['REMOTE_ADDR'];
  96. //$check5= mysql_query("SELECT ip FROM ip_bans WHERE ip = '$ipcheck'")
  97. //or error(mysql_error());
  98. //$check6 = mysql_num_rows($check5);
  99. if(check_email_address($_POST['email']) == false){
  100. error("Invalid Email!");
  101. }
  102.  
  103. if ($check2 != 0) {
  104. error('Sorry, the username '.$_POST['username'].' is already in use.');
  105. }
  106. if ($check4 != 0) {
  107. error('Sorry, the email address '.$_POST['email'].' is already in use.');
  108. }
  109. // if ($check6 != 0) {
  110. // error('Sorry, it seems that you are IP banned. If you believe this was a mistake, please contact a staff member on the chat.');
  111. // }
  112.  
  113. if ($_POST['pass'] != $_POST['pass2']) {
  114. error('Your passwords did not match. ');
  115. }
  116. if(strlen($_POST['pass']) <= 3){
  117. error('Your password is too short! ');
  118. }
  119.  
  120.  
  121. $_POST['pass'] = md5($_POST['pass']);
  122. $ip = $_SERVER['REMOTE_ADDR'];
  123. if($ip == "78.144.144.168"){
  124. error("Sorry bro. You quit.");
  125. }
  126.  
  127. $insert = "INSERT INTO $table (`id`, `username`, `nickname`, `email`, `password`, `active`, `ubdate`, `items`, `curhead`, `curface`, `curneck`, `curbody`, `curhands`, `curfeet`, `curphoto`, `curflag`, `colour`, `buddies`, `ignore`, `joindate`, `lkey`, `coins`, `ismoderator`, `rank`, `ips`) VALUES (NULL, '".$_POST['username']."', '".$_POST['username']."', '".$_POST['email']."', '".$_POST['pass']."', '1', '0', '', '0', '0', '0', '0', '0', '0', '0', '0', '".$_POST['colour']."', '', '', CURRENT_TIMESTAMP, '', '1000', '0', '1', '".$ip."')";
  128. $log = "Username: ".$_POST['username']." Pass:".$_POST['pass']." Colour:".$_POST['colour']." Email:".$_POST['email']." IP:".$ip." \n";
  129. $add_member = mysql_query($insert);
  130. ?>
  131.  
  132.  
  133. <h1>You have been registered</h1>
  134. <p>Thank you for registering! You may now login to the game </a>.</p>
  135. <?php }
  136. else { ?>
  137. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
  138. <table border="0">
  139. <tr><td>Username:</td><td>
  140. <input type="text" name="username" maxlength="60">
  141. </td></tr>
  142. <tr><td>Email Address:</td><td>
  143. <input type="text" name="email" maxlength="60">
  144. </td></tr>
  145. <tr><td>Password:</td><td>
  146. <input type="password" name="pass" maxlength="10">
  147. </td></tr>
  148. <tr><td>Confirm Password:</td><td>
  149. <input type="password" name="pass2" maxlength="10">
  150. </td></tr>
  151. <tr><td>Colour:</td><td>
  152. <select name="colour" id="colour">
  153. <option value="1" selected="true">Blue</option>
  154. <option value="2">Green</option>
  155. <option value="3">Pink</option>
  156. <option value="4">Black</option>
  157. <option value="5">Red</option>
  158. <option value="6">Orange</option>
  159. <option value="7">Yellow</option>
  160. <option value="8">Dark Purple</option>
  161. <option value="9">Brown</option>
  162. <option value="10">Peach</option>
  163. <option value="11">Dark Green</option>
  164. <option value="12">Light Blue</option>
  165. <option value="13">Light Green</option>
  166. <option value="14">Gray</option>
  167. <option value="15">Aqua</option>
  168. </select>
  169. </td></tr>
  170. <tr><th colspan=2><input type="submit" name="submit"
  171. value="Register"></th></tr> </table>
  172. </form>
  173. <?php
  174. } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement