Multiple accounts for one email address

Hi, I have a CMS, I am creating a forgotten password page, the page will require a user to enter an email address and the code will find it in the database and send them an email, in my database, i have multiple users accounts assigned to one email address. I want it so that if the user enters an email address and it was more than one accuont assigned to it, to error a message saying please contact your admin, but atm, it is not doing this. Any suggestions?
forgotten password page code:

[code][php]<?php
$cms_page[“allow_unauth”] = true;
require_once “cms_base.php”;

$errors = new userErrors();
if (isset ($_POST['submit'])) {

	$user_email = $_POST['user_email'];
	if($user_email){
			if ($errors->totalErrors() == 0) {
				$user = new cmsUser($user_email);
				$found = $user->lookupByEmail($user_email);
				$numfound = $
					if ($found) {
						$user->sendPasswordResetEmail();
						$str_Message = '<div class="success_message">User found, an email has been dispatched to you.</div>';
						} elseif ($found) {
							$errors->defineError("too_many_users", "please contact your admin", array());
								}else{ 
								$errors->defineError("user_not_found", "The specified user could not be found.  Please try again.", array());
								}
			}
	}else{
		$errors->defineError("missing_email","please enter an email address",array());
		}
}
$cms_page["title"] = "Lucid Portal Reset Password";
$crumbData = array(array("url"=>"forgottenpassword.php", "name"=>"Reset Password"));

?>

<?php require "includes/cms_template_top.php"; ?>

Enter your email address to reset your password

<?php echo $errors->outputList(); ?> <?php if (isset($str_Message)) echo $str_Message; ?>
Email:
<?php require "includes/cms_template_bottom.php";?>[/php][/code]

function code:

function lookupByEmail($userID) { global $db; $this->id = $userID; $qry = " SELECT user_id, user_first_name, user_last_name, user_username, user_email, user_suspended FROM cms_users WHERE user_email = " . $db->SQLString($this->id) . " AND user_deleted = 0;"; $rs = $db->query($qry); if ($rs && $rs->num_rows == 1) { $this->setUserData($rs->fetch_assoc()); return true; } if ($rs && $rs->num_rows > 1) { return; } return false; }

Hi, I have a CMS, I am creating a forgotten password page, the page will require a user to enter an email address and the code will find it in the database and send them an email, in my database, i have multiple users accounts assigned to one email address. I want it so that if the user enters an email address and it was more than one accuont assigned to it, to error a message saying please contact your admin, but atm, it is not doing this. Any suggestions?
forgotten password page code:

[code][php]<?php
$cms_page[“allow_unauth”] = true;
require_once “cms_base.php”;

$errors = new userErrors();
if (isset ($_POST['submit'])) {

	$user_email = $_POST['user_email'];
	if($user_email){
			if ($errors->totalErrors() == 0) {
				$user = new cmsUser($user_email);
				$found = $user->lookupByEmail($user_email);
				$numfound = $
					if ($found) {
						$user->sendPasswordResetEmail();
						$str_Message = '<div class="success_message">User found, an email has been dispatched to you.</div>';
						} elseif ($found) {
							$errors->defineError("too_many_users", "please contact your admin", array());
								}else{ 
								$errors->defineError("user_not_found", "The specified user could not be found.  Please try again.", array());
								}
			}
	}else{
		$errors->defineError("missing_email","please enter an email address",array());
		}
}
$cms_page["title"] = "Lucid Portal Reset Password";
$crumbData = array(array("url"=>"forgottenpassword.php", "name"=>"Reset Password"));

?>

<?php require "includes/cms_template_top.php"; ?>

Enter your email address to reset your password

<?php echo $errors->outputList(); ?> <?php if (isset($str_Message)) echo $str_Message; ?>
Email:
<?php require "includes/cms_template_bottom.php";?>[/php][/code]

function code:

function lookupByEmail($userID) { global $db; $this->id = $userID; $qry = " SELECT user_id, user_first_name, user_last_name, user_username, user_email, user_suspended FROM cms_users WHERE user_email = " . $db->SQLString($this->id) . " AND user_deleted = 0;"; $rs = $db->query($qry); if ($rs && $rs->num_rows == 1) { $this->setUserData($rs->fetch_assoc()); return true; } if ($rs && $rs->num_rows > 1) { return; } return false; }

First, only a single user should be tied to a single email address. It makes more sense.

Next, your logic in the function is flawed. lookupByEmail() returns a boolean, not a number, so how would you determine the 3 possible out comes,

[ol][li]not there[/li]
[li]is there but only 1[/li]
[li]there and multiple?[/li][/ol]

Sponsor our Newsletter | Privacy Policy | Terms of Service