-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjsonSave.php
More file actions
48 lines (44 loc) · 970 Bytes
/
jsonSave.php
File metadata and controls
48 lines (44 loc) · 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
session_start();
require_once "connect.php";
require_once "jsonValidate.php";
require_once "captcha.php";
require_once "dbController.php";
if (isset($_POST["sanitizeXSS"]) && $_POST["sanitizeXSS"] != "true")
{
header("Location: cwaniak.php");
exit();
}
if (!isset($_POST["captcha"]) || Captcha::Verify($_POST["captcha"]))
{
echo "nocaptcha";
exit();
}
if (isset($_POST['JSON']) && $_POST['JSON'] != false)
{
$bitmap = Validator::GetObjFromInput($_POST['JSON']);
if (!($bitmap instanceof Bitmap))
{
echo "E: $bitmap";
exit();
}
$ip = $bitmap->ip;
$bitmap->ip = "0.0.0.0";
$JSON = json_encode($bitmap);
$_SESSION['JSON'] = $JSON;
$res = DbController::InsertJSON($JSON,
$bitmap->bitRate, $bitmap->rows, $bitmap->author, $bitmap->description, $ip);
if ($res === true)
{
echo $JSON;
}
else
{
echo "E: $res";
exit();
}
}
else
{
echo "";
}