まず、日本のサイトにある一般的な登録フォームの画面遷移は 入力画面→入力確認画面→完了画面 となっている場合が多いようです。ここでリロード問題となるのは完了画面でのDBへのINSERT処理やCSV書き出し処理、メール送信処理など「一度しか行わない処理」です。例えば完了画面へ遷移した際にブラウザのリロードボタンが押された場合、確認画面よりsubmitした情報が再度submitされて上記の一度しか行わない処理が二度行われてしまいます。そうならないよう、リロード対策はスクリプトで制御します。 まずは確認画面のスクリプト 確認画面でチケットを発行し、セッションに保存しておきます。同時に完了画面へチケットがPOSTされるよう、hiddenにセット。こうして完了画面へ遷移させます。それでは完了画面のスクリプトを見てみましょう。 このように、確認画面で発行されたチケットは一度使い切ってしまえば2度処理さ
なんと、このideamiというしょぼいサイトにも海外からのロボット投稿型スパムが来るようになってしまいました。悲しい。 何とか対策をしようと思っていたところ、dotliveのオカダ君がいい方法を教えてくれました。(Thanks!) やり方は簡単。 ロボットスパムは、htmlのソースからformを見つけ、そこにデータを自動的に入れて投稿しているわけです。その投稿の仕方は単純で、どうやらnameでよく使われるような単語を見つけて、それに投稿しているぽい。 たとえば、「name」は名前、「mail」はメール欄、「url」はurl入力欄、みたいな感じです。 今回の対策では、これを逆手に取ります。つまり、偽物のフォームを作り、それに入力があるもの=ロボットによる投稿、と見なし、投稿させないというものです。 偽物のフォームを作り style=”display: none” しておいて、ユーザーには見
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く