PHP jump to the pre-login page after login implementation ideas and code
Source: Internet
Author: User
After logging on to PHP, you will jump to the pre-login page. you can use the $ _ SERVER global variable to implement this function. The following is a good example, I hope to help you with a small project recently, so that I can access PHP programming. The simple login function is OK. However, in actual use, A problem was found: User A sent A link to User B. When User B opened the page, the system prompts logon. However, after successful login, the system jumps to the homepage, it is not the link sent by. For better user experience, B should automatically jump to the pre-login link after successful login. I checked the PHP help manual and used the $ _ SERVER global variable to implement this function.
$ _ SERVER is a super global variable of PHP. For more information about $ _ SERVER variables, see: http://www.php.net/manual/zh/reserved.variables.server.php.
The specific implementation method is as follows: when a user is prompted to log on, the URL of the request page is recorded in the session or cookie; after successful login verification, the URL is redirected back.
Checklogin. php
The code is as follows:
Session_start ();
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.