Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(isset($_POST['user_login']) && isset($_POST['password_login'])){
- $user_login = preg_replace('#[^A-Za-z0-9]#i', '', $_POST['user_login']);
- $password_login = preg_replace('#[^A-Za-z0-9]#i', '', $_POST['password_login']);
- $password_login_md5 = md5($password_login);
- $sql = $databaseConnection->prepare('SELECT id,username,password, FROM users WHERE username = :user_login, password = ":password_login_md5"');
- $sql->bindParam(':user_login', $user_login);
- $sql->bindParam(':password_login_md5', $password_login_md5);
- $sql->execute();
- $userCount = $sql->rowCount();
- foreach($userCount as $row){
- if($row > 0){
- $id = $row['id'];
- }
- $_SESSION["user_login"] = $user_login;
- header("Location: index.php");
- exit();
- }else{
- echo "That information is incorrect, try again";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement