Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ($_POST[register]) {
- // the above line checks to see if the html form has been submitted
- $username = $_POST[username];
- $password = $_POST[pass];
- $cpassword = $_POST[cpass];
- $email = $_POST[email];
- //the above lines set variables with the user submitted information
- if($username==NULL||$password==NULL||$cpassword==NULL||$email==NULL||$paypal==NULL||$country==NULL) {
- //checks to make sure no fields were left blank
- $notice = "A field was left blank.";
- }else{
- //none were left blank! We continue...
- if($password != $cpassword) {
- // the passwords are not the same!
- $notice = "Passwords do not match";
- }else{
- // the passwords are the same! we continue...
- //$password = md5($password);
- $password = password_hash("$password", PASSWORD_DEFAULT);
- // encrypts the password
- $checkname = mysql_query("SELECT username FROM users WHERE username='$username'");
- $checkname= mysql_num_rows($checkname);
- $checkemail = mysql_query("SELECT email FROM users WHERE email='$email'");
- $checkemail = mysql_num_rows($checkemail);
- if ($checkemail>0|$checkname>0) {
- // oops...someone has already registered with that username or email!
- $notice = "The username or email is already in use";
- }else{
- // noone is using that email or username! We continue...
- $query = mysql_query("INSERT INTO users (username, password, email) VALUES('$username','$password','$email')");
- // inserts the information into the database.
- $lasterror = error_get_last(); $lasterror = $lasterror['message']." on line ".$lasterror['line'];
- $danewuserid = mysql_insert_id();
- //conversions
- echo "
- ";
- if ($query === true) { $notice = "You have successfully registered! Now you can login."; }
- else { $notice = "An error occured when signing up. $lasterror Use the email form to report this."; }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement