Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Php File Problem
TiKiRoKhaN
post Mar 26 2006, 07:22 PM
Post #1


Member [Level 3]
******

Group: Members
Posts: 95
Joined: 17-October 05
From: California
Member No.: 13,046



I have a problem...


QUOTE
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 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 smile.gif

Go to the top of the page
 
+Quote Post
jlhaslip
post Mar 26 2006, 07:40 PM
Post #2


A computer once beat me at chess, but it was no match for me at kick boxing.
Group Icon

Group: [MODERATOR]
Posts: 4,005
Joined: 24-July 05
From: In Trouble Again... still?
Member No.: 9,787
Spam Patrol



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.
Go to the top of the page
 
+Quote Post
TiKiRoKhaN
post Mar 26 2006, 07:43 PM
Post #3


Member [Level 3]
******

Group: Members
Posts: 95
Joined: 17-October 05
From: California
Member No.: 13,046



QUOTE
<?php
include('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);
}
?>
Go to the top of the page
 
+Quote Post
Spectre
post Mar 26 2006, 08:06 PM
Post #4


Privileged Member
*********

Group: Members
Posts: 874
Joined: 30-July 04
Member No.: 246



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.
Go to the top of the page
 
+Quote Post
jlhaslip
post Mar 26 2006, 08:16 PM
Post #5


A computer once beat me at chess, but it was no match for me at kick boxing.
Group Icon

Group: [MODERATOR]
Posts: 4,005
Joined: 24-July 05
From: In Trouble Again... still?
Member No.: 9,787
Spam Patrol



looks like a PATH problem.
CODE

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 69

Warning: 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.
Go to the top of the page
 
+Quote Post
TiKiRoKhaN
post Mar 26 2006, 08:23 PM
Post #6


Member [Level 3]
******

Group: Members
Posts: 95
Joined: 17-October 05
From: California
Member No.: 13,046



k
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Getting List Of Directories And Files Using Php(6)
  2. Script: Php Jukebox(4)
  3. Secure Page Includes Non-secure File(1)
  4. File Uploading Issues(2)
  5. Alternative To File()?(4)
  6. I Need Help With File Edit In Php(6)
  7. Image Upload And File Size(2)
  8. Reading 16 Bit Wav File(0)
  9. Include File.php?id=something(13)
  10. Logging Dowload Files From Your Server Onto A Html File(1)
  11. File String Delete?(2)
  12. Php Writes Into Txt File(8)
  13. File In Database(1)
  14. File Format Unknown! (wap)(6)
  15. Display Random File In A Directory(9)
  1. Help Needed With Directory/file Listing Code Infinite Loop(5)
  2. Help Php: How To Load String From Text File (solved)(9)
  3. Php Help Needed Including File In A Page.(2)
  4. Edit .txt File In Ftp Via Webpage(2)
  5. [php]simple Flat File Text Manipulator(3)
  6. <?php ?> Unique Visitors Script(2)
  7. File Upload(1)
  8. No File Extension(3)
  9. Php And Flash Image Gallery(5)
  10. File Checker-how To Check File Whith Html Through Html?(2)
  11. Updating Php File Through A Web Form(5)
  12. Need Some Help In File Browser(8)
  13. Php Configuration File(16)


 



- Lo-Fi Version Time is now: 8th September 2008 - 06:18 PM