Mod switching fixed

This commit is contained in:
color.diff=auto 2021-05-03 04:15:48 -06:00
parent ad0ed9be30
commit 13568c5b74
3 changed files with 6 additions and 10 deletions

View File

@ -43,25 +43,21 @@ session_start();
*/ */
ini_set('display_errors', 0); ini_set('display_errors',1);
error_reporting(E_ALL ^ E_WARNING); error_reporting(E_ALL ^ E_WARNING);
ini_set('log_errors', 0); ini_set('log_errors', 1);
include "./_pdo.php"; include "./_pdo.php";
include "./config.php"; include "./config.php";
if (empty($_SESSION['modname'])) {
}
if (!isset($_SESSION['modname']) || (!file_exists(APP_DB)) || (!file_exists($_SESSION['modname'] . ".db"))) { if (!isset($_SESSION['modname']) || (!file_exists(APP_DB)) || (!file_exists($_SESSION['modname'] . ".db"))) {
// first load, no active mod, go to switchmods to select mod // first load, no active mod, go to switchmods to select mod
header("Location: /switchMods.php"); header("Location: /switchMods.php");
} else { } else {
PDO_Connect("sqlite:" . APP_DB); PDO_Connect("sqlite:" . APP_DB);
$sql = "SELECT * FROM D2Modder ORDER BY lastused LIMIT 1"; $sql = "SELECT * FROM D2Modder ORDER BY lastused DESC LIMIT 1";
$lastUsedMod = PDO_FetchRow($sql); $lastUsedMod = PDO_FetchRow($sql);

View File

@ -40,7 +40,6 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
session_start();
require_once 'header.php'; // loads head.php inside. Further loads D2UM/SM require_once 'header.php'; // loads head.php inside. Further loads D2UM/SM
require_once 'footer.php'; require_once 'footer.php';

View File

@ -69,6 +69,7 @@ if (file_exists(APP_DB)) {
PDO_Execute($sql); PDO_Execute($sql);
$_SESSION['modname'] = $mod['modname']; $_SESSION['modname'] = $mod['modname'];
$_SESSION['path'] = $mod['path']; $_SESSION['path'] = $mod['path'];
header("Location: /"); header("Location: /");
} }
} }