Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $_SESSION['message'] = '';
- $mysqli = new mysqli('localhost','root','','users');
- $alert = false;
- if ($_SERVER['REQUEST_METHOD'] == 'POST'){
- $username = $mysqli->real_escape_string($_POST['username']);
- $password = md5($_POST['password']);
- $sql = "SELECT * FROM `users`.`users` WHERE username=`$username` and password=`$password`";
- if ($mysqli->query($sql) === true){
- $_SESSION['message'] = 'Login!';
- header('Location: http://localhost/index.html');
- exit();
- }
- else{
- $_SESSION['message'] = "Username or password incorrect!";
- $alert = true;
- }
- }
- else{
- $_SESSION['message'] = "Something went wrong!";
- $alert = true;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement