astroport/www/LOVELand/g1sms/sms_loveland.php

29 lines
761 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 sms_ASTROPORT.sh
// LOCAL
$fp = fopen('/tmp/loveland_entrance/'.$HPHONE, 'w');
fwrite($fp, $PHONE.'|'.$PARRAIN.'|'.$naissance);
echo "$PHONE.'|'.$PARRAIN.'|'.$naissance"
return true;
} else {
return false;
}
?>