Site maintenance: Sun 15 Nov, from 12:00 UTC, about 4–6 hours. Details

This cutover relies on some testing that is still incomplete so may be cancelled at short notice

Forums / General Questions / Trying to use an age verification script, getting session problems..

Trying to use an age verification script, getting session problems..

Locked

Started by litepockets on 6 Jan 2009, 11:37 PM · Views: 2,166

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
6 Jan 2009, 11:37 PM
#1
litepockets avatar

litepockets

Zen Follower

Join Date:
Apr 2008
Location:
Covington, Washington, United States
Posts:
206
Plugin Contributions:
0

Trying to use an age verification script, getting session problems..

OK, so I have an adult shop I am working on. I have a script that SEEMS to work, just not with zen cart... haha. I think for some reason zen-cart isn't allowing a separate session or something.

the zc store is located like in the following directory:
https://www.domain.com/store

in the root folder (store) I have the following .php file (verify.php)```php

<?php session_start(); if ($_REQUEST["over18"] == 1) { $_SESSION["over18"] = 1; header("Location: " . $_REQUEST["redirect"]); } ?> <html> <head> <title>Verify Your Age</title> </head> <body> <a href="/store/verify.php?over18=1&redirect=<?php echo $_REQUEST["redirect"]; ?>">I am over 18</a> | <a href="http://www.google.com/">Get me out of here!</a> </body> </html> ```

Then I have the following in my includes/application_top.php file at the very end:

<?php 
session_start();
if ($_SESSION["over18"] !=1) {
    header("Location: /store/verify.php?redirect=" . $_SERVER['PHP_SELF']); 
} 
?>

I get the verify.php page to come up, but when clicking "I am over 18". It simply redirects back to the same page... What am I doing wrong? Please note that the script is in the application_top.php file so that this check populates whatever page the customer enters from, not just the homepage...

7 Jan 2009, 5:02 AM
#2
tony_sar avatar

tony_sar

Totally Zenned

Join Date:
Jul 2006
Location:
Montreal, Canada
Posts:
2,276
Plugin Contributions:
0

Re: Trying to use an age verification script, getting session problems..

sorry for saying this . but looking at the script ,, i wonder what is the point of this age verification ???

is just a link that user clicks on and gain access to your site , how this would verify someones age ??? is just a extra step for accessing your site . unless im missing something.

as far as i know , you can only have one session at the time ..

8 Jan 2009, 1:10 AM
#3
litepockets avatar

litepockets

Zen Follower

Join Date:
Apr 2008
Location:
Covington, Washington, United States
Posts:
206
Plugin Contributions:
0

Re: Trying to use an age verification script, getting session problems..

I can replace the html portion later and add a script for checking DOB or whatever later, but before I do that I want to make sure that the session and/or cookie can be stored, and it will redirect properly.

As far as having one session at a time:

1 zen session.. yes, you are correct, but if you can store multiple cookies at a time, why wouldn't I be able to start this "stop18" session?

8 Jan 2009, 1:30 AM
#4
tony_sar avatar

tony_sar

Totally Zenned

Join Date:
Jul 2006
Location:
Montreal, Canada
Posts:
2,276
Plugin Contributions:
0

Re: Trying to use an age verification script, getting session problems..

I found this topic that might help. although script there is just javascript .. but it seems to do the job for zencart store.

http://www.zen-cart.com/forum/showthread.php?p=546887