D2Config lastused column added

This commit is contained in:
color.diff=auto 2021-03-30 06:22:53 -06:00
parent 728a398ed1
commit 3eadaac01e

View File

@ -50,7 +50,7 @@ if (!empty($_POST)) {
$modname = str_replace(' ', '', $_POST['modname']);
$_SESSION['modname'] = $modname;
$time = time();
// write the D2Modder.db file and replace \ with \\
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$path = rtrim($_POST['path'], "\\");
@ -60,7 +60,8 @@ if (!empty($_POST)) {
PDO_Connect("sqlite:../D2Modder.db");
$sql = "CREATE TABLE IF NOT EXISTS D2Modder (
modname VARCHAR(255),
path VARCHAR(255)
path VARCHAR(255),
lastused INT
)";
PDO_Execute($sql);
@ -74,10 +75,11 @@ ERROR: INVALID PATH</h1></center>';
$_SESSION['path'] = $path;
// Don't yell at me, security is the least of my considerations atm
// check modname in db
$sql = "SELECT * FROM D2Modder WHERE modname='$modname'";
$sql = "SELECT * FROM `D2Modder` WHERE `modname`='$modname'";
$res = PDO_FetchAll($sql);
if (empty($res)) {
$sql = "INSERT INTO D2Modder(modname,path) VALUES(\"$modname\",\"$path\")";
$sql = "INSERT INTO D2Modder(`modname`,`path`,`lastused`) VALUES(\"$modname\",\"$path\",$time)";
PDO_Execute($sql);
}
header("Location: /processFiles.php");
@ -87,7 +89,8 @@ ERROR: INVALID PATH</h1></center>';
$sql = "CREATE TABLE IF NOT EXISTS D2Modder (
modname VARCHAR(255),
path VARCHAR(255)
path VARCHAR(255),
lastused INT
)";
PDO_Execute($sql);
@ -104,10 +107,10 @@ ERROR: INVALID PATH</h1></center>';
$_SESSION['path'] = $path;
// Don't yell at me, security is the least of my considerations atm
// check modname in db
$sql = "SELECT * FROM D2Modder WHERE modname='$modname'";
$sql = "SELECT * FROM `D2Modder` WHERE modname='$modname'";
$res = PDO_FetchAll($sql);
if (empty($res)) {
$sql = "INSERT INTO D2Modder(modname,path) VALUES(\"$modname\",\"$path\")";
$sql = "INSERT INTO `D2Modder` (`modname`,`path`,`lastused`) VALUES(\"$modname\",\"$path\",$time)";
PDO_Execute($sql);
}
header("Location: /processFiles.php");