astroport/www/LOVELand/g1sms/sms_loveland.php

30 lines
799 B
PHP
Raw Normal View History

2020-05-13 13:04:49 +02:00
<?php
header("Access-Control-Allow-Origin: *");
2020-05-13 20:44:38 +02:00
if ( ! isset($_REQUEST['phone']) ) {
// DEBUG
2020-05-13 22:58:10 +02:00
$_REQUEST['phone'] = "0647683646";
$_REQUEST['parrain'] = "Fred";
$_REQUEST['naissance'] = "21-03-1972_18:04";
2020-05-13 20:44:38 +02:00
}
2020-05-13 22:58:10 +02:00
2020-05-13 13:07:45 +02:00
if (strlen($_REQUEST['phone']) == 10 ) {
2020-05-13 13:04:49 +02:00
// Replace leading 0 with +33
2020-05-13 20:37:04 +02:00
$PHONE = preg_replace('/^0?/', '+33', $_REQUEST['phone']);
2020-05-13 22:58:10 +02:00
$PARRAIN = $_REQUEST['parrain'];
$naissance = $_REQUEST['naissance'];
2020-05-13 13:04:49 +02:00
// HASH NUMBER
2020-05-13 20:37:04 +02:00
$HPHONE=hash('sha256', $PHONE);
2020-05-23 03:49:00 +02:00
// CREATE FILE for POST TREATMENT with "g1sms/sms_ASTROPORT.sh"
mkdir("/tmp/loveland_entrance");
2020-05-13 22:58:10 +02:00
$fp = fopen('/tmp/loveland_entrance/'.$HPHONE, 'w');
2020-05-14 11:51:25 +02:00
2020-05-13 22:58:10 +02:00
fwrite($fp, $PHONE.'|'.$PARRAIN.'|'.$naissance);
2020-05-23 03:49:00 +02:00
echo "$PHONE.'|'.$PARRAIN.'|'.$naissance";
2020-05-13 13:04:49 +02:00
return true;
} else {
return false;
}
?>