Click to See Complete Forum and Search --> : Online Membership / Subscription
lloydmav
07-23-2008, 05:15 AM
I'm setting up a website based on members who need to subscribe to the service. My question when a new user starts registering his details, what is the current process behind checking the details against users already registered?
If I were to have one unique identifier that could not exist twice in the database, should it be username or email? or should it be both?
Thoughts?
Thanks
Lloyd
Mr. E. Cryptic
07-23-2008, 06:28 AM
You should have some sort of index in you db as unique identifiers (int - auto inc, probably primary) anyway. but for checking if someone is already signed up, what you check is up to you. If you only want one account per email, then check if the email exists. If you plan on having users enter their username and pw as oppesed to email and pw, then you should keep the username unique and check that. or, both!
Basicly, you can check what colour their t-shirt is if that's what you need to be unique.
I'd suggest that you keep usernames unique even if you are using the email as the login and keeping that unique. conflicting user names are a git!
lloydmav
07-23-2008, 07:22 AM
Yeah I explained that one quite badly. Obviously I have a unique primary key generated by my database.
But yeah I think I'll keep email and username unique
Thanks
JeremyA
07-24-2008, 02:02 PM
This will verify there is no identical email address.
$sqlemail="SELECT * FROM members WHERE email='$email'";
$resultemail=@mysql_query($sqlemail);
$countemail=@mysql_num_rows($resultemail);
if($countemail==1)
{
$emailerror = 1;
include('register.php');
die();
}
then on the register page again you can do something like this to display the error.
if($emailerror==1){echo 'This email has already been registered.';}
-Jeremy