5, December 2008

Running the script in safe mode - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  WebDigity Community  >  User Forums  >  aStatSpam forum
Topic: Running the script in safe mode
« previous next »
Pages: [1] Print

Author Topic: Running the script in safe mode  (Read 1141 times)
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8272
42619 credits
Members referred : 3



« on: Sep 28, 2005, 05:03:31 PM »

Today I've got an email from a friend that can't use the script in safe mode. I will work it out later, but here is a quick solution to this problem.

Bellow is the code that you should enter in a php file and execute it. After the execution completes you should edit your .htaccess file and insert the directives that the script will produce.

Here  is the code :

Code:
<?php
<html>
<
body bgcolor=#ffffff>
<?
/*
 ############################################
 #                                          #
 #          aStatSpam v 0.94                #
 #                                          #
 # This program is distributed free         #
 # HumanWorks is not responsible for        #
 # this program. Use it on your own risk    #
 #                                          #
 # How To Use it :                          #
 # Just put this script in a folder of your #
 # site, and then execute it from a browser #
 # eg http://mysite.com/astatspam/setup.php #
 # You should repeat this process once per  #
 # week                                     #
 #                                          #
 # For more information visit our website   #
 # http://www.thetopsites.net/referer_spam/ #
 #                                          #
 # If you have any proposals please give as #
 # a line at np@humanworks.gr but please do #
 # not send inquiries about installing and  #
 # using the script unless you can not find #
 # an answer in the site                    #
 #                                          #
 ############################################
*/

//Configuration Variables :
//Propably you should not change anything here in order to work

$ht_file ".htaccess"//The name of the htaccess file
$ht_path $_SERVER["DOCUMENT_ROOT"]; //The path to the .htaccess file

$custom_spammers = array();//You can use this array to add custom domains to be added in your site.
// eg. $custom_spammers = array("domain1.com", "domain2.net");

//Do not edit after this line :

$upd_server "http://www.thetopsites.net/";
$upd_script "referer_spam/astatspam/update.php";

//Update Process :

//set_time_limit(0);

$spammers file_get_contents $upd_server $upd_script );
if ( 
$spammers == "0" )
{
    die ( 
"No Updates" );
}
else
{
    
//Main Script:
    
$file $ht_path "/" $ht_file;
    if ( 
file_exists $file ) )
    {
        
$ht file_get_contents $file );
    }
    else
    {
        
$ht "";
    }
    
    
$spammers array_merge explode "<-|->"$spammers ), $custom_spammers );
    
$directives "#aStatSpam\n<IfModule mod_rewrite.c>\n RewriteEngine on\n";
    for ( 
$i=0$i count($spammers)-1$i++ )
    {
        
$directives .= " RewriteCond %{HTTP_REFERER} ^(.*)".$spammers[$i]."(.*)$ [OR]\n";
    }
    
$directives .= " RewriteCond %{HTTP_REFERER} ^(.*)".$spammers[count($spammers)-1]."(.*)$\nRewriteRule .* http://www.microsoft.com/ [R,L]\n</IfModule>\n#aStatSpam - End\n";
    
    
//Parse file:
    //If you can tell me the right preg pattern to avoid this part of code please send me a line :)
    
$ht explode("\n"$ht);
    
$new_ht "";
    
$con true;
    foreach ( 
$ht as $h )
    {
        if ( 
trim$h ) == "#aStatSpam" )
        {
            
$con false;
            
$new_ht .= $directives;
            
$found true;
        }
        if ( 
$con )
        {
            
$new_ht .= $h "\n";
        }
        if ( 
trim$h ) == "#aStatSpam - End" )
        {
            
$con true;
        }
    }
    if ( !isset( 
$found ) )
    {
        
$new_ht $directives $new_ht;
    }

    echo 
"<font style=\"font-family:Verdana;font-size:11px;\">Done with " count$spammers ) . " Records<br /><br />";
    echo 
"<b>You should add these lines to your .htaccess file : </b><br />";
    echo 
"<div style=\"border: 1px solid #000000;padding:7px;\">" str_replace"\n""<br />"$directives ) . "</div>";
    echo 
"</font>";
}
?>

</body>
</html>
?>

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=470
Tags : php referer spam browsers modrewrite Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  WebDigity Community  >  User Forums  >  aStatSpam forum
Topic: Running the script in safe mode
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Dec 05, 2008, 05:29:28 AM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 37.995
Total Topics: 7.685
Total Members: 4.468
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: sansthaa

29 Guests, 5 Users online :

10 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.