35 lines
912 B
PHP
35 lines
912 B
PHP
<?php
|
|
header("Access-Control-Allow-Origin: *");
|
|
if ( ! isset($_REQUEST['phone']) ) {
|
|
// DEBUG
|
|
$_REQUEST['phone'] = "0647683646";
|
|
$_REQUEST['parrain'] = "Fred";
|
|
$_REQUEST['naissance'] = "21-03-1972_18:04";
|
|
}
|
|
|
|
if (strlen($_REQUEST['phone']) == 10 ) {
|
|
// Replace leading 0 with +33
|
|
$PHONE = preg_replace('/^0?/', '+33', $_REQUEST['phone']);
|
|
$PARRAIN = $_REQUEST['parrain'];
|
|
$naissance = $_REQUEST['naissance'];
|
|
// HASH NUMBER
|
|
$HPHONE=hash('sha256', $PHONE);
|
|
|
|
// CREATE FILE for POST TREATMENT with "g1sms/sms_ASTROPORT.sh"
|
|
mkdir("/tmp/loveland_entrance");
|
|
$fp = fopen('/tmp/loveland_entrance/'.$HPHONE, 'w');
|
|
|
|
fwrite($fp, $PHONE.'|'.$PARRAIN.'|'.$naissance);
|
|
fclose($fp);
|
|
|
|
chmod('/tmp/loveland_entrance/'.$HPHONE, 0777);
|
|
|
|
echo 'LOVELAND ENTRANCE RECEIVED FROM '.$PHONE.'|'.$PARRAIN.'|'.$naissance;
|
|
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
?>
|
|
|