Config DB renamed/refactored to D2Modder.db

This commit is contained in:
color.diff=auto
2021-03-28 03:22:23 -06:00
parent 867a0409e1
commit a174bc4992
5 changed files with 72 additions and 44 deletions

View File

@@ -42,43 +42,23 @@
*/
session_start();
/*
*
GPLv2 (C) <2021> <HashCasper>
This file is part of D2IM.
D2IM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
D2IM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with D2IM. If not, see <http://www.gnu.org/licenses/>.
*/
require_once './D2Functions.php';
require_once './D2Database.php';
require_once '../_pdo.php';
include "../config.php";
if (!empty($_POST)) {
$modname = str_replace(' ', '', $_POST['modname']);
$_SESSION['modname'] = $modname;
// write the d2im.conf file and replace \ with \\
// write the D2Modder.db file and replace \ with \\
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$path = rtrim($_POST['path'], "\\");
$path = str_replace("\\", "\\\\", $path);
$path .= '\\\\data\\\\global\\\\excel\\\\';
PDO_Connect("sqlite:../d2im.db");
$sql = "CREATE TABLE IF NOT EXISTS d2im (
PDO_Connect("sqlite:../D2Modder.db");
$sql = "CREATE TABLE IF NOT EXISTS D2Modder (
modname VARCHAR(255),
path VARCHAR(255)
)";
@@ -94,18 +74,18 @@ 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 d2im WHERE modname='$modname'";
$sql = "SELECT * FROM D2Modder WHERE modname='$modname'";
$res = PDO_FetchAll($sql);
if (empty($res)) {
$sql = "INSERT INTO d2im(modname,path) VALUES(\"$modname\",\"$path\")";
$sql = "INSERT INTO D2Modder(modname,path) VALUES(\"$modname\",\"$path\")";
PDO_Execute($sql);
}
header("Location: /processFiles.php");
}
} else {
PDO_Connect("sqlite:../d2im.db");
PDO_Connect("sqlite:../D2Modder.db");
$sql = "CREATE TABLE IF NOT EXISTS d2im (
$sql = "CREATE TABLE IF NOT EXISTS D2Modder (
modname VARCHAR(255),
path VARCHAR(255)
)";
@@ -124,10 +104,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 d2im WHERE modname='$modname'";
$sql = "SELECT * FROM D2Modder WHERE modname='$modname'";
$res = PDO_FetchAll($sql);
if (empty($res)) {
$sql = "INSERT INTO d2im(modname,path) VALUES(\"$modname\",\"$path\")";
$sql = "INSERT INTO D2Modder(modname,path) VALUES(\"$modname\",\"$path\")";
PDO_Execute($sql);
}
header("Location: /processFiles.php");