Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Apr 2012
    Posts
    51
    Thanks
    19
    Thanked 0 Times in 0 Posts

    Appending an Include() statement

    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?

  • #2
    New to the CF scene
    Join Date
    Apr 2012
    Posts
    8
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by lumper View Post
    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?
    Code:
    <?php include ("admin/pagelist.php?user=".$username);?>

  • Users who have thanked iswd1 for this post:

    lumper (04-13-2012)

  • #3
    New Coder
    Join Date
    Apr 2012
    Posts
    51
    Thanks
    19
    Thanked 0 Times in 0 Posts
    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

  • #4
    New to the CF scene
    Join Date
    Apr 2012
    Posts
    8
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by lumper View Post
    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 Code:
    <?php
    include ("tester/admin/pagelist.php?user=".$_SESSION['username']);
    ?>

  • Users who have thanked iswd1 for this post:

    lumper (04-13-2012)

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    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.

  • Users who have thanked Fou-Lu for this post:

    lumper (04-13-2012)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •