I need to block the access of a page in Php directly accessed by the url
I need to block the access of a page in Php directly accessed by the url
With this code you prevent direct access:
if (strcmp(basename($_SERVER['SCRIPT_NAME']), basename(__FILE__)) === 0) {
header("location: index.php");
}