Jump to content

[SOLVED] Remote Include Help ?


d.shankar

Recommended Posts

I need to include a php file in my code which is available in a remote site say..

http://123.54.23.123/new.php

 

My code is here

 

<?php

include 'http://123.54.23.123/new.php';

?>

 

 

Warning: include() [function.include]: URL file-access is disabled in the server configuration in C:\wamp\www\apps\info.php on line 2

 

Warning: include(http://123.54.23.123/new.php) [function.include]: failed to open stream: no suitable wrapper could be found in C:\wamp\www\apps\info.php on line 2

 

Warning: include() [function.include]: Failed opening 'http://123.54.23.123/new.php' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\apps\info.php on line 2

 

Link to comment
Share on other sites

allow_url_fopen  boolean

 

    This option enables the URL-aware fopen wrappers that enable accessing URL object like files. Default wrappers are provided for the access of remote files using the ftp or http protocol, some extensions like zlib may register additional wrappers.

 

      Note: This setting can only be set in php.ini due to security reasons.

Link to comment
Share on other sites

thats probably your problem right their, if the file your including has nothing in it, say maybe it has a couple variables or something, without printing them, then nothing will be displayed.

 

EDIT: on second thoughts, is that the only PHP code you got on your page?

<?php
include 'myfile.php';
?>

 

or is their more?

 

Regards ACE

Link to comment
Share on other sites

Ok guys i will clearly provide the info

 

Actually this consist of two files n1.php(the file to be included)  &  n2.php

 

I need to detect an SQL Injection pattern i.e. If the user enters ' then an alert will be displayed

It perfectly works when i just use include("n1.php") in n2.php , but matters get worse when i include along with localhost , i hope it is gettiing included but the alert is not displayed.

 

 

n1.php

 

<?php
$pat1="/(?:^.?'$)|(?:.*(?:#|--)[^\w\s]*$)|(?:^.*\\'.+(?<!\\)')|(??:^['\\]*(?:[\d']+|[^']+'))+\s*(?:AND|OR|XOR|NAND|NOT|\|\||\&\&)[\s+]*[\d'[+&!-@])|(?:\^')|(?:^[\w\s-']+(?<=AND|OR|XOR|NAND|NOT|\|\||\&\&)\w+\()/";
$sub1='Detected classic SQL injection probings';

$pattern=array($pat1);
$subject=array($sub1);

foreach($_REQUEST as $key => $value)
{
	//echo "The Key".$key;
	//echo "<br>";
	//echo "The Value ".$value;
	for($x=0;$x<count($pattern);$x++)
	{
	if(preg_match($pattern[$x],$value))
	{
		echo $subject[$x];
		echo "<br>";

	}
	else
	{

	}
	}
}

?>

 

 

 

n2.php

 

<?php

include("n1.php");//This works
include("http://localhost/test/t1/n1.php");//This does not work

?>
<html>
<body>
<form action=''>
<input type='text' name='txt1'>
<input type='submit' name='sub1'>
</form>
</body>
</html>
<?php
?>

 

 

 

Inorder to chk the code pls try giving the input ' (single quote)

 

 

Thanks a lot.

Link to comment
Share on other sites

I am using WAMP Server.

I used the option "Put Online" and checked like this still it didnt work

 

<?php

include("http://192.168.1.15/test/t1/n1.php");//Still didnt work

?>
<html>
<body>
<form action=''>
<input type='text' name='txt1'>
<input type='submit' name='sub1'>
</form>
</body>
</html>
<?php
?>

 

 

I am afraid that it wont work online bud.

Link to comment
Share on other sites

Yep i am in grave trouble !!!

 

I wrote a simple code for checking out the remote include from my localhost.

It works !!

 

t1.php

 

<?php
$var="I am here";
echo $var;
?>

 

 

t2.php

 

<?php
include("http://localhost/test/t1.php");
?>

 

 

The above code works !!

 

But the code i previously posted is not workin, Please guide me.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.