SHARE
TWEET

Untitled

a guest Oct 23rd, 2017 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. echo "<h1>Register</h1>";
  3.  
  4. //form data
  5. if($_SERVER['REQUEST_METHOD'] == "POST") //This code works,nothing else does!
  6. {
  7. $fullname = strip_tags($_POST['fullname']);
  8. $username = strip_tags($_POST['username']);
  9. $password = strip_tags($_POST['password']);
  10. $repeatpassword = strip_tags($_POST['repeatpassword']);
  11. $email = strip_tags($_POST['email']);
  12. $steam = strip_tags($_POST['steam']);
  13. $xfire = strip_tags($_POST['xfire']);
  14. $date = date("Y-m-d");
  15.  
  16. }
  17.  
  18. if($_SERVER['REQUEST_METHOD'] == "POST")
  19.  
  20. //Check for existance
  21. if ($username&&$password&&$repeatpassword&&$fullname&&$email)
  22. {
  23.  
  24. if ($password==$repeatpassword)
  25. {
  26.  
  27. }
  28. else
  29.    echo "Your passwords do not match";
  30.  
  31. //Encrypt password
  32.  
  33. $password = md5($password);
  34. $repeatpassword = md5($repeatpassword);
  35.    
  36.    
  37. //Check character length of username and fullname
  38. if (strlen($username)>25||strlen($fullname)>25)
  39. {
  40.  echo "Length of username or fullname is too long!";
  41. }
  42. else
  43. {
  44.  
  45. //Open database
  46. $connect = mysql_connect("localhost","b3fantastico","password");
  47. mysql_select_db("example"); //Select database
  48.  
  49. $queryreg = mysql_query("INSERT INTO users VALUES ('', '$fullname', '$username', '$password', '$email', '$steam', '$xfire', '$date')") or die(mysql_error());
  50.  
  51.  
  52. die ("You have been registered!<a href='index.php'Click here to return!</a>");
  53.  
  54.  
  55. }
  56. else
  57.    echo ("Please fill in all the fields");
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top