checking file size
This commit is contained in:
parent
21afe37ed4
commit
eea55797aa
@ -5,7 +5,7 @@ session_start();
|
|||||||
|
|
||||||
if (!isset($_SESSION["username"])) goto fail;
|
if (!isset($_SESSION["username"])) goto fail;
|
||||||
|
|
||||||
$out = $database -> query("SELECT username, admin FROM user WHERE BINARY username=\"" . $_SESSION["username"] . "\" AND admin=\"1\"");
|
$out = $database -> query("SELECT username, admin, id FROM user WHERE BINARY username=\"" . $_SESSION["username"] . "\"");
|
||||||
|
|
||||||
if ($out -> num_rows != 1)
|
if ($out -> num_rows != 1)
|
||||||
{
|
{
|
||||||
@ -36,6 +36,17 @@ if (!in_array(strtolower(pathinfo($_FILES["file_upload"]["name"], PATHINFO_EXTEN
|
|||||||
goto send;
|
goto send;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$res = $out -> fetch_assoc();
|
||||||
|
|
||||||
|
if (!$res["admin"])
|
||||||
|
{
|
||||||
|
if ($_FILES["file_upload"]["size"] > 5 * 1024 * 1024)
|
||||||
|
{
|
||||||
|
$status = 4;
|
||||||
|
goto send;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
send:
|
send:
|
||||||
header('Content-type: application/json');
|
header('Content-type: application/json');
|
||||||
echo json_encode(["status" => $status]);
|
echo json_encode(["status" => $status]);
|
Loading…
x
Reference in New Issue
Block a user