mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-09-18 01:22:08 +00:00
Bugfixing. Adding sanity checks
This commit is contained in:
@@ -1,16 +1,25 @@
|
||||
<?php
|
||||
include "includes.php";
|
||||
PDO_Connect("sqlite:" . "d2im.db");
|
||||
$sql = "SELECT * FROM d2im";
|
||||
$mods = PDO_FetchAll($sql);
|
||||
session_start();
|
||||
include "./_pdo.php";
|
||||
|
||||
if (!empty($_POST)) {
|
||||
$sql = "SELECT * FROM d2im WHERE `modname`='{$_POST['modname']}'";
|
||||
$mod = PDO_FetchRow($sql);
|
||||
|
||||
$_SESSION['modname'] = $mod[modname];
|
||||
$_SESSION['path'] = $mod['path'];
|
||||
header("Location: /");
|
||||
// if config db exists, connect to it and grab list of mods
|
||||
if (file_exists("d2im.db")) {
|
||||
PDO_Connect("sqlite:d2im.db");
|
||||
|
||||
$sql = "SELECT * FROM d2im";
|
||||
$mods = PDO_FetchAll($sql);
|
||||
|
||||
if (!empty($_POST)) {
|
||||
$sql = "SELECT * FROM d2im WHERE `modname`='{$_POST['modname']}'";
|
||||
$mod = PDO_FetchRow($sql);
|
||||
|
||||
$_SESSION['modname'] = $mod['modname'];
|
||||
$_SESSION['path'] = $mod['path'];
|
||||
header("Location: /");
|
||||
}
|
||||
} else {
|
||||
// if config db does not exist, go to config page
|
||||
header("Location: /src/D2Config.php");
|
||||
}
|
||||
?>
|
||||
<!doctype html>
|
||||
|
Reference in New Issue
Block a user