Jump to content

Recommended Posts

Posted (edited)

I'm writing a PHP script that will read the files in a particular folder, then make individual php files for each image file (each php file will be a page that contains an image). The master script will be located under /home/[username]/public_html/events/template/ , and the individual pages and images will be contained in /home/[username]/public_html/events/$eventname/ (where $eventname is some word to describe an event). In this case, I set $eventname to "test".

 

>// $eventname and $folder are defined previously and $username is my Cpanel username
$text = "/home/{$username}/public_html/events/{$eventname}intro.html";
$eventfile = file($text);

$dir = "/home/{$username}/public_html/events/{$eventname}/";
$dh = opendir($dir);
while (($file = readdir($dh)) !== false) {
 if ($file != "." && $file != "..") {
$file = substr($file,0,strlen($file)-4);
$files[] = $file;
 }
}
closedir($dh);
$numfiles = count($files)-2;

for ($i=0; $i < numfiles; $i++) {
 $file = fopen("/home/{$username}/public_html/events/{$eventname}/{${files}[$i]}.php", "x");   ///LINE 34

 

I receive the following error (again, I removed my Cpanel username):

><b>Warning</b>:  fopen(): open_basedir restriction in effect. File(/home/[username]/public_html/events/test/img_1646-01_std.php) is not within the allowed path(s): (/home2/[username]/:/usr/local/sqmail/:/usr/lib/php:/usr/local/lib/php:/tmp) in <b>/home2/[username]/public_html/events/template/makepicpages.php</b> on line <b>34</b><br />

 

Any help?

Edited by WxGuy1

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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