summaryrefslogtreecommitdiff
path: root/blaears.php
blob: 0e0c850a59822c144b7199a27d08b24217ce5265 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
$notset = 0;

if (isset($_POST['url']) && isset($_POST['channel'])) {
  $url = $_POST['url'];
  $channel = preg_replace("/[^a-zA-Z0-9:\/\.]/", "", $_POST['channel']);
  $cmd = "echo -e \"" . $channel . "\nNew file uploaded: " . $url . "\" | /home/smsd/core/msgrelay.bash";
} else {
  $notset = 1;
  $cmd = "echo -e \"theblueroom\nblaears-php received something but it did not have a url and a channel set.\" | /home/smsd/core/msgrelay.bash";
}

file_put_contents('post.txt', "Timestamp: " . date('Y/m/d H:i:s') . " " . date('T') . "\n", FILE_APPEND);
file_put_contents('post.txt', "Remote IP: " . $_SERVER['REMOTE_ADDR'] . "\n", FILE_APPEND);
file_put_contents('post.txt', "Command: " . $cmd . "\n", FILE_APPEND);

if (!$notset) {
  exec($cmd, $output, $retval);
}
file_put_contents('post.txt', "Output: " . print_r($output, true), FILE_APPEND);
file_put_contents('post.txt', "Retval: " . $retval . "\n", FILE_APPEND);
?>