mirror of
https://gitlab.com/JKANetwork/CheckServer.git
synced 2026-02-27 23:43:46 +01:00
Optimize index and fix delete older checks from hist
This commit is contained in:
16
login.php
16
login.php
@@ -4,13 +4,13 @@ require "functions.php";
|
||||
if (isset($_GET['do'])){
|
||||
if ($_GET['do'] == 'logout'){
|
||||
require_once "connect.php";
|
||||
dbw_query($db_conn, "UPDATE USERS SET SessionID = NULL WHERE SessionID='$_COOKIE[SessionID]'");
|
||||
setcookie("SessionID", "", time()-3600,"/");
|
||||
//dbw_query($db_conn, "UPDATE USERS SET SessionID = NULL WHERE SessionID='$_COOKIE[SessionID]'");
|
||||
session_destroy();
|
||||
header('Location: index.php');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_COOKIE['SessionID'])){ //Ya está logueado
|
||||
if (isset($_SESSION['UserID'])){ //Ya está logueado
|
||||
header('Location: panel.php');
|
||||
}
|
||||
|
||||
@@ -20,14 +20,12 @@ if (!isset($_POST['nick'])){
|
||||
if (isset($_POST['nick'])){
|
||||
$nick=$_POST['nick'];
|
||||
$pass= hash("sha256",$_POST['pass']);
|
||||
$finalpass = dbw_query_fetch_array($db_conn,"SELECT `Passw` FROM `USERS` WHERE nick ='$nick'");
|
||||
$passcomprobar = $finalpass[0];
|
||||
$resql = dbw_query_fetch_array($db_conn,"SELECT ID_U,`passw` FROM `USERS` WHERE nick ='$nick'");
|
||||
$passcomprobar = $resql['passw'];
|
||||
if ($pass == $passcomprobar)
|
||||
{
|
||||
$sesid = RandomString(12);
|
||||
dbw_query($db_conn, "UPDATE USERS SET SessionID = '$sesid' WHERE nick = '$nick'");
|
||||
setcookie("SessionID",$sesid,"0","/");
|
||||
header('Location: panel.php');
|
||||
$_SESSION['UserID'] = $resql['ID_U'];
|
||||
header('Location: panel.php');
|
||||
}else{
|
||||
echo $twig->render('login.twig', array('status' => 'error'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user