Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $db = mysqli_connect("localhost", "root", "", "authentication");
- if(isset($_POST['register_btn']))
- {
- $username = mysql_real_escape_string($_POST['username']);
- $password = mysql_real_escape_string($_POST['password']);
- $password2 = mysql_real_escape_string($_POST['password2']);
- if ($password == $password2 )
- {
- $password = md5($password);
- $sql = "INSERT INTO users(username, password) VALUES('$username', '$password')";
- mysqli_query($db, $sql);
- $_SESSION['message'] = "You are now logged in";
- $_SESSION['username'] = $username;
- header("location: home.php");
- }else
- {
- $_SESSION['message'] = "The two passwords do not match";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement