phpWant to Refresh the page when i click the browser back button

This question already has an answer here:

  • Reload the page on hitting back button

    5 answers

I'm making a website in which there is a login page and then the home page..
Now once I have logged in I want this to happen.

It should not go back to the login page when I click THE BROWSER BACK BUTTON.

It should refresh the home page jus like HOW FACEBOOK DOES..

I have checked and googled but I am not finding the answer...

I would really appreciate it if anyone helps me...
Thank You..

This is the login page.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<link rel="stylesheet" type="text/css" href="stylesheets\home.css">
<link rel="stylesheet" type="text/css" href="stylesheets/home.css">
<div id="wrap">
<div id="main">
<div id ="left">
<form id="login_form" action="home.php" method="post" >
<table >
<input type="text" name="email" id="email" class="login_tb" >
<input type=password name="pwd" id="pwd"" class="login_tb">
<input type=submit id="sub" value="SignIn">

This is the homePage.php


    <link rel="stylesheet" type="text/css" href="stylesheets/home1.css">


<div id="wrap">

<div id="left_contain"> Friend List</div>
<div id="main"></div>
<div id="right_contain_top">Friend New Answers</div>
<div id="right_contain_bot">Questions From AOF</div>

You can set cookies once the user is authenticated. On successful login

 setcookie("Valid", $user_name);

In the login page place this at the top.

 if ($_COOKIE['Valid'] == $user_name ) {
    header( 'Location: homepage.php' ) ;

This hack would work. Change the file extension of login page to .php

Related Articles
You Might Also Like