Jump to content
xisto Community
Sign in to follow this  
TiKiRoKhaN

Php File Problem

Recommended Posts

I have a problem...


Warning: file_get_contents(): open_basedir restriction in effect. File(/1/r0khan) is not within the allowed path(s): (/dh/web/phpmyadmin:/tm http://forums.xisto.com/no_longer_exists/) in /home/.celine/r0khan/1/seo.php on line 69
Warning: file_get_contents(/1/r0khan): failed to open stream: Operation not permitted in /home/.celine/r0khan/1/seo.php on line 69


Please help, im setting up a website of mine and im beggin 4 ur help, thx :)

Share this post


Link to post
Share on other sites

can you post some code here, please. It looks like either a file path or file permission problem. We need some code to work with, though.

Share this post


Link to post
Share on other sites

<?phpinclude('config.php');
$file = $_SERVER['REQUEST_URI'];
if($script_path)
{
$slash = '/';
}
$replace = $slash.$script_path.'/'.MFORUM.'/';
if($file == $slash.$script_path.'/'.MFORUM)
{
header('Location: '.$replace);
exit;
}
if(ereg('^'.$replace.'admin', $file) && !ereg('login.php', $file))
{
chdir('admin');
$admin = 'yes';
$file = ereg_replace('^'.$replace.'admin/', '', $file);
}
if($admin != 'yes')
{
$file = ereg_replace('^'.$replace, '', $file);
}
if(!$file)
{
include('index.php');
exit;
}
$file = explode('?', $file);
$file = $file[0];
if(ereg('..', $file))
{
die('<b><center>Invalid file!</center></b>');
}
$extension = explode('.', $file);
$count = count($extension);
$count--;
$extension = $extension[$count];

if(!function_exists('mime_content_type'))
{
function mime_content_type($file)
{
$extension = explode('.', $file);
$count = count($extension);
$count--;
$extension = $extension[$count];
$file = file('mime.dat');
for($i = 0; $i < count($file); $i++)
{
$line = $file[$i];
$line = explode(':', $line);
if($line[1] == $extension)
{
return $line[0];
}
}
}
}

if($extension == 'php')
{
include($file);
}
else
{
$mime = mime_content_type($file);
header('(anti-spam-content-type:) '.$mime);
print file_get_contents($file);
}
?>


Share this post


Link to post
Share on other sites

There is a PHP forum. I would suggest you post such topics there.Anyway, the problem appears to lie in the path you're specifying. Note in the error that it indicates the file path is prefixed with a slash - this means that PHP is going to try and look in the server's root directory, to which you almost certainly wouldn't have access (unless you own the server). Try adding $_SERVER['DOCUMENT_ROOT'] to the start of the file path.

Share this post


Link to post
Share on other sites

looks like a PATH problem.

Warning: file_get_contents(): open_basedir restriction in effect. File(/1/r0khan) is not within the allowed path(s): (/dh/web/phpmyadmin:/tmp:/usr/local/tmp:/dh/solidclient:/usr/local/lib/php:/home/r0khan:/home/.celine/r0khan) in /home/.celine/r0khan/1/seo.php on line 69Warning: file_get_contents(/1/r0khan): failed to open stream: Operation not permitted in /home/.celine/r0khan/1/seo.php on line 69
You are trying to open a file in this directory: (/1/r0khan)

And the path is formed like this : (/r0khan/1/)

Notice the reversal of the folder/sub-folder? And I can't see where that occurs in the script. I don't have my head wrapped around the code right now. Company just walked in and I am distracted, so I'll be back to have another look shortly.

Spectre's answer is good, too.

Notice from jlhaslip:
as per Spectre's comment, moving to php sub-forum.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.