You are here: Re: Execute php with back button « PHP Programming Language « IT news, forums, messages
Re: Execute php with back button

Posted by L�pher Cypher on 12/30/05 07:12

zek2005 wrote:
> I need that when the user goes back to the last page with the "Back"
> button of the browser, the page executes the php code again.
>
> Is there any code to insert in php that implies a reload every time the
> page appears in the user browser??
>


Simply disable caching:

<?php

header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past

session_start();
if (!session_register("var")) {
session_register("var");
$_SESSION["var"] = 1;
} else {
$_SESSION["var"]++;
}

echo $_SESSION["var"];

?>

This will output 1 on first load,
Go to some other site, then hit back, and it will output 2 :)


luph

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация