mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-10-13 08:24:24 -05:00
testing changes
This commit is contained in:
50
index.php
50
index.php
@@ -43,7 +43,7 @@ session_start();
|
||||
|
||||
*/
|
||||
|
||||
ini_set('display_errors',1);
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL ^ E_WARNING);
|
||||
ini_set('log_errors', 1);
|
||||
|
||||
@@ -60,7 +60,7 @@ if (!isset($_SESSION['modname']) || (!file_exists(APP_DB)) || (!file_exists($_SE
|
||||
$sql = "SELECT * FROM D2Modder ORDER BY lastused DESC LIMIT 1";
|
||||
|
||||
$lastUsedMod = PDO_FetchRow($sql);
|
||||
|
||||
|
||||
$_SESSION['modname'] = $lastUsedMod['modname'];
|
||||
$_SESSION['path'] = $lastUsedMod['path'];
|
||||
|
||||
@@ -84,9 +84,7 @@ if (!isset($_SESSION['modname']) || (!file_exists(APP_DB)) || (!file_exists($_SE
|
||||
require_once './src/D2Files.php';
|
||||
require_once './src/D2TxtParser.php';
|
||||
require_once './src/D2ItemDesc.php';
|
||||
|
||||
|
||||
|
||||
|
||||
$idesc = new D2ItemDesc();
|
||||
$db = new D2Database();
|
||||
$parser = new D2TxtParser();
|
||||
@@ -109,11 +107,9 @@ if (!isset($_SESSION['modname']) || (!file_exists(APP_DB)) || (!file_exists($_SE
|
||||
|
||||
$prop = $parser->filterProps('Properties.txt');
|
||||
|
||||
|
||||
// If there's data, process it and save
|
||||
if (!empty($_POST)) {
|
||||
|
||||
// save db name from post into conf file
|
||||
// save db name from post into conf file... why?
|
||||
|
||||
require_once './src/D2SaveFile.php';
|
||||
$saver = new D2SaveFile();
|
||||
@@ -135,6 +131,19 @@ if (!isset($_SESSION['modname']) || (!file_exists(APP_DB)) || (!file_exists($_SE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// last 3 items are not in d2 txt, rid of them
|
||||
// why did I set formtype? I can't rememer, need to comment code more
|
||||
|
||||
|
||||
/*
|
||||
|
||||
*
|
||||
*
|
||||
* Unique Items Form was posted here
|
||||
*
|
||||
*/
|
||||
|
||||
if ($_POST['formtype'] == "uniqueitems") {
|
||||
|
||||
unset($post['formtype']);
|
||||
@@ -150,19 +159,30 @@ if (!isset($_SESSION['modname']) || (!file_exists(APP_DB)) || (!file_exists($_SE
|
||||
}
|
||||
|
||||
|
||||
$sql = "SELECT rowid,`index` from `uniqueitems` WHERE `index`='{$post['index']}'";
|
||||
$res = PDO_FetchRow($sql);
|
||||
|
||||
$sql = "SELECT rowid,`index` from `uniqueitems` WHERE `index`=\"{$post['index']}\"";
|
||||
|
||||
$res = PDO_FetchRow($sql);
|
||||
|
||||
if ($res['index'] == $post['index']) {
|
||||
$sql = "UPDATE `uniqueitems` SET ";
|
||||
foreach ($post as $k => $v) {
|
||||
$sql .= "`$k`='$v',";
|
||||
$sql .= "`$k`=\"$v\",";
|
||||
}
|
||||
$sql = rtrim($sql, ",");
|
||||
$sql .= " WHERE `index`='{$post['index']}'";
|
||||
$x = PDO_Execute($sql);
|
||||
ddump($x);
|
||||
} else {
|
||||
$sql .= ' WHERE `index`="'.$post['index'].'"';
|
||||
|
||||
|
||||
|
||||
PDO_Execute($sql, [$post['index']]);
|
||||
//ddump($x);
|
||||
}
|
||||
/*
|
||||
*
|
||||
*
|
||||
* Set Items Form was posted here
|
||||
*
|
||||
*/ else {
|
||||
|
||||
$sql = "INSERT INTO `uniqueitems` (";
|
||||
foreach ($post as $k => $v) {
|
||||
|
Reference in New Issue
Block a user