Force Reload Of Page When User Press "Back" Button

Is there a way to force a page to reload if a user har pressed the "Back" button in the browser.


Log Users Out And Press The Back Button To Get Back To The Members Page?

At the top of my login page, I create a session:



To make sure the code is only run if the login function, I set this session to true.Now on members page(once the users log in), before I run any code, I place it in:if($_SESSION['loggedin']){, So this ensures that it will only run if the users have logged in.The user logs in using my form.the members page.Here, they can now log out, which takes them back to the login page.Now in doing this, the session loggedin was false.The reason why, at this point, I wanted to avoid the user being able to press the back button to get back to the members page.

View 3 Replies View Related

Avoid The Message 'warning Page Is Expired, Press Refresh Button To Reload?

how to avoid the message 'warning page is expired, press refresh button to reload' when we press back button in php.

View 1 Replies View Related

When Press The 'Back" Button Of The Browser Then We Can See The Previous Page With Logged In?

I wrote the code of a user registration script , everything working fine with out the log out page.... I used the header function to goto the another page when visitor hits "Logout" button. And now the problem is when press the 'Back" button of the browser then we can see the previous page with logged in.

View 3 Replies View Related

Reload The Page On Hitting Back Button?

I have a webpage that requires login. Once a user has logged in I start the session and once he logs out I destroy it, but when I press the back page it gives me the user profile page again which ideally should not be the case as the user has logged out. However, it works fine if I reload the page after logging out.

It's a local chatroom where everybody online and logged in can chat together. There are three pages: login.php, auth.php, logout.php

login.php is the common login page containg a form. auth.php has a div displaying all previous chats up til now, a textbox and share button on clicking which a form is sent again to auth.php so everytime the form is posted the chatpost is sent to database and auth is reloaded with the latest database within the chat div..

Now the problem is once I logout I unset all the variables and destroy the session but even then if I hit the back button in browser (Safari), the previous version of auth.php without the last chat entry is visible which ideally should not as the session is destroyed. I have put a session validation in auth.php, so basically I want the auth.php to reload of the user visits it after logging out as reloading auth.php displays that "you are not logged in"

i have tried

<?php header("Cache-Control: no-cache");
header("Pragma: no-cache");
<meta http-equiv='Pragma' content='no-cache'>
<meta http-equiv='Expires' content='-1'>

View 2 Replies View Related

Protection Against Page Reload And Back Button?

Further to my previous question, here's what I decided to implement; it may not be pure P-R-G, but it seems ok. Care to comment? The form.php has an action; let's call it validate.php. validate.php is never seen by the user; if validates all $_GET and, if valid writes it to database and generates the HTML of a confirmation page / if not valid, it generates the HTML of an error page explaining what is wrong.

Whichever HTML is generated get stored in a $_SESSION variable and then validate.php does a header('Location: <as appropriate>); Finally a page called submitted.php of invalid_input.php (in case the user reads the URL) consists only of echo $_SESSION['form_html']; That seems to me like is proff against both page reload and back button problems. Or did I goof by trying to reinvent the wheel?

View 2 Replies View Related

Make Firefox Reload Page When Back Button Is Pressed?

I have tried every combination and permutation of meta tags that are supposed to stop a page from being cached, but Firefox STILL caches the page! I just need the URL to reload when a user presses the back button. Works fine in IE8.

I have tried all of these...

<meta http-equiv="Cache-Control" content="no-store" />
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="-1"/>
<meta http-equiv="Expires" content="Sat, 1 Jan 2000 00:00:00 GMT" />

...and I have also tried the following JavaScript...

<input type="hidden" id="refreshed" value="no"/>
<script type="text/javascript">


... all to no avail. What am I missing here? Pages are generated with PHP if that matters.

UPDATE 1: I have tried every suggestion thus far but I still cannot get this to work. When I use Chris's PHP code I use it like this...

header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");


.. and as you can see it is at the EXTREME top of my webpage, before the DOCTYPE header. I have also experimented with session_start() but even after reading the manual I am not sure I am using it right. I was putting it right at the very top of my page as well. I am open to ANY SUGGESTIONS that make this work without breaking other page functionality. Turns out I had multiple issues working against me, but through due diligence I was able to eliminate those issues and emerge victorious.

After Chris updated his code to...

header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");


I found that his code did indeed work when I used it EXACTLY how he had it with NOTHING else, but when I put it into my pages it didn't work. All of my pages are either .php or .html and all are attached to a DWT (Dynamic Web Template), so I was updating all of them at once with Chris's code. What I didn't realize was that the DWT starts RIGHT AFTER the DOCTYPE header, so the code was never inserted into my pages. I could find no way to make the DWT include the DOCTYPE header so I went into all my pages and manually inserted the code above the DOCTYPE header.

Next I found that even though my server is set to parse .htm and .html as .php the .html pages were generating an error at the very where I had inserted Chris's code saying something to the effect of "cannot modify headers, headers have already been sent". I didn't really care what my extensions were so I just changed all my .html extensions to .php extensions. A final minor annoyance was that even though the page was now not being cached (just like I wanted) Firefox was placing the user at their last location on the previous page when they used the back button (i.e. if a user was at the bottom of page a when they navigated to page b, then the user used the back button on page b they would be returned to the bottom of page a, not the top of page a as desired). Trimming down my original JavaScript fixed this...

<script type="text/javascript">


View 6 Replies View Related

Press A Button On The Back End?

i have about 10 people viewing a certain page at all times during the day. I need to have an alert pop up on their windows, so if its minimized it'll blink.

I just need to press a button on the back end, and have (front end) their windows blink, or alert, or play a faint little 'ding.wav'. what is the best route? im posting here because someone said itd be easier to do in php? i figured itd be ajax or js or something?

what are some of the issues with this?page refreshing? will they even get the alert? or just on my screen? sorry if this is in the wrong location, liek i said, someone mentioned php for that. here i am.

View 14 Replies View Related

Preventing Back Button Press

I am making a form which has name and code (captcha image) as fields to be entered. I have given a timeout of x so if the form is submitted after x secs then it will print timeout and also used a token verification. If the user submits a data then processing is fine. But when he presses the back button of browser and submit again then the captcha image remains same. [but changes when the form is refreshed] So the user in this case submits the form presses back and then submits the form and floods my database with same data again and again.

View 1 Replies View Related

Back Button Takes The User Back To Protected Page After Logout -zend Framework?

I have created a pages login , logout to access a control panelscenario goes like this: user logs in and accesss the cpanel page and them logs outProblem : when login is done if user click on browser back button user goes back to login page even though authentication is done and sessions are set, at the same time if user logout , and click back button it will return back to control panel page (if user refresh the page then everything seems to be fine and usr will be redirected to login and back button won't redirect her to cpanel ) .The problem is browser cache , I tried with both php header and html meta to prevent the page from caching but I could not succeed . Any solution to this?My logout action code is as follow

public function logoutAction()


View 4 Replies View Related

Reload / Refresh On Back Button?

Code: [Select]<?php
header("Cache-Control: private, must-revalidate, max-age=0");
header("Pragma: no-cache");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
echo date('l jS of F Y h:i:s A');
^^Does not work, except IE7

When I click on a link off of the above page, then hit the back button on the browser, I need the page to reload so that the new 'date' will be echoed.

View 5 Replies View Related

Display Results So Back Button Does Not Ask To Reload POST Variables?

I have a form that uses XML to get results. From those results users can click to a detail page. My problem is when a user clicks back to the results page, they are asked if they want to submit the form again. How do I create this so back button just displays the results, like on, ebay, autotrader, etc.

View 3 Replies View Related

User Needs To Press The Submit Button Before The Iframe Is Populated.

I have a search box that is included on all pages. When entering your search it takes you to the search results page which list results from my MySQL database. The thing is I take the string that has been input ($keywords) and auto enter it into my google search box of which the result of this search is displayed in an iFrame under the search results from MySQL.

The only problem is that the user needs to press the submit button before the iframe is populated. There for is there a way that this can be done automatically as I would like hide the google box and have the user submit only on the original search.

View 2 Replies View Related

How Do I Force A FRESH RELOAD Of A Page

I've built a few php scripts, but since its reloading the same page I can't get it to refresh the page. I've implemented some expire meta tag...but is there anyway I can try and force it to refresh?

View 3 Replies View Related

Save Data In Input Fields When They Press "BACK BUTTON"

this is html form: And let's say they get a error "Please enter ur title must be more then 3 character" then they click the BACK BUTTON AND ALL THERE DATA IS GONE!!

Code: [Select]<form action="u.php" method="post">
<INPUT TYPE=hidden NAME=name VALUE="<?php echo $_SESSION['user_name']; ?>">
<fieldset class="in" style="width:804px">
<legend>Submit Prayer</legend>
<div class="p9 ce">


View 1 Replies View Related

When Press The Submit Button It Doesn't Navigate To A Different Page?

I'm using the following form, but when I press the submit button it doesn't navigate to a different page

<form id="form1" name="form1" method="post" action="">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<td colspan="4" align="right">


View 2 Replies View Related

Auto-press A Submit Button Through Page Arguments?

I have a private system that requires a user to login. It links to a separate webmail login page that requires users to enter the same credentials twice. I can pre-fill these fields in with html parameters, but I can't seem to find a way to auto-submit.

View 3 Replies View Related

POST To Certain Page Based On Button Press - HTML And CSS?

I have a page with a form containing a textbox and a few buttons. When the user clicks a button, i would like them to be redirected to a new page and have the textbox content POST to that page. Is this possible?

View 5 Replies View Related

User Can Log Back In IE After Logging Out By Hitting Back Button?

I am using a PHP login script that challenges user for username & password.Once authenticated program stores a session value. On logout, session value is
set to blanks.Here is the problem:In IE 8 (not Firefox), user can hit back button a few times until thescreen which shows "Web Page has expired" message. This is likely the login screen.If he presses F5, it looks like username and password are still hanging aroundin POST variables and he gets logged back in.

View 3 Replies View Related

Does 'Back' Reload The Page?

I notice that when I click the 'Back' button my previous script runs, i.e, all the php code runs (I previously thought that maybe the previous form displays without the code re-running).
However, I do not get the expected value displayed on my form.

After populating one element in formA with &#3917;' (just any number) and submitting to formB (using POST ---> Redirect --> GET to avoid the 'expired from cache' message) I then click the 'Back' button and the 17 does not appear. In the code below, after clickng 'Back', I see as output from the echo statement that rb_value[0] is, infact, &#3917;' but within the form, the text element named rb_value[0] displays as empty.

Does anyone have suggestions why this might be?

It might have to do with that I do not understand what the 'back' button does. Or maybe with my PRG (post - redirect - get) model.

Here is part of the code:
echo "rb_value[0]=".$rb_value[0]; //After clicking 'Back' I see that rb_value[0] is 17

if (isset($rb_value[0])) {
$rb_val = $rb_value[0];
} else {
$rb_val = 1;

$line.= "<td width="20%" valign="center" align="left"> ";

// This element displays as empty instead of the expected 17
$line.= "<input type=text name="rb_value[0]" value="$rb_val" size="25" maxlength=25 </center> "
$line.= "</td> ";

View 5 Replies View Related

Back Button With $Sessions And GET - Browsers Dont Rebuild A Dynamic Page When You Click Back ?

If your familiar with database search results, then you probably know how useful the GET method is. My results page is a list of site members from the database. We want to have a feature that allows users to add these members to a html select box to "save a list of favorites". Every time a user clicks the Add button, the page redirects to itself and we are using session variables to save the list.

Here's the problem with the Browser Back button

1.) Lets say your on page one and you add two members to the list. The GET url will have &list=1,2 appended to the end where 1 and 2 are the two members. The session looks at the variable called "list" and makes an array from the list

2) The user goes to page two of the search results. They add another member. Because the page redirects to itself right after adding to save the added member, the new GET url is &list=1,2,3 The session is resaved with this list

3) The user clicks "BACK". Browsers dont rebuild a dynamic page when you click back so the member that got added in the second page is not present.

View 1 Replies View Related

Disable The Back Button So That It Would Not Go Back To The Login Page?

I have a login page and when i input my username and department and i click the submit button i link to another webpage..the problem is when i clickthe back button i go back to the login page. I want that I couldnot go back to login page because i am already login..i don't know what could be the code for that..this is my code in login:

require_once 'conn.php';

View 11 Replies View Related

Force Browser To Re-request Page After History.back()

I've got two scripts: 1.php and 2.php. Here they are:

header('Pragma: no-cache');
header('Cache-Control: max-age=1; no-cache');
header('Expires: Tue, 1 May 1985 01:10:00 GMT');
header('ETag: "'.md5(rand(1, 1000)).'"');

Visitor lands on 1.php and then goes to 2.php. I want browser to re-request 1.php after vistor's click on "back" link. Currently, it doesn't work. How it can be managed? upd. I can edit 1.php ONLY and cant edit 2.php.

View 1 Replies View Related

Using A Button To Set Session Data And Reload Page

I'm trying to design a page that will show information based on selections made by the user. For example;

I'm logged in so the page shows me all the leagues that I play in as a series of forms which just show one button each. These forms submit the variable for the league name - so far so good.

I can set the action for these forms as 'somefile.php' and assign the $_POST[league] to the $_SESSION and echo this value, so I know that the data is being passed correctly by the form.

What i want to do though is set the form action to something that will allow me to reload the same page, now with the $_SESSION['league'] variable set and as a result show the games within that league. So each time a player presses teh button for a new league the relevant games are shown.

I've tried to set the form handler to redirect back to the page using header() but it doesn't seem to pass the $_SESSION['league'] variable back so the function for checking if the league is set fails?

View 1 Replies View Related

Reload Outside Page OnClick Of Submit Button

I'm using frames to create a "bookmark-like" page. You can enter a URL and it gets added to my database. I have two frames (leftFrame - to display bookmarks entered and mainFrame to show web page). I want the leftFrame to automatically refresh when the user enters a bookmark. As of now you must physically refresh the page to see the results. Here's my code:

View 6 Replies View Related

Execute A Script When Someone Presses A Button Without The Page To Reload?

I was just wondering if it possible to execute a php-script when someone presses a button without the page to reload or is this done with javascript.So for instance a calculator. I would be more than pleased to hear and if possible even a short example.

View 4 Replies View Related

Can't Send Cache Limit Cheaker And Back Button Session Variable Still Displaying After Logout And If Prees Back Button?

1.As user enter username and password in sign-in-form.php then values are collected in sign-in-action-form.php page and the i am storing username into session variable like thisIn database i have a table named employee

<a href="logout_file.php">Sign Out</a>
if (username and passwords are matched)


View 2 Replies View Related

Prevent User Fom Logging Back In After Logging Out By Hitting Back Button?

I am using a PHP login script that challenges user for username & password.Once authenticated program stores a session value. On logout, session value is set to blanks.

Once logged out I want to avoid allowing user hitting the back button a few times and and betting allowed to see screen of data or accidentaly logging himself back in.

I am using sessions, a re-direct to send validated user to a new page. I am also using ob_start, ob_flush and ob_end_clean to prevent error or re-direct.

Questions:Is this really secure?

Is this a common approach?

Is there alterternative to buffering?

below is a small proof-of-concept.

header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
header("Pragma: public");[code]....

View 2 Replies View Related

User Selects Browser Back Button

I using a alert JavaScript message to display once an user submits a form, the message displays fine, but say the user goes to another screen and hits the browser back button, the same message displays again, is there a way to clear the message once displayed the first time.

View 1 Replies View Related

Stop A User From Hitting The Back Button?

Is there anyway possible to stop a user from hitting the back button?

View 4 Replies View Related

Preventing POST Again When User Clicks Back Button

I have a number of forms that do significant work based on variables
POSTed from the form. What is the common method of detecting and
preventing this work from being done when the form is POSTed as the
result of the user clicking the Back or Reload buttons in the browser?

View 5 Replies View Related

Copyrights 2005-15, All rights reserved