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?
& 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
- Related articles
- Mobile phones always receive reminders from others about postal electricity charges. How can I cancel them?
- Samsung smartphone can't receive the short message of 10086. What happened?
- What's the number of Guangdong Credit Cooperative to deduct the SMS fee?
- Wedding invitation template (a complete collection of wedding invitation templates and examples for marriage)
- Touching love quotes between couples
- Which online loan company sent WeChat Finance that I was overdue for one year?
- How long can it be found after the publication of the industrial and commercial annual report?
- Huawei Glory 20 Youth Edition SMS has no send button?
- On June 2 1, Beijing Ma Honeycomb Business Hall bought a prepaid card, and received the invoice message, which can be found online, but the electronic invoice could not be downloaded.
- What software has a high loan amount? Come in and compare.