PDA

View Full Version : Reading cookies from global.php


benroles
07-05-2004, 07:02 PM
Hi All,

I've written a bit of a script that records some visitor information (what the referrer was the very first time they visited plus a visitor id that allows me to track them around the site). This information is stored in cookies. The cookies are fine, and I can read them from my own scripts as follows:

$visitorid = $HTTP_COOKIE_VARS["visitorid"];
$origrefer = $HTTP_COOKIE_VARS["referer"];

I also know that the above works for scripts located in the forum directory. However, I have written some stuff in to global.php that I want to read these cookies. Whilst my script can detect the cookies with if (!isset($_COOKIE['referer'])), the above does not read from them.

Does anyone know why the above does not work in global.php?

Regards Ben.

PS - Apologies for the spelling of referer - too late to change!

benroles
07-06-2004, 07:17 PM
anybody?

Andreas
07-06-2004, 08:11 PM
For security reasons, vBulletin global.php unsets all global variables except a few specified in array $_allowedvars.

As $HTTP_SERVER_VARS is not specified there it will be unset, therefore you should use $_COOKIE.

benroles
07-07-2004, 07:55 AM
Strange... I had tried that once with no luck but now it works a treat! Thanks for your help!

B.