Need a little more help with PHP ...

Discuss all sorts of manner regarding the latest TV/games/music etc news. Pokémon chat goes in either Pokémon forums.

Moderator: Forum staff

Post Reply
User avatar
NackelShipley
Got Boulder Badge!
Got Boulder Badge!
Posts: 146
Joined: Sat 29 May, 2004 4:05 pm
Pokémon D/P Friend code: 0
Location: Maricopa Arizona
Contact:

Need a little more help with PHP ...

Post by NackelShipley »

Sorry about this everyone I'm pretty new to PHP and SQL, anyways I have another problem with my login script.

I used this code:

Code: Select all

setcookie("loggedin", "TRUE", time()+(3600 * 24));
setcookie("mysite_username", "$username");
echo "You are now logged in!<br>"; 
echo "Continue to the <a href=members.php>members</a> section.";


At the end of a file I called login.php. So far the script works great. The problem comes in when I click the link to take me to the members page.

I am using this code on the members.php page:

Code: Select all

<font face="verdana" size="1">
<?php if (!isset($_COOKIE['loggedin'])) die("You are not logged in!");
$mysite_username = $HTTP_COOKIE_VARS["mysite_username"]; 
echo "you are logged in as $mysite_username."; ?>
Now if I'm not mistaken the page login.php should have set a login cookie to my username. And the script on the page members.php should locate that cookie if I logged in with the correct informatioin (which I did) and should display a message saying 'you are logged in as (username here).'
but even though I log in correctly with valid informationg it still brings up the message "You are not logged in!" It's like it's either not finding the login cookie or it's not setting one...Can someone help me?
I Try My Best To Help, Sometimes That's Not Good Enough Though.

User avatar
NackelShipley
Got Boulder Badge!
Got Boulder Badge!
Posts: 146
Joined: Sat 29 May, 2004 4:05 pm
Pokémon D/P Friend code: 0
Location: Maricopa Arizona
Contact:

Post by NackelShipley »

Can anyone please help me out? I don't understand why I keep getting this error ... I'm thinking about asking Leo Laporte from 'The Screen Savers'.
I Try My Best To Help, Sometimes That's Not Good Enough Though.

Post Reply