1
0
Fork 0
astroport/www/LOVELand/zen_loveland_entrance.php

38 lines
1.2 KiB
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);
// MODE SWARM : write
$YOU = exec("ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1", $output, $return);
$POINTSMS = exec("ls /home/$YOU/.zen/ipfs_swarm/.Qm*/G1SSB/_g1sms | shuf -n 1 | cut -d '/' -f 6", $output, $return);
if ($return == 0) {
// FOUND $POINTSMS ACCESS RIGHT PROBLEM !!!
$fp = fopen('/home/'.$YOU.'/.zen/ipfs/'.$POINTSMS.'/TASK/loveland_entrance/'.$HPHONE, 'w');
fwrite($fp, $PHONE);
}
return true;
} else {
return false;
}
?>