0

終わりのないように見えるスパムの猛攻撃を終わらせるために、次のコードを書きました。同じ問題に関連する別の記事で見つけたキーワードのリストを使用しています。ただし、その作成者は別のアーキテクチャ用にコーディングしていました。IIS7 で PHP を書いています。問題は、訪問者が 127.0.0.1 にリダイレクトされるのではなく、コードがスパムのようなリファラーを検出すると、ページの中身が見えるプレーン テキストとしてページがレンダリングされることです。コードは次のとおりです。

<?php
$strReferrer = $_SERVER['HTTP_REFERER'];
$strFilterKeywords = array("Uggboots", "porn", "pharma", "viagra", "vuitton", "jerseys", "handbags", "sleep-deprivation", "sleep-disorders", "insomnia", "phentermine", "phentemine", "vicodin", "hydrocodone", "levitra", "hgh-", "-hgh", "ultram-", "-ultram", "cialis", "soma-", "-soma", "diazepam", "gabapentin", "celebrex", "viagra", "fioricet", "ambien", "valium", "zoloft", "finasteride", "lamisil", "meridia", "allegra", "diflucan", "zovirax", "valtrex", "lipitor", "proscar", "acyclovir", "sildenafil", "tadalafil", "xenical", "melatonin", "xanax", "herbal", "drugs", "lortab", "adipex", "propecia", "carisoprodol", "tramadol", "porno", "shemale", "gangbang", "-cock", "-anal", "-orgy", "cock-", "anal-", "orgy-", "singles-christian", "dating-christian", "cumeating", "cream-pies", "cumsucking", "cumswapping", "cumfilled", "cumdripping", "krankenversicherung", "cumpussy", "suckingcum", "drippingcum", "pussycum", "swappingcum", "eatingcum", "cum-", "-cum", "sperm", "christian-dating", "jewish-singles", "sex-meetings", "swinging", "swingers", "personals", "sleeping", "libido", "grannies", "mature", "enhancement", "sexual", "gay-teen", "teen-chat", "gay-chat", "adult-finder", "adult-friend", "friend-finder", "friend-adult", "finder-adult", "finder-friend", "discrete-encounters", "cheating-wives", "housewives", "/-sex/", "xxx", "snowballing", "fat-", "-fat", "diet", "pills", "weight", "supplement", "texas-hold-em", "poker", "casino", "blackjack", "mortgage", "refinancing", "cash-advance", "cash-money", "pay-day", "netwasgroup.com", "nic4u.com", "wear4u.com", "foxmediasolutions.com", "liveplanets.com", "aeterna-tech.com", "continentaltirebowl.com", "chemsymphony.com", "infolibria.com", "globaleducationeurope.net", "soma/125mb.com", "mitglied/lycos.de", "foxmediasolutions.com", "jroundup.com", "feathersandfurvanlines.com", "conecrusher/org", "sbj-broadcasting.com", "edthompson.com", "codychesnutt.com", "artsmallforsenate.com", "axionfootwear.com", "protzonbeer.com", "candiria.com", "bigsitecity.com", "coresat.com", "istarthere.com", "amateurvoetbal.net", "alleghanyeda.com", "xadulthosting.com", "datashaping.com", "zick/biz", "newprinceton.com", "dvdsqueeze.com", "xopy.com", "webdevboard.com", "devaddict.com", "eaton-inc.com", "whiteguysgroup.com", "guestbookz.com", "webdevsquare.com", "indfx.net", "snap/to", "2y.net", "astromagia/info", "free-sms");
foreach ($strFilterKeywords as $strFilter) {
    if stripos($strReferrer, $strFilter) !== false
        {
        Header("Location: http://127.0.0.1");
        }
    }
unset($strFilter)
?>

何か案は?

ありがとう、ジェイソン

答えた>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

回答を承認する前に、有効な解決策を提供した人が投稿を取り消しました。しかし、他の人の利益のために、彼の反応を目に見えるようにしたいと思います. 以下は彼が提案したコードです:

<?php
$strReferrer = $_SERVER['HTTP_REFERER'];
$strFilterKeywords = array("Uggboots", "whiteguysgroup.com", "guestbookz.com", "webdevsquare.com", "indfx.net", "snap/to", "2y.net", "astromagia/info", "free-sms");
foreach ($strFilterKeywords as $strFilter)
{
    if( stristr($strReferrer, $strFilter) ) // wrap the if statement in ( ) - use stristr function 
        {
        header("Location: http://127.0.0.1");
        }
}
unset($strFilter); // end ;
?>

このミステリーアンサーの誰にでも、私は心からの感謝を送ります!

ジェイソン

4

1 に答える 1