-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsend.php
More file actions
executable file
·36 lines (33 loc) · 765 Bytes
/
send.php
File metadata and controls
executable file
·36 lines (33 loc) · 765 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
<?php
//#########################################################
// Part of project php-IRC-js
//
// xhr_write.php - write command to file "send"
//
// Author: Mario Chorvath - Bedna
// Start 2016
//
// Licence GNU General Public License
// Version 2
// http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
//#########################################################
// Get data from JavaScript
$text = rawurldecode ($_SERVER['HTTP_X_TEXT']);
// Name must be set
if (!isset ($text)) {
echo 'ERROR: Name required';
}
// If file open
if ($handle = fopen ("send", "w")) {
// Write command to file
fwrite ($handle, $text);
fclose ($handle);
// Send data back to JavaScript
echo $text;
flush ();
}
// If error
else {
echo "ERROR open file 'send'";
}
?>