Zubrag.com :: Forum

zubrag.com => Questions About Our Scripts => Topic started by: niko on March 07, 2012, 04:50:56 PM

Title: web page password protect
Post by: niko 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!

Title: Re: web page password protect
Post by: Caffeine_Cadet 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.)
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:

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:

$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.