dont start session if not necessary
This commit is contained in:
parent
87c9f9d188
commit
068b17f48e
2 changed files with 7 additions and 3 deletions
|
@ -6,8 +6,11 @@ include_once("config.php");
|
|||
// Include utils to have access to custom classes
|
||||
include_once("utils.php");
|
||||
|
||||
// Start session
|
||||
// If the session cookie is set, start session
|
||||
if(isset($_COOKIE["PHPSESSID"]))
|
||||
{
|
||||
session_start();
|
||||
}
|
||||
|
||||
// PDO Mysql connection object
|
||||
$conn = null;
|
||||
|
|
|
@ -93,10 +93,11 @@ function attempt_login($conn, $username, $password) {
|
|||
}
|
||||
|
||||
/**
|
||||
* If user sent the form, process it.
|
||||
* If user sent the form, process it. This starts a session.
|
||||
* Either login user and redirect to index or set error message variables.
|
||||
*/
|
||||
if (isset($_POST["submit"])) {
|
||||
session_start();
|
||||
// Log user out
|
||||
$_SESSION["current_user"] = null;
|
||||
// Attempt to log in
|
||||
|
|
Loading…
Reference in a new issue