PHP jump to the pre-login page after login implementation ideas and code. Recently, I had a small project that gave me access to PHP programming. The simple login function is OK. However, in actual use, I found A problem: User A sent A link to User B. When User B opened A small project, I recently got in touch with 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 ();
If (! Isset ($ _ SESSION ['login _ OK '])
{
Echo"