php - How to prevent user from bookmarking URLs? -


my website's webpages displays webpages using get retrieve variables predefined url. example code on first page: index.php

<p><a href="/blank.php?name1=value1&amp;name2=value2">next page</a></p> 

the second page: blank.php?name1=value1&amp;name2=value2

$name1 = $_get['name1'] ; $name2 = $_get['name2'] ; echo $name1 ; echo $name2 ; 

this way webpages created on spot , displayed kind of cms , iuse method webpages site has, if user bookmarks tab have out of date information webpage because page content contained in url.

edit: if use post better way of conveying information new webpage? instead of:

<form method="post" action="blank.php">     <input type="hidden" name="name1" value="value1">     <input type="submit"> </form> 

quick , dirty solution: add timestamp parameter urls, like:

<p><a href="/blank.php?name1=value1&amp;name2=value2&amp;time=<?php echo time(); ?>">next page</a></p> 

then, on page, check if timestamp older duration:

if(!isset($_get['time']) || time() - intval($_get['time']) > 60*60) {     header('location: index.php'); }  $name1 = $_get['name1'] ; $name2 = $_get['name2'] ; echo htmlspecialchars($name1); echo htmlspecialchars($name2); 

so if link older 1 hour (60 seconds times 60 minutes), redirected home page!

but method not user friendly! should better try build links never old content when visiting!


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -