astroport/www/LOVELand/zen_loveland_entrance.php

31 lines
912 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
$_REQUEST['phone']="0647683646"
}
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 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
$fp = fopen('/tmp/loveland_entrance/'.$HPHONE, 'a');
fwrite($fp, $PHONE);
// SWARM
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) {
exec("ipfs id -f='<id>\n'", $ipfsnodeid, $return);
// ACCESS RIGHT PROBLEM !!!
$fp = fopen('/home/$YOU/.zen/ipfs/.'.$ipfsnodeid.'/TASK/loveland_entrance/'.$HASH, 'a');
fwrite($fp, $PHONE);
}
2020-05-13 13:04:49 +02:00
return true;
} else {
return false;
}
?>