25 lines
587 B
PHP
25 lines
587 B
PHP
<?php
|
|
header("Access-Control-Allow-Origin: *");
|
|
if ( strlen($_REQUEST['code']) == 4 && strlen($_REQUEST['num']) == 10 ) {
|
|
$newNumber = preg_replace('/^0?/', '+33', $_REQUEST['num']);
|
|
|
|
$pinfile = '/tmp/'.$newNumber.'.PIN.auth';
|
|
|
|
if (file_exists($pinfile)) {
|
|
|
|
$authpin = file_get_contents($pinfile);
|
|
|
|
if ( trim($authpin) === trim($_REQUEST['code']) ) {
|
|
echo "OK ".$authpin. " == ".$_REQUEST['code'];
|
|
} else { echo "KO ".$pinfile." != ".$_REQUEST['code']; }
|
|
|
|
} else { echo "KO FILE ".$pinfile; }
|
|
|
|
} else {
|
|
|
|
echo "KO";
|
|
return false;
|
|
}
|
|
?>
|
|
|