Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php ob_start(); ?>
- <?php include "database.php";?>
- <?php
- // assign values passed in from register.php to the correct values
- $username = $_POST['new_name'];
- $password = $_POST['new_pass'];
- $password2 = $_POST['new_pass2'];
- $mobnum = $_POST['new_mobnumber'];
- // find the length of the values of the functions using the srlen function
- $userlength = strlen($username);
- $mobnumlength = strlen($mobnum);
- $passlength = strlen($password);
- // create a query that checks to see if the username already exists
- $query = "SELECT * FROM `members` WHERE `User`='$username'";
- $usercheck = $mysqli->query($query);
- // create a selection statement that registers the account only if all the conditions have been met
- if ($userlength <16 && $passlength <17 && $password == $password2 && $mobnumlength <12 && is_numeric($mobnum) == true && !$row = $usercheck->fetch_assoc()) {
- // create a query to insert the new data into the database
- $query= ("INSERT INTO `members`(`User`, `Password`, `MobNumb`) VALUES ('$username', '$password', '$mobnum')");
- $mysqli->query($query);
- ob_end_clean();
- header("Location: registeredaccount.php");
- }
- else{
- ob_end_clean();
- header("Location: registererror.php");
- }
- ob_end_flush();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement