-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload.php
executable file
·68 lines (59 loc) · 2.3 KB
/
upload.php
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php require "PHP/stdConfig.php"; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Upload | Sanatree</title>
<?php require "PHP/stdHeader.php"; ?>
<?php
$tempDir = "TEMP/";
if($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["submit"])) {
$check = getimagesize($_FILES["analysisImage"]["tmp_name"]);
$randNum = mt_rand();
if($check !== false) {
$target_file = $tempDir . $randNum . "_" . $_FILES["analysisImage"]["name"];
move_uploaded_file($_FILES["analysisImage"]["tmp_name"], $target_file);
$queueSource = "TEMP/DCSQueue.txt";
$queueFile = fopen($queueSource, "a");
fwrite($queueFile, "https://sanatree.tech/" . $target_file . PHP_EOL);
fclose($queueFile);
}
}
?>
<style type="text/css">
</style>
</head>
<body onload="initResponsive()" onresize="initResponsive()">
<?php require_once "PHP/navbar.php"; ?>
<div class="wrapper" id="body-wrapper">
<div class="subsection-wrapper wrapper">
<div class="subsection">
<div class="title">Analyzed Requests</div>
<p>
Please go easy on our developers, this page is still being worked on.
</p>
<form enctype="multipart/form-data" method="POST" action='<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>' id="fileForm">
<p>
Upload New Task<br/>
<input type="file" name="analysisImage" id="analysisImage"/><br />
<input type="submit" value="Upload" name="submit">
</p>
</form>
</div>
</div>
<div class="subsection-wrapper wrapper">
<div class="subsection">
<?php
$resultsFile = fopen("TEMP/cDCSRequests.txt", "r");
$even = true;
while($data = fgets($resultsFile)){
echo $even ? "<p>$data" : "$data</p>";
$even = !$even;
}
fclose($resultsFile);
?>
</div>
</div>
</div>
<?php require_once "PHP/footer.php"; ?>
</body>
</html>