diff --git a/index.php b/index.php index 3bf944e..d45e080 100644 --- a/index.php +++ b/index.php @@ -12,10 +12,14 @@ if ( isset($_REQUEST['sortorder']) ) { $validext = array('cbr', 'cbz'); +if ( $_SESSION['compath'] == "" ) $_SESSION['compath'] = "/"; if ( isset($_REQUEST['newpath']) ) { - $comicfull = realpath(COMICSDIR . base64_decode(urldecode($_REQUEST['newpath']))); - if ( ($comicfull === false) || (substr($comicfull, 0, strlen(COMICSDIR)) != COMICSDIR) ) $_SESSION['compath'] = "/"; - $_SESSION['compath'] = substr($comicfull, strlen(COMICSDIR)); + $comicfull = realpath(COMICSDIR . urldecode($_REQUEST['newpath'])); + if ( ($comicfull === false) || (substr($comicfull, 0, strlen(COMICSDIR)) != COMICSDIR) ) { + $_SESSION['compath'] = "/"; + } else { + $_SESSION['compath'] = substr($comicfull, strlen(COMICSDIR)); + } } $compath = $_SESSION['compath'];