mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-10-13 08:24:24 -05:00
Bugfixing. Adding sanity checks
This commit is contained in:
49
index.php
49
index.php
@@ -1,17 +1,17 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
/*
|
||||
D2UniqueMaker
|
||||
D2IM
|
||||
GPLv2 (C) <2021> <HashCasper>
|
||||
|
||||
This file is part of D2UM.
|
||||
This file is part of D2IM.
|
||||
|
||||
D2UM 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.
|
||||
|
||||
D2UM is distributed in the hope that it will be useful,
|
||||
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.
|
||||
@@ -24,30 +24,37 @@ ini_set('display_errors', 1);
|
||||
error_reporting(1);
|
||||
ini_set('log_errors', 1);
|
||||
|
||||
include "includes.php";
|
||||
include "./_pdo.php";
|
||||
|
||||
if (file_exists("d2im.db") && (file_exists($_SESSION['modname'].".db"))){
|
||||
if (!isset($_SESSION['modname'])
|
||||
|| (!file_exists("d2im.db"))
|
||||
|| (!file_exists($_SESSION['modname'] . ".db")))
|
||||
{
|
||||
// first load, no active mod, go to switchmods to select mod
|
||||
header("Location: /switchMods.php");
|
||||
} else {
|
||||
define('FILTER_PROPERTIES_FILE', 'filterProperties.txt');
|
||||
define('DB_FILE', $_SESSION['modname'] . ".db");
|
||||
define('TXT_PATH', $_SESSION['path']);
|
||||
|
||||
require_once "./src/D2Functions.php";
|
||||
require_once "./src/D2Database.php";
|
||||
require_once './src/D2Files.php';
|
||||
require_once './src/D2TxtParser.php';
|
||||
|
||||
if (is_dir($_SESSION['path'])) {
|
||||
define('TXT_PATH', $_SESSION['path']);
|
||||
} else {
|
||||
header('Location: /src/D2Config.php');
|
||||
}
|
||||
|
||||
$db = new D2Database();
|
||||
$parser = new D2TxtParser();
|
||||
|
||||
|
||||
$armor = PDO_FetchAll('SELECT * FROM armor WHERE `spawnable`=1');
|
||||
$weapon = PDO_FetchAll('SELECT * FROM weapons WHERE `spawnable`=1');
|
||||
|
||||
|
||||
$prop = $parser->filterProps('Properties.txt');
|
||||
|
||||
|
||||
// If there's data, process it and save
|
||||
if (!empty($_POST)) {
|
||||
|
||||
|
||||
// save db name from post into conf file
|
||||
|
||||
|
||||
require_once './src/D2SaveFile.php';
|
||||
$saver = new D2SaveFile();
|
||||
|
||||
@@ -66,8 +73,8 @@ if (file_exists("d2im.db") && (file_exists($_SESSION['modname'].".db"))){
|
||||
|
||||
|
||||
if ($_POST['formtype'] == "uniqueitems") {
|
||||
|
||||
|
||||
|
||||
|
||||
// if ladder or carry1 is 0, set empty field.
|
||||
if (!$post['ladder']) {
|
||||
$post['ladder'] = '';
|
||||
@@ -85,9 +92,7 @@ if (file_exists("d2im.db") && (file_exists($_SESSION['modname'].".db"))){
|
||||
}
|
||||
|
||||
|
||||
// load app
|
||||
// load app
|
||||
require_once './src/index.php';
|
||||
} else {
|
||||
header('Location: ./src/D2Config.php');
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user