Save to windows path

This commit is contained in:
color.diff=auto 2021-03-26 12:38:24 -06:00
parent d5817446ff
commit daf501785e

View File

@ -35,11 +35,31 @@ if (!empty($_POST)) {
$path = rtrim($_POST['path'], "\\");
$path = str_replace("\\", "\\\\", $path);
$path .= '\\\\data\\\\global\\\\excel\\\\';
$conf[$modname]['path'] = $path;
$conf[$modname]['modname'] = $modname;
file_put_contents("../d2im.db", serialize($conf));
PDO_Connect("sqlite:../d2im.db");
$sql = "CREATE TABLE IF NOT EXISTS d2im (
modname VARCHAR(255),
path VARCHAR(255)
)";
PDO_Execute($sql);
$sql = '';
if (!is_dir($path)) {
echo '<center><h1 style="font-family:Lato; color:#880000;"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
ERROR: INVALID PATH</h1></center>';
} else {
$_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'";
$res = PDO_FetchAll($sql);
if (empty($res)) {
$sql = "INSERT INTO d2im(modname,path) VALUES(\"$modname\",\"$path\")";
PDO_Execute($sql);
}
header("Location: /processFiles.php");
}
} else {
PDO_Connect("sqlite:../d2im.db");
@ -66,12 +86,10 @@ ERROR: INVALID PATH</h1></center>';
if (empty($res)) {
$sql = "INSERT INTO d2im(modname,path) VALUES(\"$modname\",\"$path\")";
PDO_Execute($sql);
}
}
header("Location: /processFiles.php");
}
}
}
?>
<!doctype html>