Page 1 of 1
Stipping in here !!!
Posted: Tue Nov 10, 2009 2:31 pm
by chauffeur
I have a webpage that I don't want users to bookmark, in fact, I want them to go through the terms-conditions.php page in my website before they can enter the 'said.php' page.
I don't want to mess around with htaccess. I just want to find a small script that will allow access to the page but strip the address out of their browsers once it has latched on to and has down-loaded the page, as such, keeping the address to the page secret, not bookmarkable.
Can anyone here help? The 'phpfreaks' don't seem to be able to help!
Re: Stipping in here !!!
Posted: Wed Nov 11, 2009 2:50 am
by cpetercarter
It is extremely difficult to prevent users from bookmarking a page. You can try using frames and framesets, but they produce problems of their own, and JavaScript is useless if users do not have JavaScript enabled in their browsers.
You can however use php sessions to ensure that users cannot access the 'said.php' content without first going through the terms and conditions page. Schematically, you might have an index.php script like this:
Code: Select all
session_start();
if(empty($_SESSION['has_viewed_terms_and_conditions'])) {
//include terms and conditions content
$_SESSION['has_viewed_terms_and_conditions'] = true;
}
else
{ //include the substantive content }
Once the session has expired (ie after rather over 24 minutes of inactivity, or when the user closes the browser), there will be no 'has_viewed_terms_and_conditions' session variable, so the user will have to go through the terms and conditions stuff again when they next access your site.
Re: Stipping in here !!!
Posted: Wed Nov 11, 2009 6:56 am
by Eran
You can request it via AJAX on a certain condition (like clicking a terms & conditions link). The script itself can check if the request has XmlHttpRequest headers, which will make it difficult for non technical users to access it directly.