Guest User

Untitled

a guest
Apr 9th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.53 KB | None | 0 0
  1. <!DOCTYPE html>
  2.  
  3. <html>
  4.  
  5. <head>
  6.  
  7. <title>Penguin Elite :: Registration</title>
  8.  
  9. <?php
  10.  
  11. //Make sure config.php is in the same folder as this, or else it will not work!
  12.  
  13. // include "config.php";
  14.  
  15. $dbhost = "localhost";
  16.  
  17. $dbname = "inetcp";
  18.  
  19. $dbuser = "root";
  20.  
  21. $dbpass = "";
  22.  
  23. $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";
  24.  
  25. $email = "thisisafakeinvalidemailanddoesnotworksoenteryouremailwhensigningup";
  26.  
  27. $colour = 1;
  28.  
  29.  
  30.  
  31. function check_email_address($email) {
  32.  
  33. if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
  34.  
  35. return false;
  36.  
  37. }
  38.  
  39. $email_array = explode("@", $email);
  40.  
  41. $local_array = explode(".", $email_array[0]);
  42.  
  43. for ($i = 0; $i < sizeof($local_array); $i++) {
  44.  
  45. if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&
  46.  
  47. ?'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$",
  48.  
  49. $local_array[$i])) {
  50.  
  51. return false;
  52.  
  53. }
  54.  
  55. }
  56.  
  57. if (!ereg("^[a-zA-Z0-9]*$", $_POST["username"]) ) {
  58.  
  59. error('Your username may only contain letters, numbers, and valid characters.');
  60.  
  61. }
  62.  
  63.  
  64.  
  65.  
  66.  
  67. if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) {
  68.  
  69. $domain_array = explode(".", $email_array[1]);
  70.  
  71. if (sizeof($domain_array) < 2) {
  72.  
  73. return false;
  74.  
  75. }
  76.  
  77. for ($i = 0; $i < sizeof($domain_array); $i++) {
  78.  
  79. if
  80.  
  81. (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|
  82.  
  83. ?([A-Za-z0-9]+))$",
  84.  
  85. $domain_array[$i])) {
  86.  
  87. return false;
  88.  
  89. }
  90.  
  91. }
  92.  
  93. }
  94.  
  95. return true;
  96.  
  97. }
  98.  
  99. function error($error){
  100.  
  101. $fullerror = "<h1> An Error Occurred</h1><p>".$error."</p>";
  102.  
  103. die($fullerror);
  104.  
  105. }
  106.  
  107.  
  108.  
  109.  
  110.  
  111. mysql_connect("localhost", "root", "")or error("Could not connect: ".mysql_error());
  112.  
  113. mysql_select_db("inetcp") or error(mysql_error());
  114.  
  115.  
  116.  
  117. if (isset($_POST['submit'])) {
  118.  
  119.  
  120.  
  121. if (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] ) {
  122.  
  123. error('You did not complete all of the required fields');
  124.  
  125. }
  126.  
  127. if($_POST['colour'] >= 16){
  128.  
  129. error('Incorrect Colour');
  130.  
  131. }
  132.  
  133.  
  134.  
  135. if (!get_magic_quotes_gpc()) {
  136.  
  137. $_POST['username'] = addslashes($_POST['username']);
  138.  
  139. }
  140.  
  141. if(ereg("[^A-Za-z0-9_ #$%&'*+/=?^_`{|}~-<>]", $_POST['username'])){
  142.  
  143. error("Your name is invalid. Please try using letters numbers, and a few special characters");
  144.  
  145. }
  146.  
  147. if(substr($_POST['username'], 0,1) == " " || substr(strrev($_POST['username']), 0,1) == " "){
  148.  
  149. error('Error in Username');
  150.  
  151. }
  152.  
  153. $_POST['username'] = mysql_real_escape_string($_POST['username']);
  154.  
  155. $_POST['pass'] = mysql_real_escape_string($_POST['pass']);
  156.  
  157. $_POST['colour'] = mysql_real_escape_string($_POST['colour']);
  158.  
  159. $_POST['email'] = mysql_real_escape_string($_POST['email']);
  160.  
  161. if (!get_magic_quotes_gpc()) {
  162.  
  163. $_POST['pass'] = addslashes($_POST['pass']);
  164.  
  165. $_POST['email'] = addslashes($_POST['email']);
  166.  
  167. $_POST['colour'] = addslashes($_POST['colour']);
  168.  
  169. $_POST['username'] = addslashes($_POST['username']);
  170.  
  171. }
  172.  
  173. $usercheck = $_POST['username'];
  174.  
  175. $check = mysql_query("SELECT username FROM $table WHERE username = '$usercheck'")
  176.  
  177. or error(mysql_error());
  178.  
  179. $check2 = mysql_num_rows($check);
  180.  
  181. $mailcheck = $_POST['email'];
  182.  
  183. $check3= mysql_query("SELECT email FROM $table WHERE email = '$mailcheck'")
  184.  
  185. or error(mysql_error());
  186.  
  187. $check4 = mysql_num_rows($check3);
  188.  
  189. $ipcheck = $_SERVER['REMOTE_ADDR'];
  190.  
  191. //$check5= mysql_query("SELECT ip FROM ip_bans WHERE ip = '$ipcheck'")
  192.  
  193. //or error(mysql_error());
  194.  
  195. //$check6 = mysql_num_rows($check5);
  196.  
  197. if(check_email_address($_POST['email']) == false){
  198.  
  199. error("Invalid Email!");
  200.  
  201. }
  202.  
  203.  
  204.  
  205. if ($check2 != 0) {
  206.  
  207. error('Sorry, the username '.$_POST['username'].' is already in use.');
  208.  
  209. }
  210.  
  211. if ($check4 != 0) {
  212.  
  213. error('Sorry, the email address '.$_POST['email'].' is already in use.');
  214.  
  215. }
  216.  
  217. // if ($check6 != 0) {
  218.  
  219. // error('Sorry, it seems that you are IP banned. If you believe this was a mistake, please contact a staff member on the chat.');
  220.  
  221. // }
  222.  
  223.  
  224.  
  225. if ($_POST['pass'] != $_POST['pass2']) {
  226.  
  227. error('Your passwords did not match. ');
  228.  
  229. }
  230.  
  231. if(strlen($_POST['pass']) <= 3){
  232.  
  233. error('Your password is too short! ');
  234.  
  235. }
  236.  
  237.  
  238.  
  239.  
  240.  
  241. $_POST['pass'] = md5($_POST['pass']);
  242.  
  243. $ip = $_SERVER['REMOTE_ADDR'];
  244.  
  245. if($ip == "78.144.144.168"){
  246.  
  247. error("Sorry bro. You quit.");
  248.  
  249. }
  250.  
  251.  
  252.  
  253. $insert = "INSERT INTO ps_users (`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."')";
  254.  
  255. $log = "Username: ".$_POST['username']." Pass:".$_POST['pass']." Colour:".$_POST['colour']." Email:".$_POST['email']." IP:".$ip." \n";
  256.  
  257. $add_member = mysql_query($insert);
  258.  
  259. ?>
  260.  
  261.  
  262.  
  263.  
  264.  
  265. <h1>You have been registered</h1>
  266.  
  267. <p>Thank you for registering! You may now login to the game </a>.</p>
  268.  
  269. <?php }
  270.  
  271. else { ?>
  272.  
  273. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
  274.  
  275. <table border="0">
  276.  
  277. <tr><td>Username:</td><td>
  278.  
  279. <input type="text" name="username" maxlength="60">
  280.  
  281. </td></tr>
  282.  
  283. <tr><td>Email Address:</td><td>
  284.  
  285. <input type="text" name="email" maxlength="60">
  286.  
  287. </td></tr>
  288.  
  289. <tr><td>Password:</td><td>
  290.  
  291. <input type="password" name="pass" maxlength="10">
  292.  
  293. </td></tr>
  294.  
  295. <tr><td>Confirm Password:</td><td>
  296.  
  297. <input type="password" name="pass2" maxlength="10">
  298.  
  299. </td></tr>
  300.  
  301. <tr><td>Colour:</td><td>
  302.  
  303. <select name="colour" id="colour">
  304.  
  305. <option value="1" selected="true">Blue</option>
  306.  
  307. <option value="2">Green</option>
  308.  
  309. <option value="3">Pink</option>
  310.  
  311. <option value="4">Black</option>
  312.  
  313. <option value="5">Red</option>
  314.  
  315. <option value="6">Orange</option>
  316.  
  317. <option value="7">Yellow</option>
  318.  
  319. <option value="8">Dark Purple</option>
  320.  
  321. <option value="9">Brown</option>
  322.  
  323. <option value="10">Peach</option>
  324.  
  325. <option value="11">Dark Green</option>
  326.  
  327. <option value="12">Light Blue</option>
  328.  
  329. <option value="13">Light Green</option>
  330.  
  331. <option value="14">Gray</option>
  332.  
  333. <option value="15">Aqua</option>
  334.  
  335. </select>
  336.  
  337. </td></tr>
  338.  
  339. <tr><th colspan=2><input type="submit" name="submit"
  340.  
  341. value="Register"></th></tr> </table>
  342.  
  343. </form>
  344.  
  345. <?php
  346.  
  347. } ?>
Add Comment
Please, Sign In to add comment