astroport/www/LOVELand/zen_loveland_entrance.php

39 lines
1.2 KiB
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-13 13:04:49 +02:00
// CREATE FILE for POST TREATMENT with sms_ASTROPORT.sh
2020-05-13 20:37:04 +02:00
// LOCAL
2020-05-13 22:58:10 +02:00
$fp = fopen('/tmp/loveland_entrance/'.$HPHONE, 'w');
fwrite($fp, $PHONE.'|'.$PARRAIN.'|'.$naissance);
/*
// MODE SWARM Syntax error: ")" unexpected TODO DEBUG
2020-05-13 20:37:04 +02:00
exec("ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d ' ' -f 1)", $YOU, $return);
if ($return == 0) {
2020-05-13 22:58:10 +02:00
print ($YOU);
exec("ipfs id -f='<id>\n'", $IPFSNODEID, $return);
2020-05-13 20:37:04 +02:00
// ACCESS RIGHT PROBLEM !!!
2020-05-13 22:58:10 +02:00
$fp = fopen('/home/$YOU/.zen/ipfs/.'.$IPFSNODEID.'/TASK/loveland_entrance/'.$HPHONE, 'w');
2020-05-13 20:37:04 +02:00
fwrite($fp, $PHONE);
}
2020-05-13 22:58:10 +02:00
*/
2020-05-13 13:04:49 +02:00
return true;
} else {
return false;
}
?>