Jump to content

Using Sessions For A Verification System.


Guest kusogaki

Recommended Posts

Guest kusogaki

I'm trying to use sessions as a way to force people to look at a disclaimer/verification page prior to entering my shop. Normally, this isn't a problem because the front page will take you to that page first. However, for people using search engines who come across a product and wants to click over directly to it, they won't go through that page. Since the main index.php is used to access effectively everything else on the site, I figured implementing sessions to make sure people coming from outside would be a good idea.

After testing sessions access on some test files, I implemented some simple code on a local installation of cubecart and for some reason the session variable doesn't stay initialized upon entering any page after the first and automatically kicks the user back to the verification page again.

Since my code is not exactly finished persay, I will show pseudo code that illustrates the method.

verification.php -

// <form> with some data for the user to enter such as a date of birth. information is then sent to index.php

index.php -

// around line 46 after the code for checking for an installation folder

if(isset(HTTP_POST_VARS['verification_data']))

HTTP_SESSION_VARS['cookie'] = 1;

if(!isset(HTTP_SESSION_VARS['cookie']))

// redirection back to the verification page until verification is completed then the user is

// sent back to wherever they were going

The problem here, is that for the very first instance, the user will proceed unimpeded but upon clicking on a product or any other link within the scope of the shop, they will get sent back. I understand that upon the second iteration of the code above being called, the first if statement won't go through, but I assumed that the session value would still be set to 1 for the duration of the user's session. Is there something I'm doing wrong? Or am I inadvertently overriding some apparatus in CubeCart and getting shut down because of it?

I am running CubeCart V3.0.17.

-Chris

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...