spamfilters-phphulp
Idee 1: Beviel goed, maar ik zie nu ook spam die erdoor heen zou komen.
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
<?php
function ScanForSpam($message){
$message =trim($message);
$found = false;
if(preg_match('{^<h1>(.*)</h1>$}i', $message) && (preg_match_all('{<a href="(.+?)">(.+?)</a>}i', $message, $matches) >= 2)){
$found = true;
}
return $found;
}
?>
function ScanForSpam($message){
$message =trim($message);
$found = false;
if(preg_match('{^<h1>(.*)</h1>$}i', $message) && (preg_match_all('{<a href="(.+?)">(.+?)</a>}i', $message, $matches) >= 2)){
$found = true;
}
return $found;
}
?>
Idee 2, geen voorbeeld van:
Code (php)
1
2
3
4
5
6
7
2
3
4
5
6
7
<?php
function ScanForSpam($message){
$found = false;
$message = trim($message);
if(preg_match('{<a href="(.+?)">(.+?)</a>}i', $messages) >= 2){ //bevat minstens 2 a-href links (iedereen gebruikt [url])
if(!preg_match('{<\?(.+?)\?>
function ScanForSpam($message){
$found = false;
$message = trim($message);
if(preg_match('{<a href="(.+?)">(.+?)</a>}i', $messages) >= 2){ //bevat minstens 2 a-href links (iedereen gebruikt [url])
if(!preg_match('{<\?(.+?)\?>
&& !preg_match('{<{b|u|i|html|script|div|span}>}i', $message)//bevat geen hedendaagse html
&& !stristr('$', $message)//bevat geen dollartekens -> geen variabelen.
){
$found = true;
}elseif(preg_match('{^<h1>(.*)</h1>$}i', $message)){
$found = true;
}
}
return $found;
}