Php File Problem

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > PHP Programming

Php File Problem

TiKiRoKhaN
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


Reply

jlhaslip
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.

Reply

TiKiRoKhaN
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);
}
?>

 

 

 


Reply

Spectre
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.

Reply

jlhaslip
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.

Reply

TiKiRoKhaN
k

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. mamp call to undefined function: mime_content_type() - 379.40 hr back. (1)
  2. php file_get_content of secure page - 965.00 hr back. (1)
Similar Topics

Keywords : php, file, problem

  1. Problem With Hosting
    delete it or wait it out? (4)
  2. What Is My (power) Problem?
    (4)
    Hey all: I have a problem with my desktop. I have replaced the PSU a few times but now have a new
    problem. When I turn on the power the green led on the asus motherboard glows green, but it is a
    dull green and I cannot power up the machine. After some time (30-60 secs or more) it turns bright
    green and I can power up. Then sometimes I am in the middle of working and the power will just
    reset. When the computer boots up it starts loading the drivers then reboots again and keeps doing
    this so it keeps rebooting and rebooting and rebooting and rebooting and rebooting ....
  3. Linux/ Apache /mod_rewrite Issue
    Error when accessing a file (4)
    running on Ubuntu 8.04 with an XAMPP - php5.2.5, Apache 2., etc Getting this error when I try to
    access an sNews CMS which requires mod_rewrite and is installed locally: QUOTE Apache/2.2.8
    (Unix) DAV/2 mod_ssl/2.2.8 OpenSSL/0.9.8e PHP/5.2.5 mod_apreq2-20051231/2.6.0 mod_perl/2.0.2
    Perl/v5.10.0 configured -- resuming normal operations /opt/lampp/htdocs/jim/snews/.htaccess:
    RewriteBase: argument is not a valid URL /opt/lampp/htdocs/jim/snews/.htaccess: RewriteBase:
    argument is not a valid URL Using this link: http://localhost/jim/snews/snews16_ema....
  4. Attachment Problem In Pmwiki
    The photos uploaded in PmWiki do not show themselves in the pages (0)
    Hi, I recently added PmWiki to my website. It is a great software, both light-weight and useful
    with a lot of extensions. But a thorn is still in my side which is the attachments problem. When I
    upload photos in a page the attachment just shows up like a text link which points to the uploaded
    image without any image display. So I got stuck where I decided to make some profile pages for my
    club members. Anybody here knows what to do? I have a little experience with PmWiki but I suggest
    it to you if you do not want to be over killed by a system like what Wikipedia use....
  5. Problem With The Trap17 Forum
    Inconsistent links and problems with "Latest Activity" (4)
    Hi, I have noticed a bit of a problem with the forums here on Trap17. I don't know if this is a
    problem with the Trap17 implementation, or with Invision Power Board in general, or with a mod that
    is running on the forums here, and I'm sure that someone smarter than me can isolate the source
    of the problem. What I have noticed firstly is that the link that is generated in the top right
    corner of a post within a thread, the link to that particular post (I'll call that the linkback
    link), sometimes links to the post itself, but often just links to the thread. T....
  6. Counter Strike Problem
    steam validation (2)
    Heloo i get a probelm steam validation rejected does anyone know how to fix it ?? i tried everything
    im going to contact steam support to see if they can fix but can you guys help me?....
  7. Hosting Credits Problem? [resolved]
    (9)
    Hi. Last night I had HOSTING CREDITS : 29.67 DAYS credits. Now I have HOSTING CREDITS : 7.06 DAYS.
    How on earth did they get reduced that quickly? I am so confused. Any help please?....
  8. Copy A File And Rename It With Increment If Exist
    in VBScript (5)
    Hi all. I want to make a VBScript wich does the following: Copy a file like test.txt if test.txt
    already exists then name it test1.txt and so on until i have xxx number of files. If someone could
    help me or post a script I would be happy xD Thanks, ....
  9. Firefox 3 Cookies Problem
    It is reeeeeeally annoying (4)
    Hello The person who finds a solution for my problem would really be a life saver for me. I've
    tried searching all over the web. Whenever I try to visit phpbb2 forums, I have to clean my cookies
    before logging in, and this sux. I also get yahoo and google bad request errors. Here is the google
    bad request: CODE Google             Error                                             Bad
    Request      Your client has issued a malformed or illegal request.      Please see Google's
    Terms of Service posted at      http://www.google.com/terms_of_service.html    ....
  10. How To Create Pdf Files Using Free Tool
    Introduction to use a free tool to create PDF file (0)
    Now, that you don't need to have expensive software like Acrobat to create PDF. All you need is
    Microsoft Office and a software name doPDF. You can download the freeware from
    http://www.dopdf.com/download.php After downloading dopdf.exe, follow the instruction below 1.
    Double click to install it, as display at image 1.jpg, choose a language and click OK 2. You will
    see 2.jpg click next 3. Click I accept the agreement see 3.jpg, click next 4. Now you will see
    4.jpg, select the folder to install it and click next 5. When seeing 5.jpg, This is the folder group
    in Star....
  11. How To Extract The Audio From Youtube Videos
    get an mp3 file from youtube (5)
    How To Extract The Audio From YouTube Videos This lovely simple tutorial will tell you how
    to extract the audio from YouTube videos. Obviously , I am not in any way advocating that you take
    copyrighted music that is available illegally in video-form on YouTube and extract the audio from
    those videos rather than going down to HMV and buying the music. In this tutorial I will be using
    the following video: http://uk.youtube.com/watch?v=gUhhRc5eWNw Firstly, you download the video,
    which is simple. Just go to www.downloadyoutubevideos.com and paste the video....
  12. File Sharing Hosts!
    You can make money over here (10)
    Hello, guys! I found several web-sites which pay you for downloads of your files. It was
    approved on other forums that are paying defenitely; they are not scam projects. Here, they are: 1.
    www.depositfiles.com 2. www.letitbit.com 3. www.vip-file.com 4. www.upload.com 5. www.smsfiles.net
    There are more information on their official web-sites. To know more about it, please visit them.
    But, if you have questions, I may answer them.....
  13. Free Software For File Recovery
    RECUVA (6)
    Hi all, I was loking for a software to recover my lost files and I found this /biggrin.gif"
    style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> And the best part is ,
    its free Recuva - File Recovery Recuva (pronounced "recover") is a freeware Windows utility to
    restore files that have been accidentally deleted from your computer. This includes files emptied
    from the Recycle bin as well as images and other files that have been deleted by user error from
    digital camera memory cards or MP3 players. It will even bring back files that have been d....
  14. Where Is The Bookmarks File Stored With Ff2?
    (6)
    My bookmarks are critical and lengthy. I'd like to save them to a flash drive, since my laptop
    is ancient and it's been acting up lately. I went into the FireFox folder, but couldn't find
    the bookmarks info anywhere. there's a bookmarks.html page, but it doesn't contain the
    actual bookmarks. Where does FF2 store the bookmarks? Or is there an easier way to copy and paste
    the bookmarks to another file? /huh.gif" style="vertical-align:middle" emoid=":huh:" border="0"
    alt="huh.gif" /> 2 poor 4 a sig ....
  15. Defraggler - Free Software To Defrag Your File
    Try it out (15)
    Have you all hear a software called Defraggler? Well if not, I recommend you to download this
    software. What does it do? Simple, it'll quickly defrag files you want to defrag, no need to
    defrag the whole drive. Useful if you have less fragmented file and if you hate Windows's
    original defragger. And it's free! OS Supported and filesystem supported? All Windows 2000
    or higher (it'll be Windows 2000, 2003, XP and Vista. 64-bit support too) It support NFTS and
    FAT32 Requirement? Well not much, the EXE file even smaller than 1 MB (dont judge the power ....
  16. Pop-up Virus / Trojan Problem
    Constant pop-up, won't go away (10)
    Hi Guys, Lately I have had this same annoying pop-up dialog box pop up that says: QUOTE NOTICE:
    If your computer has been running slower than normal, it may be infected with Viruses, Adware, or
    Spyware. Adwareremover2007 will perform a quick and completely FREE scan of your system for
    malicious programs. Download AdwareRemover2007 for FREE now! I have scanned it with Avira
    AntiVirus and ad-aware2007. They both returned infected files, which i deleted, but i still have the
    pop-ups. Any ideas?....
  17. Open Any Unknown File Type With Notepad
    Make Notepad as default file opener (1)
    Open Any Unknown File with Notepad
    ************************************************************************ DISCLAIMER: The
    following contains registry edits. If done improperly can cause strange behaviour, and at worst,
    could even entirely corrupt your Windows Installation, requiring you to reinstall Windows. I cannot
    be held for any damage you may cause to your system as a result of taking any action suggested in
    the following article. ************************************************************************
    Target OS: Windows XP Introduction....
  18. Sharing Files And Printer Between Windows Vista And Xp
    Networking Problem (9)
    I have set up a wireless network between my two computers one vista and one XP I can access the
    shared files from the vista machine on the XP PC but I cannot access the shared files or printer
    which are on the XP PC via the vista one I don' think it is a firewall issue. Can anyone help
    please it is driving me mad?? /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0"
    alt="biggrin.gif" />....
  19. Dandruff Problem
    (29)
    I am a average built, Indian, Male, aged 20 person. I have a very serious problem with the
    dandruff. It comes back within an hour after taking a head bath. It is bothering me a lot. It is
    very itching and really irritating. I have tried applying lemon on my head but in vain. The dandruff
    still comes back. My mom advised me not to apply lemon too much on head so I have stopped applying
    that also on head. I went to a doctor and he asked me to shampoo hair with a medicated shampoo
    called SELSUN. But still the dandruff problem is lasting and with no effect with the medic....
  20. Laptop Keyboard Problem
    Dell Inspiron 6000 (8)
    First post on here and here it goes.... I got a laptop the "A" button now doesn't work. I pryed
    off the black top to check if any dirt or liquid is under there and cleaned it put it back on and it
    still doesn't work. I ordered a keyboard for my laptop off ebay. Now how exactly do i take off
    the old one and put a new one in? Thanks....
  21. Remote Assistance Problem
    Won't work (9)
    I have tried tons of times and i can not get it too work. I did't even know about this until
    Paul from Trap 17 used it to help me with something on my site. Whenever i try it, it never
    connects. I have tried all three ways. Email, MSN, and download the file and send it. Both computers
    are connected to the internet. On microsoft's site they have a lot of people with the same
    problem, but no one ever helps with it. They are all unanswered. Paul: If you read this i know you
    know how to do it.....
  22. Wmp (windows Media Photo) - The New Image File Format From Microsoft
    windows media photo WMP - could replace JPGs and GIFs? (33)
    Microsoft have decided to come up with a new image format to add to the common JPGs, GIFs and PNGs
    of today. It is to be called Windows Media Photo format or WMP for short. It is said to
    "Surpass the limitations of existing file formats" and here is what it'll offer: Numerous
    colour formats for printing and displaying High-quality lossy or even lossless compression
    Really efficient decoding for numerous resolutions For more features, visit
    http://www.microsoft.com/whdc/xps/wmphoto.mspx Presumeably, the JPEG2000 format or JP2 was
    ....
  23. How To Put Music In The Background Of A Powerpoint Presentation
    without having the viewer download the music file (11)
    Well, i made this power poit presentation in memory of my grandfather as many of you kno, passed
    away exactly a week ago....and i am trying to get this song to play as background music..and i did,
    but there is one humongus problem... in order for the people who are viewing it to hear the
    background music they have to download the music file as well ad the powerpoint presentation, which
    on my DSL conntection taked almost 2 minutes, and i could just imagine what it will be for a dial-up
    user (my grandma who wants to see it)... Some people may say, its impossible, but i kn....
  24. Simple C File Handling In Action
    Small code snipet which covers most of basic file handling and navigat (4)
    Yesterday I suddenly got a lot of work. The same work we try to push off, yes you are right all
    formalities to get the code review incorporated and update all source code files with code review
    headers. Imagine if you need to open 300 files one by one and append code review headers at the
    end. Since most files are reviewed in groups of 20 to 30 files. We require one header to be placed
    in say 20 to 30 files. To simplify I went back to my class assignment days and wrote this small c
    utility to open all files passed on command line and open attach code review headers an....
  25. Upload Component - Failed
    Problem with Mambo (6)
    Hello! When I am trying to upload a component in joomla (I upgraded from mambo, I had the same
    problem on mambo), it dont work, i get this error message: ! Upload component - Failed" "File
    /home/esector/public_html/Gamesector/media/install_4381d76108f20/com_forum.zip does not exist!
    " How can I fix it?....
  26. Problem Installing Sims 2 Nightlife
    update failure (26)
    I have the Sims 2. I tried to install Sims 2 Nightlife expansionpack. He reches 100 % with
    installing the game...then he automatically run the updat for the sims 2. But when he's going
    trough the files he stops st the file: CSBin/package.exe He says there is a error, and then when I
    click ok, install terminates and goes back from 100% to 0%. Can anybody tell me what's going
    wrong here? Has anyone else had this problem? I just can't figure it out. And on the internet I
    found a few people who had the same problem but just havent had an solution for it yet. Ca....
  27. Import From Excel File Into Mysql Database
    (11)
    Has anyone tried using the excel import function that comes with phpmyadmin
    http://www.phpmyadmin.net/home_page/ - it does not require any additional plug-ins or scripts and
    is fairly straightforward to use. In phpmyadmin, if you click on the database table which you wish
    to import the data to , there is a link on the bottom left corner which says "insert data from a
    text file into the table" - although it says text file it still can be used to import an excel file.
    When you click on this link you will be taken to a page where you will be asked for the file name
    (the....
  28. How To: Change Your Website's Index File
    a simple trick using .htaccess (24)
    How To: Change Your Website's Index File a simple trick using the .htaccess file A simple
    tutorial which only involves editing one little file. Useful for those of us who have mime-typed
    extensions or who are creating lots of test design files and want an easy way to make the design
    they like best their default file. Create a file called .htaccess in the /public_html/ folder if
    you don't have it. I think one should be there already when you get your site so if it isn't
    you should create it anyway! In the file write the following: CODE Di....
  29. 60 Seconds Countdown That Shutdown The Pc
    Problem in computer that automatically restart COMPUTER (15)
    I encountered this bugs or what 6 months ago, untill now still gives me a headache. I don't
    know if it is a virus, problem in windows services or what but honestly I cant fix it. What it does
    is, it's gives you an error message saying blahh blahh...with a timer of 60 seconds, when the
    timer reached 0 it will automatically restart your computer.....
  30. Did You Face Problem Opening Pdf With Firefox?
    (15)
    Hello, I have a question to ask since the 1st day of my download of firefox ... Whenever i open a
    pdf file online using firefox, the firefox is get not responding and my comp got hanged ... i have
    to manually end the firefox program via windows task manager .. I tried to wait the pdf to load, but
    it seems that it takes forever .. so im guessing it's the trail version's bug .. but after a
    few updates, I still have the problems with my firefox ... Is this my computer's problem or
    firefox problem ? If it's a firefox bug, it's impossible that no1 report ....

    1. Looking for php, file, problem

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for php, file, problem

*MORE FROM TRAP17.COM*
Similar
Problem With Hosting - delete it or wait it out?
What Is My (power) Problem?
Linux/ Apache /mod_rewrite Issue - Error when accessing a file
Attachment Problem In Pmwiki - The photos uploaded in PmWiki do not show themselves in the pages
Problem With The Trap17 Forum - Inconsistent links and problems with "Latest Activity"
Counter Strike Problem - steam validation
Hosting Credits Problem? [resolved]
Copy A File And Rename It With Increment If Exist - in VBScript
Firefox 3 Cookies Problem - It is reeeeeeally annoying
How To Create Pdf Files Using Free Tool - Introduction to use a free tool to create PDF file
How To Extract The Audio From Youtube Videos - get an mp3 file from youtube
File Sharing Hosts! - You can make money over here
Free Software For File Recovery - RECUVA
Where Is The Bookmarks File Stored With Ff2?
Defraggler - Free Software To Defrag Your File - Try it out
Pop-up Virus / Trojan Problem - Constant pop-up, won't go away
Open Any Unknown File Type With Notepad - Make Notepad as default file opener
Sharing Files And Printer Between Windows Vista And Xp - Networking Problem
Dandruff Problem
Laptop Keyboard Problem - Dell Inspiron 6000
Remote Assistance Problem - Won't work
Wmp (windows Media Photo) - The New Image File Format From Microsoft - windows media photo WMP - could replace JPGs and GIFs?
How To Put Music In The Background Of A Powerpoint Presentation - without having the viewer download the music file
Simple C File Handling In Action - Small code snipet which covers most of basic file handling and navigat
Upload Component - Failed - Problem with Mambo
Problem Installing Sims 2 Nightlife - update failure
Import From Excel File Into Mysql Database
How To: Change Your Website's Index File - a simple trick using .htaccess
60 Seconds Countdown That Shutdown The Pc - Problem in computer that automatically restart COMPUTER
Did You Face Problem Opening Pdf With Firefox?
advertisement



Php File Problem



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE