Skip to content

Commit

Permalink
lowercase email before usage
Browse files Browse the repository at this point in the history
  • Loading branch information
irhosseinz committed Jul 4, 2019
1 parent f748fe8 commit b2cdd91
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions login.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
if(UM_CAPTCHA_SITE && !UM_VerifyCaptcha($_POST['captcha'])){
$ERROR='ARE YOU A BOT??';
}else{
$_POST['forget']=strtolower($_POST['forget']);
$st=$DB->prepare("select * from users where email=? or email_temp=? order by email!=? limit 1");
$st->bind_param('sss',$_POST['forget'],$_POST['forget'],$_POST['forget']);
if($st->execute() && $r=$st->get_result()->fetch_assoc()){
Expand All @@ -41,6 +42,7 @@
if(UM_CAPTCHA_SITE && !UM_VerifyCaptcha($_POST['captcha'])){
throw new Exception('ARE YOU A BOT??');
}
$_POST['email']=strtolower($_POST['email']);
$e=",expire=TIMESTAMPADD(DAY,".(UM_LOGIN_EXPIRE>0?UM_LOGIN_EXPIRE:365).",NOW())";
$p=UM_randomString(rand(30,40));
$st=$DB->prepare("select * from users where email=? or email_temp=? order by email!=? limit 1");
Expand Down Expand Up @@ -153,6 +155,7 @@
}
if(isset($_GET['forget'])){
?>
<h1>Reset Password</h1>
<form id="form" action="login.php" method="post">
<div class="form-group">
<label for="input_email">Email address</label>
Expand All @@ -176,6 +179,7 @@
<?php
}else{
?>
<h1>Login Form</h1>
<form id="form" action="login.php" method="post">
<div class="form-group">
<label for="input_email">Email address</label>
Expand Down
2 changes: 2 additions & 0 deletions register.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
$DB->close();
exit;
}else if(isset($_POST['email'])){
$_POST['email']=strtolower($_POST['email']);
$query="insert into users set email_temp=?,password=?";
$st_type='ss';
$st_values=array($_POST['email'],UM_PASSWORD($_POST['password']));
Expand Down Expand Up @@ -161,6 +162,7 @@ function(value, element, regexp) {
</nav>

<div class="container">
<h1>Registeration Form</h1>
<?php
if(@$ERROR){
echo '<div class="alert alert-danger" role="alert">'.$ERROR.'</div>';
Expand Down

0 comments on commit b2cdd91

Please sign in to comment.