qo-op 2021-06-11 04:59:47 +02:00
parent 579825ad75
commit ddff87cd7c
1 changed files with 43 additions and 0 deletions

43
www/sendsms.php Normal file
View File

@ -0,0 +1,43 @@
<?php
$locale = 'fr_FR.utf-8';
setlocale(LC_ALL, $locale);
putenv('LC_ALL='.$locale);
header("X-Robots-Tag: noindex, nofollow", true);
$token = (string)$_GET['token'];
// TODO :token VERIFY xzuid.
$data = array();
if (!$token || $token != 'azerty') {
$data = array(
'error' => "Not authorised",
'error_code' => 403,
'error_description' => "Not authorised",
'resource' => null
);
echo json_encode($data);
header('HTTP/1.0 403 Forbidden');
exit;
}
$message = urldecode((string)$_GET['message']);
$number = (string)$_GET['number'];
$number_array = explode('-', $number);
if (!$message || !$number_array) {
$data = array(
'error' => "Missing data",
'error_code' => 403,
'error_description' => "Missing data",
'resource' => null
);
echo json_encode($data);
header('HTTP/1.0 403 Forbidden');
exit;
}
foreach ($number_array as $number) {
exec('echo "'.$message.'" | gammu --sendsms TEXT '.$number.' &');
}