Simple Machines Community Forum

Archived Boards and Threads... => Archived Boards => SMF Feedback and Discussion => Aiheen aloitti: Snackmaster - huhtikuu 30, 2006, 12:49:38 IP

Otsikko: Help! - Registration page = detect cookie
Kirjoitti: Snackmaster - huhtikuu 30, 2006, 12:49:38 IP
I have developed a cookie based age verification wrapper for my forums. Problem is it locks anyone and everyone out of the forum until they generate a cookie - i.e. no search engine or unregistered browsing!

I would like to check for the existnece of the cookies only on the registration page. Is this possible?

Currently
- I'm checking for an age verification cookie at top of the 'index.template.php' page (global detection)
- If none exists they go to 'Age.php' page which on submission sets the Pass or Fail cookies
- Pass cookie = access to forums
- Fail cookie = redirect to Sorry.php page

I would like to
- Check for the Pass/Fail cookies only at this URL location: 'index.php?action=register'
- Allow search engines and unregistered visitors to browse the site without existence of the Pass/Fail cookies

Otsikko: Re: Help! - Registration page = detect cookie
Kirjoitti: JshLnsctt - toukokuu 01, 2006, 04:56:16 IP
So you want to registration page to search for a planted cookie?
Otsikko: Re: Help! - Registration page = detect cookie
Kirjoitti: Snackmaster - toukokuu 01, 2006, 07:56:51 IP
A cookie on registration is what I ended up with when I couldn't find an existing age verification module.
I finished it up last night once I figured things out (white space, header and domain declaration issues which originally led me to believe 'Register.php' was not the page I needed to affect).

Any visitor to here is checked for the existence of an age verification cookie:  /index.php?action=register
- Positive cookie presents the registration module
- Negative cookie redirects to "sorry" page with site terms
- No cookie redirects to age verification form which sets either of the above cookies. Positive cookie for 30 years, negative cookie for 30 days.

I wrapped the Cookie detection and redirect code around this file: /sources/Register.php