I used to get so much spam in my mailbox everyday that I was spending more time deleting it then I was adding new content, maintaining sites, or starting new sites combined (typical story right).私は自分のメールボックスには毎日のようにして私は、新しいコンテンツを追加されたサイトを維持するか、または新しいサイト(典型的な話右)が合計料金に削除されたため、あまり多くの時間を消費するために使用されるマーク。Some of your website spam is not preventable, or, it is preventable, but at the cost of usability and/or good information getting caught in the “bad stuff” as well.いくつかのウェブサイトのスパム、または、予防は、予防はないが、ユーザビリティおよび/または良い情報は、 "悪いもの"も手に入れることのコストで捉えました。
No doubt, if you’re serious about web development you’re going to be creating and interacting with forms on a regular basis.間違いなく場合は、 Web開発について作成し、定期的に深刻な形で相互作用しているつもりだ。Especially with this new web 2.0 attitude every has…gee wiz, what’s that?特に、この新しいウェブごとに何の...なんてこったしている2.0態度とは?
CAPTCHACAPTCHA CAPTCHA is the number one method most people are using to prevent spam today. CAPTCHAほとんどの人が1つのメソッドを使用している今日、スパムを防ぐための番号です。What is it?何でしょう?
“A CAPTCHA is a challenge response test used on computers to check if the user is human. " CAPTCHAはチャレンジレスポンスをチェックするテストコンピュータ上で使用される場合に、ユーザーが人間である。A common kind of CAPTCHA that is used on websites requires that the visitor type the letters and numbers of a distorted image.この場合、訪問ユーザーのタイプは、文字とは、歪んだ画像の数字CAPTCHAのウェブサイトで使用される一般的な必要があります。This method is based on the fact that is difficult for computers to extract the text from the image while it is very easy for humans.” - captchacreator.com人間にとっては非常に簡単です用コンピュータの画像からテキストを抽出するこの方法は困難であるという事実に基づいています。 " -c aptchacreator.com
Here’sa few resources to scripts so you’ll be able to implement that functionality into your own forms:スクリプトを以下にいくつかのリソースので、ご自分のフォームには、機能を実装できるようになります:
Escape Data - Prevent SQL Injectionsエスケープデータ-S QLインジェクションを防ぐ Capcha is usless if you’re leaving your form unprotected from attack.攻撃から保護されていない場合は、フォームを移動しようとしてCapcha uslessされています。Remember to filter post strings with addslashes() or mysql_real_escape_string() . addslashesフィルタ文字列を投稿してください( )やmysql_real_escape_string ( ) 。
Also take a look at these functions for other similar kind of checks that might be useful:また、他の似たような種類のチェックに便利かもしれないが、これらの関数を見てください:
htmlspecialchars() - Escapes the following characters: &,’,”,>,< ...that is the ampersand, single quote, double quote, less than, and greater than symbols.htmlspecialchars ( )を -以下の文字をエスケープ: & ,',",>,<. ..は、アンパサンド、単一引用符、二重引用符は、より少ない、とシンボルを上回っています。
strip_tags() - Strips out all HTML and PHP code from the given string.strip_tags ( )の指定した文字列から-ストリップをすべてのH TMLおよびP HPコードです。
htmlentities() - Converts ALL characters to their HTML entities equivalent (this is a more catch all version of htmlspecialchars).にhtmlentities ( ) -変換のすべての文字をH TMLエンティティに相当(このためにもっとh tmlspecialcharsを捕まえるのすべてのバージョン)です。
urlencode() - Encodes the URL to pass strings on a GET method.urlencode ( ) -G ETメソッドで文字列を渡すとは、 U RLエンコードします。As I mentioned, don’t use GET with forms.これまで述べたように、フォームGETを使用しないでください。This is useful when you’re passing user input variables for other reasons.その他の理由で、このときにユーザー入力の変数を通過している便利です。
Remember, once you convert data like this using one of the above functions, you can undo it for readability and output by using its reverse function. urlencode() for example has urldecode() to undo its actions so you can begin using the string as you would have before the encode.ただし、一度これは、上記のような機能の1つを使用してデータを変換すると、読みやすさと出力用(例えば) urldecodeしており、逆に機能します。 urlencodeを使用して( ) ので、文字列としての使用を開始することができますに行動を元に戻すには元に戻すことができます場合は、エンコード前にしていると思います。
Check Request Methodチェックリクエストメソッド Throw an if statement around your existing form processor that checks to see if data is coming from the globals post variable. 1の場合、既存のフォームをチェックする場合は、プロセッサの周りステートメントデータは、グローバル変数から来ているポストに投を参照してください。If not, then the user is not accessing your form the way you designed it to be used.して、ユーザーがフォームを使用するように設計されていない場合にアクセスする方法はありません。
<?php
if($_SERVER[‘REQUEST_METHOD’]==‘POST’) {
//typical form processes
}else{
echo"The form can not be used like that";フォームecho "The form can not be used like that" ; "echo"The form can not be used like that";
Change this to GET if you’re using that instead.を使用している場合は、代わりにこの変更のGETしてください。However, I would high recommend you never use that method as it is more insecure.しかし、私はより高い安全でないメソッドを使用している場合は、決してお勧めしたいと思います。
Check Request Sourceチェックを要求ソース You should also check to see if the request is originating from your own server.また、自分の場合は、要求元のサーバーからも確認する必要があります。This is a very common method of form abuse which doesn’t necessarily mean you’ll be receiving spam.このフォームを虐待の場合、スパムを受信されますが、必ずしもというわけではない、非常に一般的な方法です。If you’re server is getting a lot of bounced emails to its default email you may have someone abusing your site in this manner.サーバーしている場合が多くなってきているのデフォルトの電子メールにあなたがこのような方法で電子メールを返送さをあなたのサイトを悪用している場合があります。
<?php
$source=$_SERVER[‘HTTP_HOST’];
//or if you want to detect just the domain you can use a regular expression to filter it.
echo"you are illegally accessing this script";"echo"you are illegally accessing this script";
}else{
//typical form processes
}
//The referrer should also be from your own domain…Likewise, if there is no referral then the user obviously isnt using your form correctly (so we dont have to check for that).
//Note: stristr() searches for the first occurrence of a string inside another string.
Using Regular Expressions For Data Validationデータの検証のための正規表現を使用して I like to check data using preg_match (or any of the regular expression functions).私preg_matchを使用してデータをチェックするように(または任意の正規表現関数) 。This method kills a lot of birds with one stone.このメソッドを1つの石では多くの鳥を殺す。Why write separate functions to check if a string is empty, then another if it allows numbers, and another if it allows alpha characters, and another to specific field length, and another…you get the point.なぜチェックする別の関数を書く場合は、文字列が空の場合には、別の場合は、別の番号を可能にできる場合は、アルファ文字が、別の特定のフィールドの長さを、別の...場合は、ポイントを得る。
if (!preg_match(”/^[A-z0-9]{5,15}$/”, $name)) $error .= “<li class=\”errors\”>The Name field can only contain letters and numbers (no spaces) and can only be up to 15 characters long.</li>”;場合( ! preg_match ("/^[ - z0 - 9 ] ( 5,15 }$/", $名) ) $エラー.= " <li class=\"errors\"> [名前]フィールドのみ文字を含めることができますと数字(スペースを含めない)とすることができますわずか15文字までが長いこと< / li > " ;
In the preg_match I am checking that the name field only contains alphanumeric values (case insensitive) and needs to be at least 5 to 15 characters in length.私は、名前のフィールドのみ(ケース)無神経な英数字の値が含まれており、長さが少なくとも5から15文字にする必要がありますチェック午前preg_match 。If you don’t meet that specification appropriate text is added to $error.仕様の場合は、適切なテキストを満たしていないドルにエラーが追加されます。
Using “[variable] [dot][equals] [text]” in this fashion allows me to keep an ongoing variable that I’m adding to. " [変数]を使用して[ ]ドット[等しい] [テキスト] "このやり方で、私は私を追加しているが現在進行中の変数を維持することができます。I can then check to see if $error contains any data before my script does any significant queries.私はそれを確認できる場合にエラー$私のスクリプトの前に任意のデータを含むすべての重要なクエリではない。If there are errors you can spit them out by echoing $error and ask the user to correct them.が存在する場合にエラー$エコーとは、ユーザー要求を修正することによってそれらを吐き出すことができるエラーが発生している。I then use CSS to style my errors which you can see with class=\”errors\”.私は自分のスタイルをCSSにエラーが発生するクラスで= \ "エラーを見ることができます\ "を使用します。
Regular expressions defiantly have a learning curve on them but they are one of the best tools that can help simplify your life in a variety of situations.正規表現ふてくされてそれぞれに学習曲線があるが、最高のツールの1つは、さまざまな状況であなたの人生を簡素化することができますしている。I’ll go into more detail about them down the road but for now you may want to buy a book or do some Googling.私の詳細については、道路下に行くつもりが、今はあなたが書籍を購入するか、いくつかのGoogleを行う必要があります。
The Non-Technical Recapは、非技術的戦評 -Implement a CAPTCHA script. CAPTCHAスクリプトを実装します。 -Escape slashes (and other bad characters). (やその他の不正な文字)スラッシュエスケープ。 -Check to see if data is coming to your form using the correct method.もしデータをフォームには、正しい方法を使用して来ている、見て確認してください。 -Check to see if the request is originating from your own server.の場合は、依頼により、お客様自身のサーバーから発信するか確認する。 -Check data using a regular expression.データは正規表現を使用して確認してください。
This is just the tip of the iceberg for what I can tell you about spam.これは私が何かお答えすることができますスパムについては、氷山の先端だけです。Thats why I’ve decided to make a mini series of it.特に、なぜ私はそれのミニシリーズにすることを決定しました。Over the next couple weeks I will be bringing you more detailed ways I deal with spam.私はスパムと私は、より詳細な対処方法をもたらしており、今後数週間以上。Comment below or email me about your own spam preventative methods.コメントの下か、独自のスパムメールの予防方法についてのメイン。If it is a new or unique technique I will post it in a future blog along with a link back to your blog.もし私は、将来のブログのリンクをブログに掲載する予定と一緒に新規または独自の技術です。Just write in the comments below and include your URL in the website field.すぐ下のコメント欄で書くと、ウェブサイトの欄にURLが含まれています。
It just occured to me…setting up those if statements with a die() statement might be easier for a quick and dirty method.ちょっと思い付いたんだけど...これらを設定する場合は( )の声明文は死ぬと汚いメソッドを迅速かつ容易になるかもしれない。Which I’m sure most of you at least for now would want a quickfix to just toss in. Keep that in mind…Something like this:きっとあなたのほとんどは、少なくとも今のところしているだけでトスをquickfixインチ、この問題を念頭に置いておくでしょう...何かのようにする:
if ($_SERVER[‘REQUEST_METHOD’] !== ‘POST’) { die(”The form can not be used like that”); } ( $場合_SERVER [ ' REQUEST_METHOD ' ] ! == 'のPOST ' ) ( ( "このフォームはそのような" )を使用することはできません死ぬ; )
You can put that anywhere at the beginning of a script for it to take effect without worrying about existing code too much.あなたがすることができますが、スクリプトの最初の任意の場所では既存のコードについてはあまり気にせずに有効にします。
Lynn : Maybe I shouldn’t, but these days I just rely on my spam filter (Akismet) to...リン :たぶん私はすべきではないんだけど、私のスパムフィルタ(アキスメット)に依存し、これらの日...- [Go To Post] -ポストに戻る[ ]
Adsense Ads Increase Whitespace And Improve CTR http://tinyurl.com/3nf7fzアドセンス広告のクリック率を向上させる増加空白とhttp://tinyurl.com/3nf7fz
@problogger Woops - u were mentioned in twitter which is what allowed that search to work. @プロブロガーオエーッと吐く-Uまでのものは、検索作業を許可されているさえずりに記載された。I have mentioned you in other posts however.しかし、他の投稿で私を記載している。
@problogger It seems there are keyword beneifits to mentioning you in posts =) http://is.gd/2VSF @これは、投稿内容を言及するキーワード= beneifitsているようだプロブロガー) http://is.gd/2VSF
T-Mobile has cheap plans and is the only one picking up Googles new Android Phone. T - Mobileの格安計画しているとグーグルは1つだけを取り上げる新しいAndroidの電話です。Hits stores on Oct 20th: http://is.gd/2Iyx. 10月20日にヒッツ店: http://is.gd/2Iyx 。
I went to Verizon yesterday & asked them about their new OS "Limo" to be released on phones next year.私は昨日のベライゾンに行ったとの新OS "を尋ねたのリムジンについて"電話で、来年リリースされる。They looked at me dumbfounded.彼らは私にあぜんと見た。Sad.悲しい。
I see they are forcing the new facebook on everyone now...私は誰もが、現在は、新しいFacebookの強制されますを参照してください...Not a fan yet - too used to the old one.ファンはまだない-あまりにも、古いものを使用。
Wow.すごい。Hit a milestone or something.大きな節目か何かヒット。Went to do some research on "equation captcha" and I appeared #1 for the result =)行った"方程式キャプチャ"にいくつかの研究をするし、私はその結果を= ) # 1出演
ちょっと思い付いたんだけど...これらを設定する場合は( )の声明文は死ぬと汚いメソッドを迅速かつ容易になるかもしれない。 きっとあなたのほとんどは、少なくとも今のところしているだけでトスをquickfixインチ、この問題を念頭に置いておくでしょう...何かのようにする:
( $場合_SERVER [ ' REQUEST_METHOD ' ] ! == 'のPOST ' ) ( ( "このフォームはそのような" )を使用することはできません死ぬ; )
あなたがすることができますが、スクリプトの最初の任意の場所では既存のコードについてはあまり気にせずに有効にします。