Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 02-04-2007, 01:08 AM   #1
alex79
Confirmed User
 
Join Date: Jun 2002
Location: france
Posts: 996
PHP problem with include and $_GET

I want make include of a file with variables like:

include("/path/to/file.php?id=xxx");
in file.php i get the id variable with $id=@$_GET["xxx"];

the problem is that variable are not passed.. for $_GET i get a null value..

what can i do to pass the variable id to file.php through include function?
__________________
alex79 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-04-2007, 01:14 AM   #2
Nookster
Confirmed IT Professional
 
Industry Role:
Join Date: Nov 2005
Location: Hollywood, CA
Posts: 3,744
http://us2.php.net/include/
Look under "Example 16.7. include() through HTTP"

when using include() and $_GET you must pull the included file with the complete url. And note that include with $_GET doesn't work with all configurations.
Nookster is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-04-2007, 01:15 AM   #3
scouser
marketer.
 
Industry Role:
Join Date: Aug 2006
Location: bcn
Posts: 2,280
use file_get_contents - or yeah just use a complete url...

Last edited by scouser; 02-04-2007 at 01:16 AM..
scouser is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-04-2007, 01:17 AM   #4
EDepth
Confirmed User
 
Join Date: Nov 2005
Location: Seattle, WA
Posts: 510
$id=@$_GET["xxx"]; <-- should be $_GET["id"] not xxx... but then yah no idea about passing vars to include files...
__________________
ICQ: 275335837
EDepth is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-04-2007, 01:18 AM   #5
xenilk
Confirmed User
 
xenilk's Avatar
 
Join Date: Jan 2006
Location: Canuck land!
Posts: 921
i don't think you grasp the concept of include yet.

Why not just do

$id = 'whatever';
include('thefile.php');

then in the 'thefile.php'
if($id ... blabla)
do some process here

... See an include as if the code would be litterally written where you include the file

so if File1.php is
$a = 1;
$b = 2;
include('File2.php');
echo $c;

and File2.php is
$c = $a + $b;

is equal to having a file with
$a = 1;
$b = 2;
$c = $a+$b;
echo $c;

... hope you see what I mean... 3am here, tired.
xenilk is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-04-2007, 01:28 AM   #6
alex79
Confirmed User
 
Join Date: Jun 2002
Location: france
Posts: 996
ok..thanks everyboby
__________________
alex79 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-04-2007, 01:31 AM   #7
woj
<&(©¿©)&>
 
woj's Avatar
 
Industry Role:
Join Date: Jul 2002
Location: Chicago
Posts: 47,882
Quote:
Originally Posted by Nookster View Post
http://us2.php.net/include/
Look under "Example 16.7. include() through HTTP"

when using include() and $_GET you must pull the included file with the complete url. And note that include with $_GET doesn't work with all configurations.
don't do that, that's lame, and will just unnecessarily slow the page down...

do something like this:

$id='xxx';
include("/path/to/file.php");

then inside file.php just use $id wherever needed...
__________________
Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager
woj is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.