Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Client-side Scripting _ Cookie help

Posted by: sharf Sep 1 2009, 07:02 PM

Ok so I have a website. I want it so that if you don't have a certain cookie, all the pages redirect to a page that requires you to agree to the terms, or else you can't do anything. So far, I have that page set up, and you have to click accept to go to the next page via this code:
<form id="form1" name="form1" method="post" action="index.html" ><label>
<input type="submit" name="button" id="button" value="I accept" />
</label>
</form>

What I need basically is when you hit accept, it creates a cookie saying you agreed. Then I need a way for each page to validate the cookie so it will allow access. I plan on adding a log in system eventually, but not yet. I was thinking I could do that to get around this, but I'd like guests to be able to view it regardless of registration. Is there also a way to say the cookie doesn't matter as long as the user is logged in? (future reference).

In short, I need to create a cookie when you press a button, and if that cookie exists, allow access to all pages, but restrict access(by redirecting the page) if the cookie doesn't have the right info.

I have Dreamweaver CS4 and I have yet to find an easy cookie setting, I've looked through the spry stuff and have had no luck.

Any help is appreciated, thanks.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)