Latest changes. Refactor. Multi row insertion. Querying working. DB creation of all txt files. Serialized config. TODO, configure multiple mod directory feature

This commit is contained in:
color.diff=auto
2021-03-26 08:37:56 -06:00
parent 4d4afd5be4
commit b28a59c313
15 changed files with 130 additions and 249 deletions

View File

@@ -19,19 +19,30 @@
along with D2IM. If not, see <http://www.gnu.org/licenses/>.
*/
require_once './D2Functions.php';
if (!empty($_POST)) {
$modname = str_replace(' ', '', $_POST['modname']);
// write the d2im.conf file and replace \ with \\
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$path = rtrim($_POST['path'], "\\");
$path = str_replace("\\", "\\\\", $path);
$path = str_replace("\\", "\\\\", $path);
$path .= '\\\\data\\\\global\\\\excel\\\\';
file_put_contents("../d2im.conf", $path);
$conf['path'] = $path;
$conf['modname'] = $modname;
file_put_contents("../d2im.conf", serialize($path));
} else {
file_put_contents("../d2im.conf", $_POST['path'] . DIRECTORY_SEPARATOR);
$conf['path'] = $_POST['path'].DIRECTORY_SEPARATOR;
$conf['modname'] = $modname;
file_put_contents("../d2im.conf", serialize($conf));
}
header('Location: /wait.php');
header("Location: /processFiles.php");
}
?>
<!doctype html>
@@ -40,26 +51,36 @@ if (!empty($_POST)) {
/* Require the <head> section */
require_once "head.php";
?>
<body style="text-align: center; background: white;">
<div class="container container-top">
<body style="background: white;">
<div class="center container container-top">
<h1><img src="/img/Diablo2.png" style="float:left">D2 Item Maker, v3. By HashCasper</h1>
<a class="btn btn-outline-danger" style="color:red; font-size: 18px;float:right;" href="/">X</a>
<hr style="margin: 60px;">
<div class="offset-2 col-8">
<h2>Select Mod folder</h2>
<p style="font-family: lato">Example: D:\Diablo II\MODS\you-mod-name\</p>
<p style="font-family: lato">Input path to D2 Mod Directory.</p>
<div style="margin-top: 20px;" class="ctrl-config">
<form enctype="multipart/form-data" style="font-family: Lato; font-size: 14pt;" action="" method="post">
<label for="path">Choose PATH</label>
<input id="path" style="width: 420px;" required="required" name="path" type="text">
<input type="submit" value="Save" name="submit" class="btn-config">
<form enctype="multipart/form-data" style="font-family: Lato; font-size: 14pt;" action="" method="post">
<p>
<label for="path">Enter Mod Name</label><br>
<input id="path" style="width: 220px;" required="required" name="modname" type="text">
</p>
<p>
<label for="path">Enter PATH </label><span style="font-size:11px;">(D:\Diablo II\MODS\your-mod-name)</span><br>
<input id="path" style="width: 420px;" required="required" name="path" type="text">
<input type="submit" value="Save" name="submit" class="btn-config">
</p>
</form>
</div>
<div id="loading" style="">
</div>
<div id="loading" class="offset-2 col-8 alert alert-warning">
<p style="font-family: Lato;">After saving path, app will convert txt files to SQL database.</p>
<p style="font-family: Lato;">This may take a few minutes depending on the size of your txt files. <br>Please be patient. Once done, app will load. <br>Each time you set a new mod path, txt files will be processed.</p>
<p style="font-family: Lato;">This may take a few minutes depending on the size of your txt files. <br>Please be patient. Once done, app will load. <br>Each time you set a new mod path, txt files will be processed.
<br> Every mod will be saved to ModName.db.
</p>
</div>
</div>