ComicsViewer/ajax/setpath.php

26 lines
587 B
PHP

<?php
require "../header.php";
require_login();
if ( !isset($_REQUEST['path']) ) exit();
$data = array();
$data["error"] = false;
$data["message"] = "";
$comicfull = realpath(COMICSDIR . urldecode($_REQUEST['path']));
if ( ($comicfull === false) || (substr($comicfull, 0, strlen(COMICSDIR)) != COMICSDIR) ) {
$_SESSION['compath'] = "/";
} else {
$_SESSION['compath'] = substr($comicfull, strlen(COMICSDIR));
}
$data["message"] = "New comic path: {$_SESSION["compath"]}";
header('Content-Type: application/json');
echo json_encode($data);
exit();
// vim: set ts=4 sw=4 et: