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.

 

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
New Webmasters ask "How-To" questions here. This is where other fucking Webmasters help.

 
Thread Tools
Old 08-11-2010, 07:28 AM   #1
escoman
Confirmed User
 
escoman's Avatar
 
Join Date: Jun 2004
Posts: 597
Passing two variables localy in php includes

I want to pass

<?php include("http://www.domain.com/site/script.php?go=type&pid=1"); ?>

Locally like

<?php
$go = "type";
$pid = "1";
include("/usr/local/apache/sites/home/domain.com/public_html/site/script.php"); ?>

but it doens't work, please help. i can pass "type" but not pid.
__________________
Porn
escoman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 08-11-2010, 11:28 AM   #2
amphibient
Registered User
 
Join Date: Jul 2003
Location: Florida
Posts: 21
how are you accessing $go and $pid in script.php?

if you set them the 'local' way like you did above, they won't be in $_REQUEST or any of those variables, but will be like you included the contents of script.php at that point in your file that includes script.php.

To test this i created 2 files: included.php and includer.php

included.php:

<?php
print 'one ->'.$one."\n";
print 'two ->'. $two."\n";
?>

includer.php

<?php

$one='chicken';
$two='1';
include("/path/to/included.php");
?>

...and the output:

one ->chicken
two ->1


you may have a variable scope issue, but that's easily worked out...
amphibient is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 08-11-2010, 04:37 PM   #3
escoman
Confirmed User
 
escoman's Avatar
 
Join Date: Jun 2004
Posts: 597
I've noticed that I'm only able to pass http://www.domain.com/site/script.php?go because register globals is off so i need to use _GET instead. I have tried this

<?php
$go = $_GET['type'];
include '/usr/local/apache/sites/home/domain.com/public_html/site/script.php';
?>

but it only passes go without the value

http://www.domain.com/site/script.php?go

what am i doing wrong?
__________________
Porn

Last edited by escoman; 08-11-2010 at 04:40 PM..
escoman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
Old 08-12-2010, 01:00 AM   #4
escoman
Confirmed User
 
escoman's Avatar
 
Join Date: Jun 2004
Posts: 597
i fixed it with curl. I don't know how good and effective this is but it works.

<?php

$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'http://www.domain.com/site/script.php?go=type&pid=1');
curl_exec($curl_handle);
curl_close($curl_handle);

?>
__________________
Porn
escoman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook
 
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



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.