My simple spam detector function lol

Started on the old forum in June 2011 · view the original in the archive · old links redirect here

#domain-check #spam-detector

5 replies · 871 views · started 15 years ago · 1 min read

4 participants
Ponick Developer · 216 posts #1

it can detect 3 part domain name and it wont bother in normal text 🙂

function check_domain($text)
	{
	
	$check_domain_in_string = "^([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,5})$";
	/*
	you can use instead,if you only wanted to detect known domain.
	$check_domain_in_string = "^([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.com|edu|co.uk|gov|biz|tv|info|net|co.cc|in$";
	*/
		if (ereg($check_domain_in_string, $text)) 
	{
		return true;
	break;	
    } 					
    return false;
	}
/* I don't know everything hehe */

Find me on facebook

Ponick Developer · 216 posts #4

ozziemale31 wrote: or if u wer smart u wud just block the http:// becus u dont need .com .net etc u can use http://101.32.244.10 and people will stil get to yr domain

hehehe people hardly write http or www in normal text and i said its a symple fuction lol detect only valid domain from given text,

change

$check_domain_in_string = "^([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,5})$";

to

$check_domain_in_string = "^([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([a-zA-Z0-9]{2,})$";

then it can detect your ip domain 😛

Added after 3 minutes:

CreativityKills wrote: i cud always write dot com pmpl jp.

its a sad news 😛

/* I don't know everything hehe */

Find me on facebook

arnage Lead · 811 posts #5

You gave me an idea. 🙂 Why not take all the domains in the file, it would not be large and the certainly there somewhere on the net ready, loop through all and preg_match them and if there is a link, to stop entry and throw a notice, or simply search and replace parts matched with preg_replace.

<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
CreativityKills Lead · 833 posts #6

arnage wrote: You gave me an idea. 🙂 Why not take all the domains in the file, it would not be large and the certainly there somewhere on the net ready, loop through all and preg_match them and if there is a link, to stop entry and throw a notice, or simply search and replace parts matched with preg_replace.

luk dnt bother urself wit dat mehn just let d sleepin dog lie

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close