...

View Full Version : Appending an Include() statement



lumper
04-13-2012, 03:13 PM
I am trying to append the following include() statement, but it's not working.

I want it to include the following: [icode]admin/pagelist?user=Hello[\icode]

[CODE]
<?php
include("admin/pagelist.php" ? '"\?user=\"' ? $_SESSION['username']);
?>
[\CODE]

any ideas?

iswd1
04-13-2012, 03:15 PM
I am trying to append the following include() statement, but it's not working.

I want it to include the following: [icode]admin/pagelist?user=Hello[\icode]

[CODE]
<?php
include("admin/pagelist.php" ? '"\?user=\"' ? $_SESSION['username']);
?>
[\CODE]

any ideas?


<?php include ("admin/pagelist.php?user=".$username);?>

lumper
04-13-2012, 03:22 PM
Thanks Isdw1, but that returns errors:

Warning: include(admin/pagelist.php?user=) [function.include]: failed to open stream: No error in D:\wamp\www\tester\index.php on line 334

Warning: include() [function.include]: Failed opening 'admin/pagelist.php?user=' for inclusion (include_path='.;C:\php\pear') in D:\wamp\www\tester\index.php on line 334
Call Stack

iswd1
04-13-2012, 03:28 PM
Thanks Isdw1, but that returns errors:

Warning: include(admin/pagelist.php?user=) [function.include]: failed to open stream: No error in D:\wamp\www\tester\index.php on line 334

Warning: include() [function.include]: Failed opening 'admin/pagelist.php?user=' for inclusion (include_path='.;C:\php\pear') in D:\wamp\www\tester\index.php on line 334
Call Stack

You will need to include the full path then, your PHP isn't finding the admin/pagelist.php -- try



<?php
include ("tester/admin/pagelist.php?user=".$_SESSION['username']);
?>

Fou-Lu
04-13-2012, 05:23 PM
Don't use the querystring either. Working from a filesystem wrapper it will have 0 value when used on an include (hmm, and I'm thinking that it will consider it a part of the filename as well). The include will be able to access any variables visible from the scope in which it was called, and $_SESSION itself is superglobal. Either extract $user from the session in your calling script, or deal with $_SESSION directly within the include.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum