Hi Perch,
I would use the mysql_count function to check if the user has a record in your user table, if you're using the website membership generated sign up form, something like this would work:
if (!@$_REQUEST['fullname']) { $errorsAndAlerts .= "You must enter your full name!<br/>\n"; }
if (!@$_REQUEST['email']) { $errorsAndAlerts .= "You must enter your email!<br/>\n"; }
if (!@$_REQUEST['first_pet']) { $errorsAndAlerts .= "You must enter your first pets name!<br/>\n"; }
elseif (!isValidEmail(@$_REQUEST['email'])) { $errorsAndAlerts .= "Please enter a valid email (example: user@example.com)<br/>\n"; }
elseif ($emailAlreadyInUse) { $errorsAndAlerts .= "That email is already in use, please choose another!<br/>\n"; }
elseif(!mysql_count('members_table_name', "email = '".@$_REQUEST['email']."' AND first_pet = '".@$_REQUEST['first_pet']."'")){ $errorsAndAlerts .= "I'm sorry. We couldn't find you in our database."; }
if ($useUsernames) {
if (!@$_REQUEST['username']) { $errorsAndAlerts .= "You must choose a username!<br/>\n"; }
elseif (preg_match("/\s+/", @$_REQUEST['username'])) { $errorsAndAlerts .= "Username cannot contain spaces!<br/>\n"; }
elseif ($usernameAlreadyInUse) { $errorsAndAlerts .= "That username is already in use, please choose another!<br/>\n"; }
}
elseif (!$useUsernames) {
if (@$_REQUEST['username']) { $errorsAndAlerts .= "Usernames are not allowed!<br/>\n"; }
}
This is just example code, so you'd need to make a few changes to get it working with your site.
So if you had data a field that stored the users first pet and email address in fields called first_pet and email respectively, you could use the mysql_count function to check to return if a record existed for that user. You would have to add a new text field to the sign up form with a name of first_pet. If what the user had entered in the form matched what was in the first_pet and e-mail field, then 1 would be returned, otherwise 0 will be returned and an error will be triggered stating "I'm sorry. We couldn't find you in our database."
Thanks!
Greg
Greg Thomas
PHP Programmer - interactivetools.com