Jump to content

Recommended Posts

Hi i am new to this forum,my problem is i need to know how can i prevent user from viewing back page again. Wats happening is , when user logout then i kill session with following functions

                session_start();
	session_unset('valid');
	session_destroy();

	setcookie('valid');

	header('Location:index.php');

but here the cookies and the session remain maintained. after this if user press back button , it should redirect to login page. Its not happening as the session remain maintained.

Can any one guide me plz , this is project is uploaded and giving me problem, so can any one help me out. Thanks .

i am giving my code for checking the validity of the session variable code as below

 

if(empty($_SESSION['valid']))
{
header('Location:index.php');
}
else
{	
remaining code for displaying text box for login
}

i want to check this code on every page so that user should not enter into the admin or the pmpage.

 

Link to comment
https://forums.phpfreaks.com/topic/172093-preventing-from-going-to-bak-page/
Share on other sites

When the back button is used the browser loads the cached page

try this, to stop any cacheing

<?php
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache");
header("Pragma: no-cache");
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.