-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchat.php
More file actions
30 lines (24 loc) · 850 Bytes
/
chat.php
File metadata and controls
30 lines (24 loc) · 850 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
<?
# this is the interface to shared chat log
# default chat log is:
$chatlog = "txt.txt";
if (!empty($_GET))
{
if (!empty($_GET["user"]) && !empty($_GET["chat"]))
{
#$linetoadd = $_GET["user"] & " " & $_GET["chat"];
$linetoadd = strval($_GET["user"]) . ": " . strval($_GET["chat"]);
system("if ! test -f \"".$chatlog."\"; then touch ".$chatlog."; fi");
system ("echo ". escapeshellarg(escapeshellcmd($linetoadd)) . " >> ".$chatlog."");
if($_GET["chat"] == "super_secret_code_to_delete_chat_log") {
system("rm ".$chatlog.";date >> last_completed;echo \"\" > ".$chatlog."");
}
#system ("tail -n 11 txt.txt.temp > txt.txt");
#system ("cat txt.txt.temp > txt.txt");
#exec("tail -n 11 txt.txt", $log);
#file_put_contents('txt.txt', implode(PHP_EOL, $log) . PHP_EOL);
#echo strval($_GET["user"]);
}
}
#system('ls '.escapeshellarg($dir));
?>