I want to log on to the & nbsp; page2.php page, so I want to log on to login. php & nbsp; go to the page3.php page and log on to login. php, how can I automatically jump to & nbsp; page1 and page2 after login, that is, I only use one login. p php login problems
I am now
To access the page2.php page, log on to the login. php page.
Go to the page3.php page and log on to login. php. how can I automatically jump to page1 and page2 after login?
That is to say, I only use one login. php. how can I jump to the desired page?
Login code:
Session_start ();
$ Username = $ _ POST ['username'];
$ Password = md5 ($ _ POST ['password']);
If (empty ($ username) | empty ($ password )){
Die ("user name or password is not filled! ");
} Else {
Require_once 'DB. php ';
$ SQL = "select * from userinfo where username = '". $ username. "' and password = '". $ password ."'";
$ Query = mysql_query ($ SQL );
$ Row = mysql_fetch_array ($ query );
If ($ row ['username'] = "admin "){
$ _ SESSION ['adminname'] = "admin ";
Header ("location: manage/index. php ");
} Elseif ($ row ['username'] = "gcb "){
$ _ SESSION ['adminname'] = "gcb ";
Echo "script window. location. href = 'javascript: history. go (-1) '; script";
}
}
?>
Page1 page:
Session_start ();
If (empty ($ _ SESSION ["adminname"])
Echo "script" alert ('Please log on and perform the operation again! '); History. go (-1); script ";
?>
------ Solution --------------------
I don't know what you want to ask. didn't you write it out there? you can use headers and js to jump.
------ Solution --------------------
I am here to learn, and I also need this function.
------ Solution --------------------
The main idea is how to jump to the previous page after login, right? use the $ _ SERVER ['http _ referer'] function to get the address of the previous page, then you can jump to this page.