|
-
Dec 11th, 2004, 09:52 AM
#1
Thread Starter
Lively Member
Switch $id session variable
on a site im doing, I'm building a login script, its working fine however i have included it into a mini table under the navigation, the problem i having is I use the switch function to load the pages in the main area of the page and it works perfectly for all other links but not this one
when the user is logged in, this is echo'ed
Code:
echo "<a href='index.php?id=My Account'>My Account</a><br>";
and the code in the switch function is
Code:
case "My Account": include ('userinfo.php?user=$session->username');
the variable $session->username is what returns the users name so say I was logged in, my username is Shadows, it would look like this
Code:
userinfo.php?user=Shadows
however, this is not working
Code:
Warning: main(userinfo.php?user=$session->username): failed to open stream: No such file or directory in /home/shadows/public_html/1.0/index.php on line 129
any idea's on how I can get $session->username to return the logged in name onto the end of the link userinfo.php?user=
-
Dec 11th, 2004, 12:12 PM
#2
Fanatic Member
Re: Switch $id session variable
is userinfo.php in the same directory as the index.php?
-
Dec 11th, 2004, 02:08 PM
#3
Re: Switch $id session variable
Inclusion without a http: prefix works on a file level, so this is actually looking for a file called "userinfo.php?user=$session->username". (Not even a file called "userinfo.php?user=hugo", as substitution is only done in double-quoted strings.)
If you simply include userinfo.php, the session variable is available there, if it is global.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|