1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

get rid of spammy link vault links -> small function inside

Discussion in 'PHP' started by falcondriver, Aug 7, 2006.

  1. #1
    hey linkvault users,
    SEMrush
    some of you may get some spammy links like "Refinance Mortgage, Credit Card, and Debt Relief" or other stuff you normally just spot in your email spamfolder, so here is a small and easy to customize function to get rid of this junk.

    go to your file where your linkvault code is placed, should look almost like this:

    
    	//linkvault
    	$Header = '';
    	$Delimiter = '<br>';
    	$Footer = '';
    	ini_set ("include_path", ini_get ("include_path") . ':../:../../:../../../:../../../../:../../../../../');
    	include ('lotsofnumbersandletters.php');
    	$lv = DisplayLinks(3,$Header, $Delimiter, $Footer, '');
    	//end linkvault
    	//remove crap
    	$out = stripspam($lv, $Delimiter);
    	echo $out;
    
    PHP:
    just include this stripspam() function somewhere at your page and edit the $badwords array to filter links you dont want.

    
    function stripspam($LVblock, $Delimiter) {
    	//define the stuff you dont want
    	$badwords = array('mortgage', 'finance');
    	//split the linkvault block to check each single entry
    	$linkvault = explode($Delimiter, $LVblock);
    	//define another var to save the clean links
    	$clearstring = "";
    	foreach($linkvault as $lv) {
    		$link_ok=true;
    		foreach($badwords as $b) {
    			if(strpos(strtolower($lv), $b)>0) {
    				$link_ok=false;
    			}
    		}
    		if($link_ok) {
    			$clearstring .= $lv.$Delimiter."\n";
    		}
    	}
    	return $clearstring;
    }	
    
    PHP:
    it works for me, but maybe you have to adjust it a bit for your site. dont know if link vault is happy about this, but at least i am not happy to see this finance-*#$% links on a computergame forum.

    let me know what you think, and please sent me a short pm if you recycle this code for your own php site or blog :)
     
    falcondriver, Aug 7, 2006 IP
    SEMrush