Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <? include "Config/config.php";
- session_start();
- if(isset($_POST['submit'])){
- $username = (isset($_POST['username']))? $_POST['username'] : die("Please input a username!");
- $password = (isset($_POST['password']))? md5($_POST['password']):die("Please input a password");
- if($stmt = $mysqli->prepare("SELECT username,id,role FROM users WHERE username = ? AND password = ? LIMIT = 1" ))
- $stmt->bind_param("ss",$username,$password);
- $stmt->execute();
- $res = $stmt->get_result();
- if($res->num_rows > 0){
- while($row = $res->fetch_assoc()){
- $_SESSION['username'] = $row['username'];
- $_SESSION['id'] = $row['id'];
- $_SESSION['role'] = $row['role'];
- header('location: dashboard.php');
- exit();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement