astroport/www/LOVELand/g1sms/sms_loveland.php

42 lines
1.2 KiB
PHP
Raw Permalink Normal View History

<?php
2020-05-13 13:04:49 +02:00
header("Access-Control-Allow-Origin: *");
2020-05-13 20:44:38 +02:00
if ( ! isset($_REQUEST['phone']) ) {
// DEBUG
2020-06-06 02:47:37 +02:00
$_REQUEST['phone'] = "0612345678";
$_REQUEST['parrain'] = "Inconnu";
$_REQUEST['naissance'] = "06-06-2020_12:12";
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-23 03:49:00 +02:00
// CREATE FILE for POST TREATMENT with "g1sms/sms_ASTROPORT.sh"
mkdir("/tmp/loveland_entrance");
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-23 04:07:37 +02:00
fclose($fp);
chmod('/tmp/loveland_entrance/'.$HPHONE, 0777);
2020-06-03 19:17:50 +02:00
echo "<!-- Matomo Tag Manager -->
<script type='text/javascript'>
var _mtm = _mtm || [];
_mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'});
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src='https://piwik.p2p.legal/js/container_XDhfGZPj.js'; s.parentNode.insertBefore(g,s);
</script>
<!-- End Matomo Tag Manager -->";
2020-05-23 04:07:37 +02:00
2020-05-13 13:04:49 +02:00
return true;
} else {
return false;
}
?>