NTGrE
asked on
Sub menu in included page PART 2
Hello.
I v build a page loghead.php with sub-menu and i include the selected pages there.
switch($_GET['l'])
{
case "man":
$l = "login/main.php";
break;
case "reg":
$l = "login/register.php";
break;
........etc.........
and my sub-menu.
<li><a href="index.php?p=loghead& l=man">Inf o</a></li>
<li><a href="index.php?p=loghead& l=reg" >Register</a></li>
I m trying to include one more page
<li><a href="index.php?p=loghead& l=userinfo " >User Info</a></li>
but when i try in my switch
case "userinfo":
$l = "login/userinfo.php?user=$ session->u sername";
break;
the page is not included.
Any idea???
I v build a page loghead.php with sub-menu and i include the selected pages there.
switch($_GET['l'])
{
case "man":
$l = "login/main.php";
break;
case "reg":
$l = "login/register.php";
break;
........etc.........
and my sub-menu.
<li><a href="index.php?p=loghead&
<li><a href="index.php?p=loghead&
I m trying to include one more page
<li><a href="index.php?p=loghead&
but when i try in my switch
case "userinfo":
$l = "login/userinfo.php?user=$
break;
the page is not included.
Any idea???
Maybe because you try to add some parameters (user=...)?
The included userinfo.php, as it will be included in the page, can reach variables declared in your page. It can even reach $session->username, so why do you want to pass this as a parameter?
The included userinfo.php, as it will be included in the page, can reach variables declared in your page. It can even reach $session->username, so why do you want to pass this as a parameter?
ASKER
Hi..elodis
1) Yes the first 2 examples working
2)Iv try your code but i geting the same errors as before.
Warning: main(login/userinfo.php?us er=tester) [function.main]: failed to open stream: No such file or directory in C:\Program Files\xampp\htdocs\login\l oghead.php on line 54
Warning: main() [function.include]: Failed opening 'login/userinfo.php?user=t ester' for inclusion (include_path='.;C:\Progra m Files\xampp\php\pear\') in C:\Program Files\xampp\htdocs\login\l oghead.php on line 54
where tester=my login Name & line 54 where i include the pages..
<td align="center"><? include($l); ?></td>
Hi smaccari ..
I m trying to build (modify)a page where registered users can see infos about the acount...
thats why i need the ?user=$session->username
1) Yes the first 2 examples working
2)Iv try your code but i geting the same errors as before.
Warning: main(login/userinfo.php?us
Warning: main() [function.include]: Failed opening 'login/userinfo.php?user=t
where tester=my login Name & line 54 where i include the pages..
<td align="center"><? include($l); ?></td>
Hi smaccari ..
I m trying to build (modify)a page where registered users can see infos about the acount...
thats why i need the ?user=$session->username
what does a direct browser call to ../login/userinfo.php?user =tester result in?
sorry...
./
i.e. wherever the page it actually sitting
./
i.e. wherever the page it actually sitting
ASKER
Sorry i dont understand the question... :((
what happens when you call the page you're trying to include?
From the php errors it looks as if the page doesn't exist - or php doesn't think so anyway.
I was curious what adirect call you your userinfo.php page resulted...
ie
www.yourewebsite.com/login/userinfo.php?user=tester
ASKER
Hmmmm....
strange...
Fatal error: Call to a member function usernameTaken() on a non-object in C:\Program Files\xampp\htdocs\login\u serinfo.ph p on line 23
where line 23 is
$req_user = trim($_GET['user']);
if(!$req_user || strlen($req_user) == 0 ||
!eregi("^([0-9a-z])+$", $req_user) ||
!$database->usernameTaken( $req_user) ){ <<------------------------ -----This !!!!!!
die("Username not registered");
}
I dont get it...
strange...
Fatal error: Call to a member function usernameTaken() on a non-object in C:\Program Files\xampp\htdocs\login\u
where line 23 is
$req_user = trim($_GET['user']);
if(!$req_user || strlen($req_user) == 0 ||
!eregi("^([0-9a-z])+$", $req_user) ||
!$database->usernameTaken(
die("Username not registered");
}
I dont get it...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thnx again smaccari !!!
Working perfect...
Working perfect...
Im not sure if i completely understand what you're asking, but have you tried placing the session variable outsite of the quotes, i.e:
case "userinfo":
$l = "login/userinfo.php?user="
break;
Where are you using your $l variable? Is it working for your first two switch examples?