Guest User

Untitled

a guest
Nov 1st, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.43 KB | None | 0 0
  1. <?php
  2. include ("register.htm");
  3.  
  4.  
  5. //form data
  6. if($_SERVER['REQUEST_METHOD'] == "POST") //This code works,nothing else does!
  7. {
  8.     $fullname = strip_tags($_POST['fullname']);
  9.     $username = strip_tags($_POST['username']);
  10.     $password = strip_tags($_POST['password']);
  11.     $repeatpassword = strip_tags($_POST['repeatpassword']);
  12.     $email = strip_tags($_POST['email']);
  13.     $steam = strip_tags($_POST['steam']);
  14.     $xfire = strip_tags($_POST['xfire']);
  15.     $date = date("Y-m-d");
  16.  }
  17.  
  18. if($_SERVER['REQUEST_METHOD'] == "POST")
  19. {
  20. //check for existence
  21.     if ($fullname&&$username&&$password&&$repeatpassword&&$email)
  22.     {
  23.         if ($password==$repeatpassword)
  24.         {
  25.             if (strlen($username)>50||(strlen($username)<6))
  26.             {
  27.                 echo "Length of username is too long";
  28.             }
  29.             else
  30.             {
  31.                 if (strlen($password)<6)
  32.                 {
  33.                     echo "Your password must be of 6 or more characters";
  34.                 }
  35.                 else
  36.                 {
  37.                     $password = md5($password);
  38.                     $repeatpassword = md5($repeatpassword);
  39.                     $connect = mysql_connect("localhost","b3fantastico","password");
  40.                     mysql_select_db("example"); //Select Database
  41.                     $queryreg = mysql_query("INSERT INTO users VALUES ('', '$fullname', '$username', '$password', '$date', '$steam', '$xfire', '$email')") or die(mysql_error());
  42.                     die ("You have been registered");
  43.                 }
  44.             }
  45.         }
  46.         else
  47.             echo "Your passwords do not match";
  48.     }
  49.     else
  50.     echo "Please fill in all fields";
  51. }
  52.  
  53.  
  54. ?>
  55.  
  56. <html>
  57. <p>
Add Comment
Please, Sign In to add comment