我收到了Forbidden错误

时间:2015-03-05 05:14:39

标签: php mysql

我有一个board_directors.php页面,
当我从管理面板更新我的页面时,它'显示 被禁止 您无权访问此服务器上的/new/admin/board_directors.php。 此外,尝试使用ErrorDocument处理请求时遇到404 Not Found错误。

这里有6个表单字段和2个textarea字段。

我的代码是:

if(isset($_REQUEST['submitted']) && $_GET['edit'] == "yes"){

        $id = $_GET['id'];
        $yes = $_GET['edit'];
        $dir_sl = $_POST['dir_sl'];
        $dir_name = $_POST['dir_name'];     
        $dir_position = $_POST['dir_position'];
        $dir_email = $_POST['dir_email'];       
        $dir_mobile = $_POST['dir_mobile']; 
        $dir_details = $_POST['dir_details'];

        $file2 = $_FILES['file']['name'];
        if(!empty($file2)){
            $file = $_FILES['file']['name'];

        // Uploade Image Directory start 


        $add="board_directors_images/".$_FILES['file']['name']; // the path with the file name where the file will be stored, upload is the directory name. 
        //echo $add;
        if(move_uploaded_file ($_FILES['file']['tmp_name'],$add)){
        //echo "Successfully uploaded the image";
        chmod("$add",0777);

        }

        ///////// Start the thumbnail generation//////////////
        $n_width=100;          // Fix the width of the thumb nail images
        $n_height=140;         // Fix the height of the thumb nail imaage
        ////////////////////////////////////////////

        $tsrc="board_directors_images/thumb/".$_FILES['file']['name'];   // Path where thumb nail image will be stored

        /////////////////////////////////////////////// Starting of png thumb nail creation///////////
        if (@$_FILES['file']['type']=="image/png")
        {
        $im=ImageCreateFrompng($add);
        $width=ImageSx($im);              // Original picture width is stored
        $height=ImageSy($im);                  // Original picture height is stored
        $n_height=($n_width/$width) * $height; // Add this line to maintain aspect ratio
        $newimage=imagecreatetruecolor($n_width,$n_height);
        imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height);
        if (function_exists("imagepng")) {
        Header("Content-type: image/png");
        Imagepng($newimage,$tsrc);
        }
        elseif (function_exists("imagejpeg")) {
        Header("Content-type: image/jpeg");
        ImageJPEG($newimage,$tsrc);
        }
        chmod("$tsrc",0777);
        }////////// end of png file thumb nail creation//////////

        ////////////// starting of JPG thumb nail creation//////////
        if($_FILES['file']['type']=="image/jpeg"){
        $im=ImageCreateFromJPEG($add); 
        $width=ImageSx($im);              // Original picture width is stored
        $height=ImageSy($im);             // Original picture height is stored
        $n_height=($n_width/$width) * $height; // Add this line to maintain aspect ratio
        $newimage=imagecreatetruecolor($n_width,$n_height);                 
        imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height);
        ImageJpeg($newimage,$tsrc);
        //chmod("$tsrc",0777);
        }   
    } else {
        $sql1 = "SELECT * FROM tbl_board_directors WHERE fld_id =' ".$_GET['id']."' limit 1";
        $result1 = mysql_query($sql1);
        $test = mysql_fetch_array($result1);
        $file = $test['fld_pic'];
        $file = $file;
    }
        // End upload image direcotory 

        $sql = mysql_query("update tbl_board_directors set fld_sl_no = '".$dir_sl."', fld_name = '".$dir_name."', fld_post = '".$dir_position."', fld_email = '".$dir_email."', fld_mobile = '".$dir_mobile."', fld_details = '".$dir_details."',  fld_pic = '".$file."' where fld_id = '".$id."' ");
        if($sql){
            //echo "<strong style='color:green; font-size:14px;'>Board of directors Updated!</strong>";

            header("Location: board_directors.php?id=".$id."&edit=".$yes."&confirm=Content Updated!");
        }
}

0 个答案:

没有答案