I have this code and it shows nothing. I searched for information I did ANOTHER test with
<?php if(isset($_SERVER['HTTP_REFERER'])) {
echo $_SERVER['HTTP_REFERER'];
}
EITHER. I saw in a tutorial that a person if he left here, not me.
print_r($_SERVER)
What can I do since this will help me validate a method mvc driverEjemp
function validate () {
if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') { //Request identified as ajax request
if(@isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']=="http://mydomain/ajaxurl") { //HTTP_REFERER verifica
if( isset($_POST['token']) && $_POST['token'] == $_SESSION['token']) { //verifiacion de token
return true;
} else { return false; }
} else { return false; }
} else { return false; }
}
This I do to validate a method in mvc since I do not want a person to put the url and execute that function from the url. anque investigate that XMLHttpRequest
does not work in all browsers.