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

0

尝试改变

 Header("Location: http://127.0.0.1");

例如

 Header("Location: http://google.com");

看看问题是否出在你的脚本上。不过在我看来还可以。如果呈现了“页面的内容”(我假设您的意思是 php 代码),则表明您的服务器存在配置问题,即它不是解释 PHP,而是将其作为纯文本提供。

于 2013-10-17T05:38:48.097 回答