Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.08 KB | None | 0 0
  1. <?php
  2. /*
  3.  * File         : process.php
  4.  * Location     : alpha.alexmckechnie.com/includes/process.php
  5.  * File Version : 0.0.1ALPHA
  6.  * Author       : Alex J. Mckechnie
  7.  *
  8.  * PLEASE NOTE ANY OUTPUT FROM THIS PAGE IS FOR DEBUGGING PURPOSES
  9.  *          AND WILL BE REMOVED IN THE FINAL VERSION
  10.  *
  11.  */
  12.  
  13. //This stops SQL Injection in POST vars
  14.   foreach ($_POST as $key => $value) {
  15.     $_POST[$key] = mysql_real_escape_string($value);
  16.   }
  17.  
  18. //This stops SQL Injection in GET vars
  19.   foreach ($_GET as $key => $value) {
  20.     $_GET[$key] = mysql_real_escape_string($value);
  21.   }
  22.  
  23. #Decalre Some Global Variables
  24. $key = 'removed_for_security_concerns';
  25. $username = $_POST["username"];
  26. $password = $_POST["password"];
  27. $passconf = $_POST["passconf"];
  28. $email = $_POST["email"];
  29. $allowemail = $_POST["allowemail"];
  30. $time = time();
  31. $ipaddress = $_SERVER['REMOTE_ADDR'];
  32.  
  33.  
  34. function register()
  35. {
  36.     /*
  37.      * Validates Data, Encrpts Password, Inserts into database, Sets session info.
  38.      */
  39.     IF(!$username){$error['username'] = "The Username field was left empty.";}
  40.     IF(!$password){$error['password'] = "The Password field was left empty.";}
  41.     IF(!$passconf){$error['passconf'] = "The Confirm Password field was left empty.";}
  42.     IF(!$email){$error['email'] = "You must provide an email address to register.";}
  43.     IF(($password)!=($passconf))
  44.         {
  45.             IF($error['password'])
  46.               {$error['password'] .= "<br />Your password's did not match. Please try again.";}
  47.             ELSE
  48.               {$error['password'] = "Your password's did not match. Please try again.";}
  49.         }
  50.     If($error)
  51.         {
  52.             die;
  53.         } else {
  54.             $password = sha1($password . $key);
  55.             $query = "INSERT INTO `users` (`userID`, `username`, `password`, `jointime`, `lastonline`, `emailaddress`, `allowemail`, `usergroup`, `ipaddress`, `pastips`, `banned`, `banreason`, `admincomments`) VALUES (NULL, '$username', '$password', '$time', '$time', '$email', '$allowemail', 'member', '$ipaddress', '$ipaddress', '0', NULL, NULL)";
  56.         }
  57.  }
  58. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement