How to block access on a page by url [closed]

2

I need to block the access of a page in Php directly accessed by the url

    
asked by anonymous 08.05.2017 / 06:31

1 answer

2

With this code you prevent direct access:

if (strcmp(basename($_SERVER['SCRIPT_NAME']), basename(__FILE__)) === 0) {
    header("location: index.php");
}
    
08.05.2017 / 10:14