dadqwedwdqwewferft
This commit is contained in:
commit
9b582a0272
36
cgi-bin/chat/send.php
Normal file
36
cgi-bin/chat/send.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
//set error reporting
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
if ($_GET["userMessage"] == "") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userName = $_GET["userName"];
|
||||||
|
if ($userName == "") {
|
||||||
|
$userName = "anon";
|
||||||
|
}
|
||||||
|
|
||||||
|
$microtime = microtime();
|
||||||
|
|
||||||
|
//generate message
|
||||||
|
$dateToWrite = date("Y-m-d, H:i:s");
|
||||||
|
$messageToWrite = "<div>" . $userName . " says:<br>" . $_GET["userMessage"]. "<br><p style=\"text-align:right;\"> id=". $microtime . " | " . $dateToWrite . "</p><hr></div>";
|
||||||
|
echo $messageToWrite;
|
||||||
|
|
||||||
|
//generate filename
|
||||||
|
$filename = $microtime . ".php";
|
||||||
|
$filename = "/srv/www/htdocs/chat/messages/" . $filename;
|
||||||
|
//echo $filename;
|
||||||
|
|
||||||
|
//create and write to file
|
||||||
|
$handler = fopen($filename, "w");
|
||||||
|
fwrite($handler, $messageToWrite);
|
||||||
|
fclose($handler);
|
||||||
|
chmod($filename, 0777);
|
||||||
|
|
||||||
|
header("Location: http://filip-nilsen.com/chat");
|
||||||
|
exit();
|
||||||
|
?>
|
33
htdocs/chat/index.php
Normal file
33
htdocs/chat/index.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>fChat</title>
|
||||||
|
<link rel="stylesheet" href="style.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="form">
|
||||||
|
<form action="/cgi-bin/chat/send.php" method="get">
|
||||||
|
Nickname: <input type="text" name="userName"><br>
|
||||||
|
Message:<br>
|
||||||
|
<input type="text" name="userMessage"><br>
|
||||||
|
<input type="submit" value="Send">
|
||||||
|
</form>
|
||||||
|
<hr>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="messages">
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$s = glob("/srv/www/htdocs/chat/messages/*.php");
|
||||||
|
natsort($s);
|
||||||
|
|
||||||
|
foreach ($s as $message) {
|
||||||
|
include $message;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
1
htdocs/chat/messages/0.05126800 1611081779.php
Executable file
1
htdocs/chat/messages/0.05126800 1611081779.php
Executable file
@ -0,0 +1 @@
|
|||||||
|
<div>anon says:<br>microtime();<br><p style="text-align:right;"> id=0.05126800 1611081779 | 2021-01-19, 18:42:59</p><hr></div>
|
1
htdocs/chat/messages/0.35559400 1611081813.php
Executable file
1
htdocs/chat/messages/0.35559400 1611081813.php
Executable file
@ -0,0 +1 @@
|
|||||||
|
<div>anon says:<br><?php echo microtime(); ?><br><p style="text-align:right;"> id=0.35559400 1611081813 | 2021-01-19, 18:43:33</p><hr></div>
|
1
htdocs/chat/messages/0.49178500 1611082436.php
Executable file
1
htdocs/chat/messages/0.49178500 1611082436.php
Executable file
@ -0,0 +1 @@
|
|||||||
|
<div>anon says:<br><?php file_put_contents("test.txt", "Hello :)"); ?><br><p style="text-align:right;"> id=0.49178500 1611082436 | 2021-01-19, 18:53:56</p><hr></div>
|
1
htdocs/chat/messages/0.56387800 1611081792.php
Executable file
1
htdocs/chat/messages/0.56387800 1611081792.php
Executable file
@ -0,0 +1 @@
|
|||||||
|
<div>anon says:<br><?php microtime(); ?><br><p style="text-align:right;"> id=0.56387800 1611081792 | 2021-01-19, 18:43:12</p><hr></div>
|
1
htdocs/chat/messages/0.58398400 1611081706.php
Executable file
1
htdocs/chat/messages/0.58398400 1611081706.php
Executable file
@ -0,0 +1 @@
|
|||||||
|
<div>anon says:<br><?php echo "test "?><br><p style="text-align:right;"> id=0.58398400 1611081706 | 2021-01-19, 18:41:46</p><hr></div>
|
1
htdocs/chat/messages/0.78069700 1611081643.php
Executable file
1
htdocs/chat/messages/0.78069700 1611081643.php
Executable file
@ -0,0 +1 @@
|
|||||||
|
<div>filip says:<br><?php phpinfo(); ?><br><p style="text-align:right;"> id=0.78069700 1611081643 | 2021-01-19, 18:40:43</p><hr></div>
|
7
htdocs/chat/style.css
Normal file
7
htdocs/chat/style.css
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
body {
|
||||||
|
background-color: lightgreen;
|
||||||
|
}
|
||||||
|
|
||||||
|
#messages {
|
||||||
|
background-color: white;
|
||||||
|
}
|
BIN
htdocs/favicon.ico
Normal file
BIN
htdocs/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 302 B |
3
htdocs/index.html
Normal file
3
htdocs/index.html
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<html><body>
|
||||||
|
<h1>It works!</h1>
|
||||||
|
</body></html>
|
10872
htdocs/jquery-3.5.1.js
vendored
Normal file
10872
htdocs/jquery-3.5.1.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
htdocs/robots.txt
Normal file
2
htdocs/robots.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
User-Agent: *
|
||||||
|
Disallow: /
|
Loading…
Reference in New Issue
Block a user