astroport/www/LOVELand/g1sms/code_sms.php

25 lines
587 B
PHP
Raw Permalink Normal View History

2020-05-10 22:11:47 +02:00
<?php
header("Access-Control-Allow-Origin: *");
2020-06-09 21:45:18 +02:00
if ( strlen($_REQUEST['code']) == 4 && strlen($_REQUEST['tel']) == 10 ) {
$newNumber = preg_replace('/^0?/', '+33', $_REQUEST['tel']);
2020-05-23 05:02:11 +02:00
2020-05-10 22:11:47 +02:00
$pinfile = '/tmp/'.$newNumber.'.PIN.auth';
2020-05-23 05:02:11 +02:00
2020-05-10 22:11:47 +02:00
if (file_exists($pinfile)) {
2020-05-23 05:02:11 +02:00
2020-05-10 22:11:47 +02:00
$authpin = file_get_contents($pinfile);
2020-05-23 05:02:11 +02:00
2020-05-10 22:11:47 +02:00
if ( trim($authpin) === trim($_REQUEST['code']) ) {
echo "OK ".$authpin. " == ".$_REQUEST['code'];
} else { echo "KO ".$pinfile." != ".$_REQUEST['code']; }
2020-05-23 05:02:11 +02:00
2020-05-10 22:11:47 +02:00
} else { echo "KO FILE ".$pinfile; }
2020-05-23 05:02:11 +02:00
2020-05-10 22:11:47 +02:00
} else {
2020-05-23 05:02:11 +02:00
2020-05-10 22:11:47 +02:00
echo "KO";
return false;
}
?>