Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if(isset($_POST['firstname']) && !empty($_POST['firstname']) AND isset($_POST['lastname']) && !empty($_POST['lastname']) AND isset($_POST['username']) && !empty($_POST['username']) AND isset($_POST['password']) && !empty($_POST['password']) AND isset($_POST['confirm_password']) && !empty($_POST['confirm_password']) AND isset($_POST['email']) && !empty($_POST['email']))
- {
- $firstname = $_POST['firstname'];
- $lastname = $_POST['lastname'];
- $email = $_POST['email'];
- $username = $_POST['username'];
- $password = $_POST['password'];
- $ERROR = false;
- if (!filter_var($email, FILTER_VALIDATE_EMAIL)){
- echo("The email you have entered is invalid, please try again.");
- }else{
- if ($_POST["password"] == $_POST["confirm_password"])
- {
- $password = $_POST['password'];
- $db = mysqli_connect('localhost','root','','reg');
- $query = "INSERT INTO user (firstname, lastname, username, password, email)
- VALUES('$firstname','$lastname','$username' ,'$password', '$email')";
- mysqli_query($db, $query);
- $_SESSION['username'] = $username;
- $_SESSION['success'] = "You have now registered";
- $ERROR = false;
- header('location: index.php');
- }
- else{
- $ERROR = true;
- }
- }
- }
- else{
- echo("All Areas must be filled");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement