PDA

View Full Version : Define cookie index?


TopperARG
06-24-2005, 12:24 AM
Hey guys. I'm trying to include a login/logout in my homepage that uses que vbulletin cookies to check the user.

Note: my main site is located in the root folder, and the forums are located inside a "forums" sub-folder.

The code inside main.php is the following:


if (($_COOKIE['bbuserid'] != NULL) or ($_COOKIE['bbpassword'] != NULL)) {

$userid = $_COOKIE['bbuserid'];
$sqlusername = mysql_query ("SELECT username FROM user WHERE userid = $userid",$link);
$userdata = mysql_fetch_array ($sqlusername);
$username = $userdata[0];

$t->set_var(array(
"USERNAME" => $username));

$t->parse("LOGIN","main_logoff",true);
}
else {
$t->parse("LOGIN","main_login",true);
}


The thing is I'm recieving this warnings:

Notice: Undefined index: bbuserid in C:\...\main.php on line 191

Notice: Undefined index: bbpassword in C:\...\main.php on line 191

I think the code is right but...do I have to define those indexes in the server's environment options??? Of course this only happens when the user is logued out, because the code can't finde those indexes inside the cookie. Do I need to declare them somewhere and set them to null?

Thanks a million
Topper

Marco van Herwaarden
06-24-2005, 06:36 AM
Could you please post your php info (can be found in the last menu item in your ACP).

And which is line 191, the first one?

Edit:
Try first with the following line in the top of your script (just after the "<?php"):
define('NO_REGISTER_GLOBALS', 1);