homepage Welcome to WebmasterWorld Guest from 54.205.241.107
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Includes with GET variables no longer working
after upgrade to PHP 5
4string

10+ Year Member



 
Msg#: 3400392 posted 9:38 pm on Jul 20, 2007 (gmt 0)

I just upgraded to php 5. My includes requesting files with GET variables cannot be found. I think the problem lies with ampersands being encoded from & to &.

If I access the file in the browser as:
example.php?id=10&w=10&h=10
it works.
But accessing it with:
example.php?id=10&w=10&h=10
doesn't work.

Any ideas?

 

coopster

WebmasterWorld Administrator coopster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3400392 posted 10:24 pm on Jul 20, 2007 (gmt 0)

What does your include statement look like?

4string

10+ Year Member



 
Msg#: 3400392 posted 10:39 pm on Jul 20, 2007 (gmt 0)

That might help...

include_once($_SERVER["DOCUMENT_ROOT"]."/example.php?id=10&w=10&h=10");

giving me this error:

include_once() [<a href='function.include'>function.include</a>]: Failed opening '/home/site/public_html/example.php?id=10&amp;w=10&amp;h=10' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php')

4string

10+ Year Member



 
Msg#: 3400392 posted 12:04 am on Jul 21, 2007 (gmt 0)

Well, it seems it's not the ampersand, but I still can't figure it out. Just adding?id=something to the include file name trips an error. It breaks my whole site. Very frustrating.

4string

10+ Year Member



 
Msg#: 3400392 posted 1:19 am on Jul 21, 2007 (gmt 0)

Mystery solved.

include (though it worked for me in PHP 4) doesn't allow get variables unless it's part of an absolute url like:

include('http://www.example.com/script.php?id=10');

Somehow including absolute urls stopped working for me after upgrading though.

jatar_k

WebmasterWorld Administrator jatar_k us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3400392 posted 1:59 pm on Jul 21, 2007 (gmt 0)

it shouldn't have ever worked actually since that include is a path not a url. You can only append vars to a url

otherwise you would set the vars in the present scope and then include the file so it has access to them

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved