PDA

View Full Version : Help please



RyanFTW
20-01-2008, 10:14 PM
$badnames = array('bob', 'jim', 'sam');




if($username == $badnames){
echo("That username is unavailable!<br><br>");
}


How can i make it check if $username is equal to any of the words in $badnames?

Moved by H0BJ0B (Forum Moderator) from Designing & Development: Please post in the correct forum next time, thanks http://habboxforum.com/images/smilies/smile.gif.

Invent
20-01-2008, 10:18 PM
if( in_array( $username, $badnames ) )
{

echo("That username is unavailable!<br><br>");

}
EDIT: Forgot part of the function.

RyanFTW
20-01-2008, 10:18 PM
That will never work it's not even checking the $badnames...

Doesn't work.


Edited by H0BJ0B (Forum Moderator): Posts Merged. Please do not double post within the 15 minute editing time. Instead, click "edit" on your first post.

Invent
20-01-2008, 10:24 PM
There ;) I misunderstood what your script was doing. It should work now.

RyanFTW
20-01-2008, 10:33 PM
That works thanks

But how now would i make it so if it contains a word from an array?

Want to hide these adverts? Register an account for free!