Joke Collection Website - Blessing messages - How does php write pages that can only be accessed after logging in?

How does php write pages that can only be accessed after logging in?

login.php

& lt? Server-side programming language (abbreviation of professional hypertext preprocessor)

$ user name? =? $_POST[' user name'];

$password? =? $ _ POST[' password '];

$ users? =? File get content ('. /user . txt '); ? //File for storing login names and passwords

//user.txt? Content? admin? 123456? //The storage format can be changed at will.

//Obtain the user name and password according to the storage format of the login password.

$ users? =? Explosion ('?' ,$ user);

if($user[0]? ==? $ user name? & amp& amp? $user[ 1]? ==? $password? ){

//Is the login name and password correct? Set up a session? Then jump

session_start()。 ? //Open session

$_SESSION['islogin']? =? True;

Header ("Location:? index . PHP "); Quit;

} Otherwise {

//Wrong login name and password? Return to login page

Header ("Location:? log in . PHP”); Quit;

}

& gtindex.php

& lt? Server-side programming language (abbreviation of professional hypertext preprocessor)

session_start()。 ? //Open session

//Determine whether the session exists when logging in? If it exists, you have logged in.

If (! $_SESSION['islogin']){

//? ! $_SESSION['islogin'] means it doesn't exist? Return to login page

Header ("Location:? log in . PHP”); Quit;

}

//Other business logic processing codes after login.

& gt