Welcome to Geeklog, Anonymous Thursday, November 28 2024 @ 11:24 pm EST

Geeklog Forums

disclaimer/age-check?


Status: offline

efdisaster

Forum User
Newbie
Registered: 05/21/04
Posts: 4
confused
I'm creating a site (with Geeklog) that's going to cater to a slightly evil clientele. Therefore, I'd like to avoid future hassles by requiring people to click a "I am blah blah years old and have no problem with the potential evil and offensive content blah blah blah" link on the way into the site.

I don't want to restrict anonymous viewers, just make them agree to the simple disclaimer. But I want to be sure that they've seen the disclaimer, so I'd like to set a cookie or something when it's clicked. I've done this with Perl in the past, so I imagine it couldn't be too hard with PHP.

My question is about how to be sure a person can't sneak in a back door... is there a template that gets loaded on every geeklog page, that I can throw a cookie check into, that will redirect them to the disclaimer page, if the cookie doesn't exist?

Any other suggestions or advice on how to write such a cookie-check/redirect in PHP?

 Quote

Status: offline

Turias

Forum User
Full Member
Registered: 10/20/03
Posts: 807
The header.thtml theme file should be loaded on every page.
 Quote

Status: offline

efdisaster

Forum User
Newbie
Registered: 05/21/04
Posts: 4
thanks, I'll start peeking at that template...

any suggestions on writing this check/redirect scheme?
In the past with Perl I'd write a check page, and "yes/agree" would lead to a page that set the cookie and then immediately redirected to the actual content. The page with the content (header.thtml in this case) would see if the cookie existed and redirect out to the check page if it didn't.

My searches of the web have uncovered some possible issues with using header("Location: and the cookie not being set, so I should probably stick to printing meta refreshes, yes?

Is this what I should be doing here, or is there an easier way with Geeklog and/or PHP?
 Quote

Status: offline

efdisaster

Forum User
Newbie
Registered: 05/21/04
Posts: 4
right, since I went to the trouble of learning how to check for a cookie in PHP, and then realized that the .thtml files aren't PHP at all, I decided to add my check [to see if the user has the cookie set when they agree to enter the site] into lib-common.php. It seemed like that file was being accessed or refernced by every other PHP page.

Was it a good bet? It seems to be working.
It's just one line that checks to see if a cookie exists and redirects to my entrance tunnel if it doesn't. Shouldn't do any harm, right?

Anyway, thanks for looking
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
You can actually use PHP in header.thtml (and only there), but lib-common.php is a good place as well. You only have to remember to apply your patch to lib-common.php again when you upgrade to a new version of Geeklog.

Having said that, maybe adding your code to lib-custom.php (outside of any functions there) would work, too.

bye, Dirk
 Quote

All times are EST. The time is now 11:24 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content