Zubrag.com
December 17, 2017, 07:53:41 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: web page password protect  (Read 3428 times)
niko
Newbie
*
Posts: 3


« on: March 07, 2012, 04:50:56 PM »

I am new and found to have some success with help here and i really appreciate the help.

I made it to where every user has its own page they will be re-directed but when log in out i can still go back with the browser back button, how can i fix this to where when the person logs out they cant go back to the page unless they log in again. Please advise!

Logged
Caffeine_Cadet
Newbie
*
Posts: 13


« Reply #1 on: April 17, 2012, 10:55:19 PM »

step one - make sure the cookie is destroyed.

(this -86400 is in seconds.  it signifies one day in time.  adjust to the maximum value for the expiration time of your cookies when they are set.)
Code:
setcookie ("cookiename", time() - 86400);


the above seems like the most likely culprit to me because it means that the login information is still present in the header package.  it is not enough to redirect to a page that doesn't ask for login information.
all of this seems well and fine if youre using cookies.  if youre using sessions, try  adding the following to the logout script:
Code:
session_destroy();

lastly, it is possible that youre not checking for login validity.  if you are simply taking login information and assigning it to an individual file such as:

Code:
$username = $_SESSION['username'];
header('Location: ../.'$username.'.php');

that would open a specific web page FILE that has the user's web page information that you want to render(which is grossly inadvisable...if this is a case, please revamp your code.)  (that code might have bugs.  Im not really testing this, im just freestyling it for the sake of argument.)

anyway.  without looking specifically at your code, i cant really do much in the way of helping you, but these are threepossible causes of your problem.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC