-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload2.php
58 lines (48 loc) · 1.38 KB
/
upload2.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
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<?php
if (array_key_exists("fname", $_REQUEST))
{
$fname = trim($_REQUEST["fname"]);
}
else
{
$fname = "begin.txt";
}
if (array_key_exists("uploadData", $_POST))
{
$text = trim($_POST["uploadData"]);
$file = fopen("scenes/" . $fname, "w");
echo "Wrote ";
echo fwrite($file, $text);
echo " bytes.<br/>\r\n";
fclose($file);
touch($fname);
die("Success");
}
?>
<p id="outputT"></p>
<p>Please, please, please hit F5 each time you come to this page. It won't refresh right, and I really don't know why.<br/>
You don't have to hit F5 if you just hit submit query. But if you leave and return. F5 it.</p>
<p id='listOut' class='listOut'></p>
Filename: <?php echo "<input type=\"textbox\" id='filename' value=\"$fname\"/>"; ?><br/>
<input type="button" id="submitButt" value="Save Changes"/>
<script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="js/data/GameState.js"></script>
<script type="text/javascript" src="js/screens/GameScreen.js"></script>
<script type="text/javascript" src="upload.js"></script>
Story files:<br/>
<?php
//get all image files with a .jpg extension.
$files = glob("scenes/*.txt");
//print each file name
foreach($files as $fn)
{
echo $fn . "<br/>";
}
?>
</body>
</html>