Add cookie for compath so it recovers from a login expiration better
This commit is contained in:
parent
6afdaeda78
commit
a3765e8eee
|
|
@ -34,7 +34,13 @@ function compareNames($a, $b) {
|
|||
$adultcomics = getAdultComics();
|
||||
|
||||
$compath = $_SESSION['compath'];
|
||||
$fullcompath = COMICSDIR . (($compath == "/") ? "" : $compath) . "/";
|
||||
$fullcompath = COMICSDIR . $compath . (($compath == "/") ? "" : "/") . "/";
|
||||
if ( !is_dir($fullcompath) ) {
|
||||
$compath = "/";
|
||||
$fullcompath = COMICSDIR . $compath . (($compath == "/") ? "" : "/") . "/";
|
||||
$_SESSION['compath'] = $compath;
|
||||
setcookie("compath", $compath, time()+31536000, "/", "jaj.com", true);
|
||||
}
|
||||
|
||||
// Build up a list of comics and issues which have been read in descending order by lastupdate
|
||||
$query = "SELECT comic, issue FROM pagetracker WHERE username=:username";
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ if ( ($newpath == "/") || ($comicfull === false) || (substr($comicfull, 0, strle
|
|||
} else {
|
||||
$_SESSION['compath'] = substr($comicfull, strlen(COMICSDIR));
|
||||
}
|
||||
setcookie("compath", $_SESSION['compath'], time()+31536000, "/", "jaj.com", true);
|
||||
$data["message"] = "New comic path: {$_SESSION["compath"]}";
|
||||
$pathparts = pathinfo($_SESSION['compath']);
|
||||
|
||||
|
|
|
|||
11
header.php
11
header.php
|
|
@ -23,9 +23,16 @@ if ( php_sapi_name() != "cli" ) {
|
|||
// This session variable is set to the current browsing folder.
|
||||
// It is relative to the COMICSDIR constant defined in config.php
|
||||
if ( !isset($_SESSION['compath']) ) {
|
||||
$_SESSION['compath'] = '/';
|
||||
if ( isset($_COOKIE['compath']) ) {
|
||||
$_SESSION['compath'] = $_COOKIE['compath'];
|
||||
} else {
|
||||
$_SESSION['compath'] = '/';
|
||||
}
|
||||
}
|
||||
if ( $_SESSION['compath'] == "" ) {
|
||||
$_SESSION['compath'] = "/";
|
||||
setcookie("compath", $_SESSION['compath'], time()+31536000, "/", "jaj.com", true);
|
||||
}
|
||||
if ( $_SESSION['compath'] == "" ) $_SESSION['compath'] = "/";
|
||||
|
||||
// This session variable is set to the current comic in Base64
|
||||
if ( !isset($_SESSION['comfile']) ) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user