Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.13 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_privacy_reasons';
  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)){$usernameerror = "The Username field was left empty."; $error = 1;}
  40.     IF(!($password)){$passworderror = "The Password field was left empty."; $error = 1;}
  41.     IF(!($passconf)){$passconferror = "The Confirm Password field was left empty."; $error = 1;}
  42.     IF(!($email)){$emailerror = "You must provide an email address to register."; $error = 1;}
  43.     IF(($password)!=($passconf))
  44.         {
  45.             IF($passworderror)
  46.               {$passworderror .= "<br />Your password's did not match. Please try again."; $error = 1;}
  47.             ELSE
  48.               {$passworderror = "Your password's did not match. Please try again."; $error = 1;}
  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