Skip to content

Commit

Permalink
Fix sql create table bug
Browse files Browse the repository at this point in the history
  • Loading branch information
YehudaEi authored Nov 14, 2020
1 parent 6f779b4 commit 1e46820
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions SysManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ function printFilesTable($path, $isLogged, $secretMode = false){
<td>-</td>
<?php if($isLogged){ ?>

<th>-</th>
<th>-</th>
<td>-</td>
<td>-</td>
<?php if(DB_MODE){ ?>

<th>Stats</th>
<td>-</td>
<?php } ?>
<?php } ?>

Expand Down Expand Up @@ -485,7 +485,7 @@ function printFilesTable($path, $isLogged, $secretMode = false){
if($DBConn == false || empty($DBConn) || $DBConn->connect_error){}
else{
$DBConn->set_charset = "utf8mb4";
$DBConn->query("CREATE TABLE IF NOT EXIST `downloads` ( `id` INT NOT NULL AUTO_INCREMENT , `path` TEXT NOT NULL , `username` TEXT NOT NULL , `ip` TEXT NOT NULL , `user_agent` TEXT NOT NULL , `referer` TEXT NOT NULL , `language` TEXT NOT NULL , `time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , PRIMARY KEY (`id`)) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;");
$DBConn->query("CREATE TABLE IF NOT EXISTS `downloads` ( `id` INT NOT NULL AUTO_INCREMENT , `path` TEXT NOT NULL , `username` TEXT NOT NULL , `ip` TEXT NOT NULL , `user_agent` TEXT NOT NULL , `referer` TEXT NOT NULL , `language` TEXT NOT NULL , `time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , PRIMARY KEY (`id`)) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_general_ci;");
$DBConn->query("INSERT INTO `downloads` (`id`, `path`, `username`, `ip`, `user_agent`, `referer`, `language`, `time`) VALUES (NULL, '" . $DBConn->real_escape_string($file) . "', '" . $DBConn->real_escape_string($_SESSION['FileServerMngUser']['logged']) . "', '" . $DBConn->real_escape_string($_SERVER['REMOTE_ADDR']) . "', '" . $DBConn->real_escape_string($_SERVER['HTTP_USER_AGENT']) . "', '" . $DBConn->real_escape_string($_SERVER['HTTP_REFERER']) . "', '" . $DBConn->real_escape_string($_SERVER['HTTP_ACCEPT_LANGUAGE']) . "', CURRENT_TIMESTAMP);");
$DBConn->close();
}
Expand Down

0 comments on commit 1e46820

Please sign in to comment.