Jump to content

[SOLVED] offensive words


asmith

Recommended Posts

<?php

$username = "marcus";

$bad = array('fuck','ass','rape');

foreach($bad AS $duh){
if(preg_match("/$duh/is",$username)){
	$err = 1;
}
}

if($err){
echo "Invalid username!\n";
}else {
echo "Nice username! -wink-\n";
}

 

With username -> marcus

Nice username! -wink-

 

With username -> marcusfuck

Invalid username!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.