okay. so i've managed to get a user signup script written that actually works. and i'm feeling very 'i can do this.' then, i run into a problem.
i've set it so that when a user signs up or signs in, a cookie will be set that will contain their username and password. i've done this with an array, so that allied_cookie[0] holds a value of $username and that allied_cookie[1] holds a value of $password. but now, i want to set it so that when a user goes to any page on the site, they'll see a welcome message if they're logged in. i've set the code that does this in the link tree to the left of the site, so that it'll say things like info, about, forums, etc. on the tree, but at the top of the linktree, it'll have two options: if the cookie hasn't been set, it'll offer up the option to login, and if it has, it'll display a welcome message like "welcome, pelleas".....here's the problem. everything works, except for one thing. when it displays the welcome message, it only says "welcome, " and doesn't call the user's name. here's my code:
<?php
if(!isset($HTTP_COOKIE_VARS["allied_cookie"])){
printf("<a href=\"../accounts/login_form.php\">Log In</a>");
} else {
$username = $HTTP_COOKIE_VARS["allied_cookie[0]"];
$password = $HTTP_COOKIE_VARS["allied_cookie[1]"];
printf("Welcome,<br /> $username");
}
?>
is there some nifty little trick i need to be using to pull data from this array? i'm an utter noob to php, but not to code in general....wondering if there's some sort of "foreach" command or something that i need to be using here to pull out each field of my array. any suggestions?
thanks for any help,
-pel