I have the login/registration tut up and running now, complete with your email activation. THANKS!!!
As well as checking if the username already exists, I'd like to check if the email exists in the database too, but can't find where I'm going wrong.
In user.inc.php, I added the following function:
function email_exists($email) { $email = mysql_real_escape_string($email); $total = mysql_query("SELECT COUNT(`user_id`) FROM `users` WHERE `user_email` = '{$email}'"); return (mysql_result($total, 0) === '1') ? true : false; }>>ps - the ' and " in '{$email}'" are correct, they just look strange<<
...and in register.php, I put:
if(email_exists($_POST['email'])) { $errors[] = 'The email you have chosen is already registered. Only one email address per registration is allowed.'; }
...this doesn't show up the email error, even when the email address is definitely already used. The other errors show up fine. I've tried echoing the email in the email_exists function, and it definitely displays, so it's getting to the function.
Anything I've overlooked here?
Thanks guys
Shaun