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,28 +43,24 @@ session_start();
*/
ini_set('display_errors', 0);
ini_set('display_errors',1);
error_reporting(E_ALL ^ E_WARNING);
ini_set('log_errors', 0);
ini_set('log_errors', 1);
include "./_pdo.php";
include "./config.php";
if (empty($_SESSION['modname'])) {
}
if (!isset($_SESSION['modname']) || (!file_exists(APP_DB)) || (!file_exists($_SESSION['modname'] . ".db"))) {
// first load, no active mod, go to switchmods to select mod
header("Location: /switchMods.php");
} else {
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);
$_SESSION['modname'] = $lastUsedMod['modname'];
$_SESSION['path'] = $lastUsedMod['path'];

View File

@ -40,7 +40,6 @@
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 'footer.php';

View File

@ -68,7 +68,8 @@ if (file_exists(APP_DB)) {
$sql = "UPDATE `D2Modder` SET `lastused`=$time WHERE modname='{$_POST['modname']}'";
PDO_Execute($sql);
$_SESSION['modname'] = $mod['modname'];
$_SESSION['path'] = $mod['path'];
$_SESSION['path'] = $mod['path'];
header("Location: /");
}
}