Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ($_SERVER['REQUEST_METHOD'] == 'POST'){
- //two passwords are the same
- if($_POST['password'] == $_POST['confirmedpassword']) {
- $username = $mysqli->real_escape_string($_POST['username']);
- $password = md5($_POST['password']);
- $_SESSION['username'] = $username;
- $_SESSION['password'] = $password;
- $sql = "INSERT INTO members(username, password)"
- . "VALUES ('$username','$password')";
- //if querey is successful redirect to login.php
- if($mysqli->query($sql) === true)
- $_SESSION['message'] = 'Success';
- header("location: login.php");
- }
- else{
- $_SESSION['message'] = "User couldnt be added";
- }
- }
- else{
- $_SESSION['message'] = "Passwords dont match";
- }
Add Comment
Please, Sign In to add comment