Log in

View Full Version : TOS page


samimobayed
04-13-2010, 11:34 PM
Hello, i already have created a TOS page using CMPS.
The code of the page is like that:
Terms of Service By clicking 'I Agree' you agree to everything stated below:

1. No spam!

Click 'I Agree' if, and only if, you agree to ALL of the above terms.
You must have cookies enabled for this to work.
<p><br />
<a href="accept.php">I Agree</a><br />
<a href="http://www.google.com">Cancel</a></p>
</div>
My accept.php is like that:
<meta http-equiv="refresh" content="0;url=http://www.siteishere.com/index.php">
Now how do i make it so that when you click i agree it saves in cookies and doesnt' redirect you to that page again?

Thanks

NoKSouLz
04-14-2010, 10:19 AM
in your accept page you would need to add the following:

<?php setcookie("TOS", Yes, time()+36000, "/"); ?>

This then sets a cookie to say that they have accepted..

Then on your TOS page you would need to add the following code around the page

<?php
if(isset($_COOKIE['TOS'])){
$Agree = $_COOKIE['TOS'];

if($Agree == Yes){

*CODE TO REDIRECT TO HOMEPAGE HERE* }

if(!isset($_COOKIE['TOS'])){ *CODE DISPLAYING TOS ACCEPT AND CANCEL HERE* }

?>



Try that.. that should work.

I use this sort of code to check if my users are logged in on my website.

Explanation (TOS PAGE):

If cookie TOS is set on users computer.. check to see if the variable says Yes..

If so redirects to home page

If no cookie is present shows TOS


-SouLz

samimobayed
04-14-2010, 09:50 PM
Thanks, but it doesn't seem to work =S.