+1 vote
ago by
Brothers, please tell me how to do the authorization?
To each hidden page there is a file on the first line with include in which
<?php 
$login = "Mihalich";
$password = "bolt20";

if($_COOKIE["login"] != $login || $_COOKIE["password"] != $password) {
header('Location:login');
} else {

}
?>
So we make a request to www.site/admin and it takes us to site/login. For example, we entered the correct username and password, but how do we know the original path of /admin where we wanted to enter? And why the record header('Location:'.__DIR__.'login.php'); gives out an error. I wanted to point so reliably to the root of the site.

1 Answer

0 votes
ago by
 
Best answer
When loading, read the data from the address bar and put it in the session, and after successful authorization - take it out.
...