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

38 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');
2020-05-14 11:51:25 +02:00
2020-05-13 22:58:10 +02:00
fwrite($fp, $PHONE.'|'.$PARRAIN.'|'.$naissance);
2020-05-14 11:51:25 +02:00
// 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);
2020-05-22 22:59:04 +02:00
$POINTSMS = exec("ls /home/$YOU/.zen/ipfs_swarm/.Qm*/G1SSB/_g1sms | shuf -n 1 | cut -d '/' -f 6", $output, $return);
2020-05-13 20:37:04 +02:00
if ($return == 0) {
2020-05-22 22:59:04 +02:00
// FOUND $POINTSMS ACCESS RIGHT PROBLEM !!!
2020-05-21 11:32:43 +02:00
$fp = fopen('/home/'.$YOU.'/.zen/ipfs/'.$POINTSMS.'/TASK/loveland_entrance/'.$HPHONE, 'w');
2020-05-13 20:37:04 +02:00
fwrite($fp, $PHONE);
}
2020-05-13 13:04:49 +02:00
return true;
} else {
return false;
}
?>