I am new to Drupal and also have very limited PHP knowledge.
On my first Drupal site, (7.x) I have built a gated page that site visitors can get to only after filling out a form.
I'd like people to be able to revisit that gated page without having to fill out the form again, so I was thinking I could set a cookie the first time they fill out the form, then if they landed on the form page a subsequent time Drupal could check for a cookie and if it was there, redirect them straight to the gated page.
On a regular site, I would set a cookie then check for the cookie, but as far as I can tell in Drupal I need to use modules to do this rather than add code to the page template head, so I have set up a very simple one.
First, I'm using the webform module which sets a cookie on submission of the form, then sends the user to the gated page.
I just can't figure out how to get Drupal to check for the cookie and redirect (if the cookie is there) when users land on that form page a second, third, etc. time.
I copied and adjusted something similar I found in the Drupal forums but it's not working. It could be really simple error or maybe there is a way better way to do this? Thanks for any help. My code is below.
Caitlin
<?php
//$Id: check_cookie.module $
function check_cookie() {
global $base_url;
global $cookie_domain;