Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if($_SERVER['REQUEST_METHOD']=="GET") {
- session_start();
- if (isset($_SESSION["user"])){
- header('Location: home.php');
- }
- else{
- http_login_page();
- }
- }
- else {
- require("dbconnection.php");
- $usernameQuery = $db->query("SELECT * FROM users WHERE login = '{$_POST['user']}'");
- $tableau = Array();
- $tableau = $usernameQuery->fetchArray(SQLITE3_ASSOC);
- if ($tableau == false){
- http_login_page();
- http_login_page_fail();
- }else{
- if ($tableau['nb_errors']==2){
- http_login_page();
- http_login_page_fail();
- http_login_page_warning();
- }else{
- if ($tableau['password']!="{$_POST['password']}"){
- $db->exec("UPDATE users SET nb_errors = nb_errors + 1 WHERE login='{$_POST["user"]}'");
- http_login_page();
- http_login_page_fail();
- }
- if ($tableau['password']=="{$_POST['password']}" and $tableau[disabled]==0 and $tableau['blocked']==0){
- $_SESSION['user']="{$_POST['user']}";
- $_SESSION['firstname']=$tableau['firstname'];
- $_SESSION['lastname']=$tableau['lastname'];
- header('Location: home.php');
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement