i have the function mkdir() on my code, and i get an error about permissions =\
i tried to read abit, and its seems that i need to give an permission to the dir or some thing , i dident realy get it =...
the error
Warning: fopen(): open_basedir restriction in effect. File(/guides/guides/1/index.html) is not within the allowed path(s): (/var/www/vhosts/liad-marble.co.il/httpdocs:/tmp) in /var/www/vhosts/liad-marble.co.il/httpdocs/guides/adminpanel/guide.php on line 233
Warning: fopen(/guides/guides/1/index.html): failed to open stream: Operation not permitted in /var/www/vhosts/liad-marble.co.il/httpdocs/guides/adminpanel/guide.php on line 233
the code
if (isset($_POST['send'])){
for ($x=1; $x<=10; $x++){
if(is_dir("/guides/guides/".$x)) {
$mkdir= 'false'; }
if($mkdir == 'true'){
mkdir("/guides/guides/".$x);
mkdir("/guides/guides/".$x."/img");
$handlenum = $x;
$ourFileHandle = fopen("/guides/guides/".$x."/index.html", 'w') or die("can't open file");
fclose($ourFileHandle);
$date = date("d.m.Y");
$NewContent = "<html><body><div align=right><center>
<table width=85% align=center border=0 dir=rtl>
<tr height=25><td><font color=white face=Arial ><b>".
$_POST['headline']." </b></td></tr>
<tr ><td valign=top>
<font color=white size=2 face=Arial>
<pre>
<font face=arial size=2 color=white>
<br>".$_POST['line']."<br><br><font color=white size=1 face=Arial> </pre>
המדריך נכתב ע''י צוות ארט גאיד - תאריך ".$date."<br>
</td></tr>
</table>
</div>
</body></html></center>";
if(!function_exists('file_put_contents')) {
function file_put_contents($filename, $data, $file_append = false) {
$fp = fopen($filename, (!$file_append ? 'w+' : 'a+'));
if(!$fp) {
trigger_error('file_put_contents cannot write in file.', E_USER_ERROR);
return;
}
fputs($fp, $data);
fclose($fp);
}
}
echo file_put_contents("/guides/guides/".$handlenum."/index.html",$NewContent);
$target_path = "/guides/guides/".$x."/image.jpg";
move_uploaded_file($_FILES[main]['tmp_name'], $target_path);
for ($n=0; $n<=19; $n++){
$newname = $n+1;
$target_path = "/guides/guides/".$x."/img/".$newname.".jpg";
move_uploaded_file($_FILES[$n]['tmp_name'], $target_path);
}
$fop = fopen('db/guides.php', 'r');
$content = fread($fop, '999');
fclose($fop);
$newmsg = $_POST['headline']."$".$_POST['select1']."$".$x."$".$_POST['select2']."$|";
$content =$newmsg.$content;
if(!function_exists('file_put_contents')) {
function file_put_contents($filename, $data, $file_append = false) {
$fp = fopen($filename, (!$file_append ? 'w+' : 'a+'));
if(!$fp) {
trigger_error('file_put_contents cannot write in file.', E_USER_ERROR);
return;
}
fputs($fp, $data);
fclose($fp);
}
}
echo file_put_contents("db/guides.php",$content);
header("Location: guide.php");
ob_flush();
$x=21;
}$mkdir='true';
}}