0

こんにちは、このコードをご覧ください。現在のプロジェクトを更新するためにこのコードを使用しています。現在のプロジェクトを編集するために $current_project_id を使用しています。オブジェクトを使用してこれをクラス関数に渡すときに問題が発生する可能性があります。

また、私のコードにセキュリティ上の問題が見つかった場合は、よろしくお願いします:)

ユーザー側:

<?php 
    $current_project_id = (int)$_GET["pid"]; //Getting current project to Update from URL parameter.

    $currentproject = $touchObj->get_projects_by_id($current_project_id); // Using  project id to update, we are taking all project data.
?>


<?php
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if(isset($_POST['project_name']) && isset($_POST['project_location'] )) { 

    include('inc/handleUpload.php'); // Image uplaod class
    $up->config('20000000','jpg,gif,png,pdf,txt,doc,docx,xls,xlsx,zip,rar');
    $up->upload('project_file','xxxxxxxxxxxxxxxxxxxxxxxxx/'); //Server file location for upload folder.


    $project_investor_id = implode(",",$_POST["project_investor_id"]); // Our table field store data as comma seperated separated

    $project_name = mysql_real_escape_string($_POST['project_name']);

    $project_location = mysql_real_escape_string($_POST['project_location']);

    $project_phase = mysql_real_escape_string($_POST['project_phase']);

    $project_capital = mysql_real_escape_string($_POST['project_capital']);

    $project_total = mysql_real_escape_string($_POST['project_total']);

    $project_notes = mysql_real_escape_string($_POST['project_notes']);

    $file = $up->fileInfo['fname'];



    $touchObj->update_project(
        $current_project_id,
        $project_investor_id,
        $project_name, 
        $project_location,
        $$project_phase,
        $project_capital,
        $project_total,
        $project_notes,
        $file
        );
}
else 
{

    echo '<div class="alert alert-info"><h6>Please fill datas...</h6></div>';
}

}
?>  

この特定のクラスの私の機能:

 public function update_project($project_id, $project_investor_id, $project_name, $project_location, $project_phase, $project_capital, $project_total, $project_notes, $file){

    $result = mysql_query("UPDATE project_table SET 
    project_investor_id = $project_investor_id, 
    project_name = $project_name,    
    project_location = $project_location,
    project_phase = $project_phase,
    project_capital = $project_capital,
    project_total = $project_total,
    project_notes = $project_notes,
    project_file = $file
    WHERE project_id =$project_id");

    if($result) {
    echo '<div class="alert alert-success"><h6>Project updates... Do not refresh window...</h6></div>';
    }
    else {
    echo '<div class="alert alert-error"><b>Some error while updating the project. Please try again...</b></div>';
    }

}

結果: プロジェクトの更新中にエラーが発生しました。もう一度お試しください...

この機能を使用してデータを更新できません 何か案は?

貴重な時間をありがとうございました

4

1 に答える 1