php


Forgotten password page help [PHP/HTML]


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 account assigned to it, to error a message saying please contact your admin, but atm, it is not doing this. Any suggestions?
Here is my forgotten password page code:
if ($lookup) {
$user->sendPasswordResetEmail();
echo"sent email";
} elseif ($lookup) {
echo "please contact your admin";
}else{
$echo"Can't find user";
}
}
}else{
echo "please enter an email address";
}
}
I take the information from a different file, here is the snippet for the code where I take the database:
$resetsystem = $db->query($qry);
if ($resetsystem && $resetsystem->num_rows == 1) {
$that->setUserData($rs->fetch_assoc());
return true;
}
if ($resetsystem && $resetsystem->num_rows > 1) {
return;
}
return false;
}
update following 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 1;
}
if ($rs && $rs->num_rows > 1) {
return 2;
}
return 0;
}
and then where you are checking the $found variable do these updates
if ((int)$found == 1) {
$user->sendPasswordResetEmail();
$str_Message = '<div class="success_message">User found, an email has been dispatched to you.</div>';
} elseif ((int)$found > 1) {
$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());
}

Related Links

Using “a href” inside echo [closed]
PHP get value of one column in array
Namespace “src\AppBundle\Entity\YesNo” does not contain any mapped entities.
Order French Language in ABC with MySQL
Laravel 5 TokenMismatchException on PHP 5.6.9
Yii loses session after OAuth redirect
MySQL Friend Table Two-Way Unique Index
How to check if YouTube video exists using YouTube Data API v3
Randomly named php file on my hosting server
Use Hashids library to hash ids on Laravel eloquent collection
set_value for select field option in codeignitor
Display count of unique values in MySQL db table using PHP
PHP: Parse comma-delimited string outside single and double quotes and parentheses
Extract value from multidimensional array
Database Connection Class PHP
Difference between stored web page's html file(save as html) and file_get_contents(web_page) function?

Categories

HOME
hpoo
openshift
mpdf
compilation
embedded-resource
magento-2.0
yql
dependencies
reportviewer
tiff
squirrel-sql
trace32
l20n
exec-maven-plugin
psql
libgit2
kaggle
uislider
ibm-connections
instructions
quick-nimble
seafile-server
private-key
adminer
cmis
pdfminer
aurelia-http-client
android-n
assemblies
game-center
newtons-method
get-event-store
grails3.2.0
classnotfoundexception
hdiv
raytracing
minikube
sonarqube5.2
head.js
karabiner
maven-jaxb2-plugin
boost-compute
scheduledexecutorservice
ipywidgets
pjax
cdo.message
right-to-left
gnucash
diawi
json-spirit
mousehover
swagger-maven-plugin
karma-coverage
kotlin-android-extensions
incron
producer
prism.js
incognito-mode
sqlbindparameter
zend-search-lucene
nosql-aggregation
acitree
sql-view
dynamic-rdlc-generation
notin
donut-chart
chefspec
xmlwriter
dojo-1.9
smartfox
multiple-dispatch
jquery-dialog
coordinate
netstream
wcf-callbacks
zend-server-ce
motodev-studio
database-deadlocks
canonicalization
directshow.net
bll
eai
stretchblt
twitter-feed
parentid

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile