Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.46 KB | None | 0 0
  1. <?php
  2. $dbhost = "db4free.net";
  3. $dbname = "membership";
  4. $dbuser ="********";
  5. $dbpass = "******";
  6. $table = "g_users";
  7. $username = "This Name Is Too Long And Will Not Work With The Game So It Is Invalid So Enter A Real Username That Is Valid When Signing Up";
  8. $email = "thisisafakeinvalidemailanddoesnotworksoenteryouremailwhensigningup";
  9. $colour = 1;
  10.  
  11. function check_email_address($email) {
  12. if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
  13. return false;
  14. }
  15. $email_array = explode("@", $email);
  16. $local_array = explode(".", $email_array[0]);
  17. for ($i = 0; $i < sizeof($local_array); $i++) {
  18. if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&
  19. ?'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$",
  20. $local_array[$i])) {
  21. return false;
  22. }
  23. }
  24.  
  25.  
  26. if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) {
  27. $domain_array = explode(".", $email_array[1]);
  28. if (sizeof($domain_array) < 2) {
  29. return false;
  30. }
  31. for ($i = 0; $i < sizeof($domain_array); $i++) {
  32. if
  33. (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|
  34. ?([A-Za-z0-9]+))$",
  35. $domain_array[$i])) {
  36. return false;
  37. }
  38. }
  39. }
  40. return true;
  41. }
  42. function error($error){
  43. $fullerror = "<h1><FONT FACE=\"arial\" COLOR=\"white\">We have found an error!</FONT></h1><p><FONT FACE=\"arial\" COLOR=\"white\">".$error."</FONT></p>";
  44. die($fullerror);
  45. }
  46.  
  47.  
  48. mysql_connect($dbhost, $dbuser, $dbpass)or error("Could not connect: ".mysql_error());
  49. mysql_select_db($dbname) or error(mysql_error());
  50.  
  51. if (isset($_POST['submit'])) {
  52.  
  53. if (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] ) {
  54. error('You did not complete all of the required fields');
  55. }
  56. if($_POST['colour'] >= 16){
  57. error('That color is not an in game color!');
  58. }
  59.  
  60. if (!get_magic_quotes_gpc()) {
  61. $_POST['username'] = addslashes($_POST['username']);
  62. }
  63. if(ereg("[^A-Za-z0-9_ #$&'*+/=?^_`{}~-<>]", $_POST['username'])){
  64. error("Your name is invalid. Please try using letters numbers, and a few special characters");
  65. }
  66. if (!preg_match('/[a-z0-9 ]/i', $_POST['username'])) {
  67. error("Your name is invalid. Please try using letters numbers, and a few special characters");
  68. }
  69. if (preg_match('/[|]/i', $_POST['username'])) {
  70. error("Your name is invalid. Please try using letters numbers, and a few special characters");
  71. }
  72. if (preg_match('/[%]/i', $_POST['username'])) {
  73. error("Your name is invalid. Please try using letters numbers, and a few special characters");
  74. }
  75. if(substr($_POST['username'], 0,1) == " " || substr(strrev($_POST['username']), 0,1) == " "){
  76. error('Error in Username');
  77. }
  78. $_POST['username'] = mysql_real_escape_string($_POST['username']);
  79. $_POST['pass'] = mysql_real_escape_string($_POST['pass']);
  80. $_POST['colour'] = mysql_real_escape_string($_POST['colour']);
  81. $_POST['email'] = mysql_real_escape_string($_POST['email']);
  82. if (!get_magic_quotes_gpc()) {
  83. $_POST['pass'] = addslashes($_POST['pass']);
  84. $_POST['email'] = addslashes($_POST['email']);
  85. $_POST['colour'] = addslashes($_POST['colour']);
  86. $_POST['username'] = addslashes($_POST['username']);
  87. }
  88. $usercheck = $_POST['username'];
  89. $check = mysql_query("SELECT username FROM $table WHERE username = '$usercheck'")
  90. or error(mysql_error());
  91. $check2 = mysql_num_rows($check);
  92. if(check_email_address($_POST['email']) == false){
  93. error("Invalid Email!");
  94. }
  95.  
  96. if ($check2 != 0) {
  97. error('Sorry, the username '.$_POST['username'].' is already in use.');
  98. }
  99.  
  100. if ($_POST['pass'] != $_POST['pass2']) {
  101. error('Your passwords did not match. ');
  102. }
  103. if(strlen($_POST['pass']) <= 5){
  104. error('Your password is too short! It needs to be 5 caracteres or over, as this minimizes the risk of stolen passwords.');
  105. }
  106. if(strlen($_POST['username']) <= 3){
  107. error('Your username is too short! ');
  108. }
  109.  
  110. $_POST['pass'] = strtoupper(hash('md5', $_POST['pass']));
  111.  
  112. if($_POST['colour'] == "r"){
  113. $_POST['colour'] = rand(1,15);
  114. }
  115. $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`, `igloo`, `floor`, `furniture`,) VALUES (NULL, '".$_POST['username']."', '".$_POST['username']."', '".$_POST['email']."', '".$_POST['pass']."', '1', '0', '', '0', '0', '0', '0', '0', '0', '0', '0', '".$_POST['colour']."', '', '', CURRENT_TIMESTAMP, '', '1000000', '0', '1', '".$ip."')";
  116. //$log = "Username: ".$_POST['username']." Pass:".$_POST['pass']." Colour:".$_POST['colour']." Email:".$_POST['email']." IP:".$ip." \n";
  117. //file_put_contents("log.txt", $log, FILE_APPEND | LOCK_EX);
  118. $add_member = mysql_query($insert);
  119. ?>
  120.  
  121. <h1><FONT FACE="arial" COLOR="##000000">Thanks For Registering</FONT></h1>
  122. <p><FONT FACE="arial" COLOR="##000000">Now Get OFF THIS PAGE & START PLAYING!</FONT></p>
  123. <p><FONT FACE="arial" COLOR="##000000"><small><small>Powered By Ghetto Penguin</small></small></FONT></p>
  124. <?php }
  125. else { ?>
  126. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
  127. <table border="0">
  128. <tr><td><FONT FACE="arial" COLOR="#000000">Username:</FONT></td><td>
  129. <input type="text" name="username" maxlength="60">
  130. </td></tr>
  131. <tr><td><FONT FACE="arial" COLOR="#000000">Email Address:</FONT></td><td>
  132. <input type="text" name="email" maxlength="60">
  133. </td></tr>
  134. <tr><td><FONT FACE="arial" COLOR="#000000">Password:</FONT></td><td>
  135. <input type="password" name="pass" maxlength="10">
  136. </td></tr>
  137. <tr><td><FONT FACE="arial" COLOR="#000000">Confirm Password:</FONT></td><td>
  138. <input type="password" name="pass2" maxlength="10">
  139. </td></tr>
  140. <tr><td><FONT FACE="arial" COLOR="#000000">Color:</FONT></td><td>
  141. <select name="colour" id="colour">
  142. <option value="0" selected="true">Random</option>
  143. <option value="1" >Blue</option>
  144. <option value="2">Green</option>
  145. <option value="3">Pink</option>
  146. <option value="4">Black</option>
  147. <option value="5">Red</option>
  148. <option value="6">Orange</option>
  149. <option value="7">Yellow</option>
  150. <option value="8">Dark Purple</option>
  151. <option value="9">Brown</option>
  152. <option value="10">Peach</option>
  153. <option value="11">Dark Green</option>
  154. <option value="12">Light Blue</option>
  155. <option value="13">Light Green</option>
  156. <option value="14">Gray</option>
  157. <option value="15">Aqua</option>
  158. </select>
  159. </td></tr>
  160. <tr><th colspan=2><input type="submit" name="submit"
  161. value="Register"></th></tr> </table>
  162. </form>
  163. <?php
  164. } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement