don't allow email for member name

Need A Custom Modification To Your Webdate Script. Ask For Help Here.

don't allow email for member name

Postby mutton on Sun Apr 13, 2008 11:41 am

I already don't allow things like yahoo and AOL as well as a lot of offensive thinks as part of the email address (see below), but I need more. What I want is to stop users from creating member names that are the same as the unique part of their email addresses.

Like if the email is roger12345@yahoo.com I don't want to allow them to use roger12345 for a user name.

Here's what I have so far, in step_2.php:

// do not allow user name to contain common email address segments
if ( stristr($login, "yahoo") || stristr($login, "hotmail") || stristr($login, ".com") ||
stristr($login, "gmail") || stristr($login, "@") || stristr($login, "dotcom") ||
stristr($login, ".edu") || stristr($login, ".") || stristr($login, "aol") ||
stristr($login, "terracom") || stristr($login, "sbcglobal") ||stristr($login, "google")
)
{
$error .= "Your username cannot be an email address.<br>\n";
}
// check for other forbidden words in username
if (
stristr($login, "69") ||
stristr($login, "420") ||
stristr($login, "sex") ||
stristr($login, "jock") ||
stristr($login, "yoni") ||
stristr($login, "jesus") ||
stristr($login, "fuck") ||
stristr($login, "stoner") ||
stristr($login, "bone") ||
stristr($login, "tryst") ||
stristr($login, "hummer") ||
stristr($login, "uncut") ||
stristr($login, "xxx") ||
stristr($login, "sensual") ||
stristr($login, "release") ||
stristr($login, "bottom") ||
stristr($login, "twink") ||
stristr($login, "sex") ||
stristr($login, "tant") ||
stristr($login, "inches") ||
stristr($login, "pussy") ||
stristr($login, "bj") ||
stristr($login, "eros") ||
stristr($login, "beejay") ||
stristr($login, "cock") ||
(stristr($login, "stud") && !stristr($login, "student"))
)
{
$error .= "Your username contains a word, partial word, characters or phrase that is not allowed!<br>\n";
}
mutton
 
Posts: 100
Joined: Mon Feb 11, 2008 11:47 pm

Re: don't allow email for member name

Postby paul on Sun Apr 13, 2008 8:10 pm

I put together the code to check if the users email name is anywhere in the login

here is the code.

hope this is what you needed.

this code strips the name from in front of the @ in the email and then checks to see if that name is found anywhere in the $login string.

Code: Select all
   // this first line finds the position of the @
$bb= strpos($email, "@");
// this line gets total length of the email string
$dd= strlen($email);
// this next line gets the first part of the email string before the @ pos
$cc= substr($email, 0, -($dd-$bb));
// this next if checks to see if $cc is found anywhere in $login
if(is_numeric(strpos($login,$cc)))
{
$error .= "Your username cannot contain any part of your email address.<br>\n";
}


:)

Paul
User avatar
paul
Site Admin
 
Posts: 264
Joined: Sat Jan 26, 2008 7:30 pm
Location: Newington,Ct,USA

Re: don't allow email for member name

Postby mutton on Sun Apr 13, 2008 9:07 pm

Thanks Paul. I guess I should pick up the PHP for idiots book and figure it out before asking for help!

I've got the code checking for bad member names in about 5 different files. Is step_2.php the correct one?

Thanks,
Dan
mutton
 
Posts: 100
Joined: Mon Feb 11, 2008 11:47 pm

Re: don't allow email for member name

Postby paul on Sun Apr 13, 2008 9:11 pm

step 2 is the page that checks the info on the first registration page

yea it's the right place to check for this

I actually added this code to my own site :)
User avatar
paul
Site Admin
 
Posts: 264
Joined: Sat Jan 26, 2008 7:30 pm
Location: Newington,Ct,USA

Re: don't allow email for member name

Postby harmony on Wed Sep 02, 2009 11:39 am

Paul, where should code be placed on the step_2 page ?

After <input type="text" name="email" value="{EMAIL}"> ?
User avatar
harmony
 
Posts: 7
Joined: Sat Jul 05, 2008 5:28 am
Location: UK


Return to Need A Modification To Your Webdate Script?

Who is online

Users browsing this forum: No registered users and 4 guests

cron