Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- echo "<h1>Register</h1>";
- //form data
- if($_SERVER['REQUEST_METHOD'] == "POST") //This code works,nothing else does!
- {
- $fullname = strip_tags($_POST['fullname']);
- $username = strip_tags($_POST['username']);
- $password = strip_tags($_POST['password']);
- $repeatpassword = strip_tags($_POST['repeatpassword']);
- $email = strip_tags($_POST['email']);
- $steam = strip_tags($_POST['steam']);
- $xfire = strip_tags($_POST['xfire']);
- $date = date("Y-m-d");
- }
- if($_SERVER['REQUEST_METHOD'] == "POST")
- //Check for existance
- if ($username&&$password&&$repeatpassword&&$fullname&&$email)
- {
- if ($password==$repeatpassword)
- {
- }
- else
- echo "Your passwords do not match";
- //Encrypt password
- $password = md5($password);
- $repeatpassword = md5($repeatpassword);
- //Check character length of username and fullname
- if (strlen($username)>25||strlen($fullname)>25)
- {
- echo "Length of username or fullname is too long!";
- }
- else
- {
- //Open database
- $connect = mysql_connect("localhost","b3fantastico","password");
- mysql_select_db("example"); //Select database
- $queryreg = mysql_query("INSERT INTO users VALUES ('', '$fullname', '$username', '$password', '$email', '$steam', '$xfire', '$date')") or die(mysql_error());
- die ("You have been registered!<a href='index.php'Click here to return!</a>");
- }
- else
- echo ("Please fill in all the fields");
Add Comment
Please, Sign In to add comment