-1

皆さん、質問をするのはとても簡単ですが、私自身、答えを見つけるのに問題があり、これがひどく必要です...

質問は:

(donate/index.php) に次の関数があります。

function submit_amount() { global $db, $user, $auth, $template, $current_dir; グローバル $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;

    include ($phpbb_root_path . 'includes/functions_user.' . $phpEx);
    include ($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
    include_once ($phpbb_root_path . 'donate/functions_donate.' . $phpEx);

    $submitted_amount = (isset($_POST['submitted_amount'])) ? true : false;

    $sql = 'UPDATE ' . DONATION_TABLE . "
            SET config_value = '" . $submitted_amount . "'
            WHERE config_name = 'submitted_amount'";

    $result = $db->sql_query($sql);

}

page_header($user->lang['DONATE_EXPLAIN'], false);

提出された_金額();

$template->set_filenames(array( 'body' => 'donate/index_body.html') );

?>

ファイル: (styles/prosilver/template/donate/index_body.html)

次の行があります

< input type='text' name='submitted_amount' id='submitted_amount' value='' size="25" tabindex="1" maxlength='9' class='inputbox_d' align="top">

< form action='{U_DONATE_CONFIRM}' method='post'>

< input type='submit' class="button1" name='submit' value='{L_SUBMIT}'>

さらに説明が必要な場合は、教えてください。私のコードの HTML と PHP の間で考えられるすべての接続を示しました。データベースの列があるのに、何が問題なのですか?

4

1 に答える 1

1

最初に:

$submitted_amount = (isset($_POST['submitted_amount'])) ? true : false;

これは?の値ではありませんsubmitted_amountか?trueまたはになるだけfalseです。

簡単な修正はに変更trueする$_POST['submitted_amount']ことですが、どこかに変数チェックを追加しない限り、SQLインジェクションに対して広くオープンなままになります。

于 2010-10-16T00:25:36.917 に答える