Jump to content

issue with forgot password script


HDFilmMaker2112

Recommended Posts

The below is triggering the "Information entered incorrect." error message, when correct information is entered.

 

function email_verify($email){
return preg_match('/^[^@]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$/', $email);
}

function amount_verify($number){
$bits = explode(",",$number); // split input value up to allow checking
       
$last = strlen($bits[1]); // gets part after first comma (thousands or decimals)

if ($last < 3){
if ($last==0){
$number.=",00";
}
$number = str_replace(".","",$number);
$number = str_replace(",",".",$number);
}

$number = str_replace(",","",$number);

$dec_bits = explode(".",$number); // split input value up to allow checking
       
$dec = strlen($dec_bits[1]); // gets part first decimal point
if ($dec==0){
$number.=".00";
}
$symbol = substr($number, 0, 1); 
if(!ctype_digit($symbol)){
$number = substr($number, 1); 
}
return $number;
}

 



$donation_amount=sanitize($_POST['donation_amount']);
$donation_amount=amount_verify($donation_amount);

$email=sanitize($_POST['email']);

elseif($_GET['forgot']=="password"){
if(email_verify($email)){

$new_password =& generatePassword();

$username=sanitize($_POST['username']);

$newpass=kam3($new_password);
$sql1="UPDATE $tbl_name SET password='$newpass' WHERE username='$username' AND email='$email' AND amount='$donation_amount'";
$result1=mysql_query($sql1);
$num_rows1=mysql_affected_rows();

if($num_rows1==1){
$content.='<p class="center">New password generated. It has been emailed to the email address provided.</p><br />';
$message='Some one (hopefully you) requested a new password be generated for your account on Make the Movie Happen.
Below is the newly generated password:

Password: '.$new_password.'

Once you log-in, please change your password.

Thank You,
Make the Movie Happen Support Team
';
mail($email, 'Make the Movie Happen - New Password', $message, 'From: general@makethemoviehappen.com');
}
else{
header("Location: ./index.php?forgot&e=1");
}
}
else{
header("Location: ./index.php?forgot&e=2");
}
}
else{
$content='<div class="main">
<div class="main_header clear">Forgot Password/Username</div>
<br />
<div>
<p class="eighteen">Forget Password</p>
<p>Enter the information below to reset your password.</p>';
if($_GET['e']=="1"){
$content.='<p class="red">Information entered incorrect.</p>
<p class="red twelve">If you continue to have issues, please email <a href="mailto:general@makethemoviehappen.com">general@makethemoviehappen.com</a> for assistance.</p>';
}
if($_GET['e']=="2"){
$content.='<p class="red">Information entered incorrectly. Please check the format.</p>
<p class="red twelve">If you continue to have issues, please email <a href="mailto:general@makethemoviehappen.com">general@makethemoviehappen.com</a> for assistance.</p>
';
}
$content.='
<form action="./index.php?forgot=password" method="post">
    <p><label>Username:</label> <input type="text" name="username" size="30" /></p>
<p><label>E-Mail of Original Donation/Purchase:</label> <input type="text" name="email" size="32" /></p>
<p><label>Total Donation Amount:</label> <input type="text" name="donation_amount"  size="5" /></p>
    <p><input type="submit" value="Submit" name="Submit" /></p>
    </form>
</div>
<br />
<div>
<p class="eighteen">Forget Username</p>
<p>Enter the information below to have your username emailed to you.</p>';
}

Link to comment
Share on other sites

Not the whole thing, but the most relative stuff. Any way, here's the whole thing:

 

<?php
require_once 'db_select.php';
require_once 'func.php';

$donation_amount=sanitize($_POST['donation_amount']);
$donation_amount=amount_verify($donation_amount);

$email=sanitize($_POST['email']);
if($_GET['forgot']=="username"){
if(email_verify($email)){
$sql3="SELECT * FROM $tbl_name WHERE email='$email' AND amount='$donation_amount'";
$result3=mysql_query($sql3);
$rows3=mysql_fetch_row($result3);
$num_rows3 = mysql_num_rows($result3);
$username=$rows3[0];
if($num_rows3==1){
$content.='<p class="center">Your username has been sent to the provided email address.</p><br />';
$message='Some one (hopefully you) requested your username on Make the Movie Happen.
Below is your username:

Username: '.$username.'

Thank You,
Make the Movie Happen Support Team
';
mail($email, 'Make the Movie Happen - Username', $message, 'From: general@makethemoviehappen.com');
}
else{
header("Location: ./index.php?forgot&e=3");
}
}
else{
header("Location: ./index.php?forgot&e=4");
}
}
elseif($_GET['forgot']=="password"){
if(email_verify($email)){
$new_password =& generatePassword();

$username=sanitize($_POST['username']);

$newpass=kam3($new_password);
$sql1="UPDATE $tbl_name SET password='$newpass' WHERE username='$username' AND email='$email' AND amount='$donation_amount'";
$result1=mysql_query($sql1);
$num_rows1=mysql_affected_rows();

if($num_rows1==1){
$content.='<p class="center">New password generated. It has been emailed to the email address provided.</p><br />';
$message='Some one (hopefully you) requested a new password be generated for your account on Make the Movie Happen.
Below is the newly generated password:

Password: '.$new_password.'

Once you log-in, please change your password.

Thank You,
Make the Movie Happen Support Team
';
mail($email, 'Make the Movie Happen - New Password', $message, 'From: general@makethemoviehappen.com');
}
else{
header("Location: ./index.php?forgot&e=1");
}
}
else{
header("Location: ./index.php?forgot&e=2");
}
}
else{
$content='<div class="main">
<div class="main_header clear">Forgot Password/Username</div>
<br />
<div>
<p class="eighteen">Forget Password</p>
<p>Enter the information below to reset your password.</p>';
if($_GET['e']=="1"){
$content.='<p class="red">Information entered incorrect.</p>
<p class="red twelve">If you continue to have issues, please email <a href="mailto:general@makethemoviehappen.com">general@makethemoviehappen.com</a> for assistance.</p>';
}
if($_GET['e']=="2"){
$content.='<p class="red">Information entered incorrectly. Please check the format.</p>
<p class="red twelve">If you continue to have issues, please email <a href="mailto:general@makethemoviehappen.com">general@makethemoviehappen.com</a> for assistance.</p>
';
}
$content.='
<form action="./index.php?forgot=password" method="post">
    <p><label>Username:</label> <input type="text" name="username" size="30" /></p>
<p><label>E-Mail of Original Donation/Purchase:</label> <input type="text" name="email" size="32" /></p>
<p><label>Total Donation Amount:</label> <input type="text" name="donation_amount"  size="5" /></p>
    <p><input type="submit" value="Submit" name="Submit" /></p>
    </form>
</div>
<br />
<div>
<p class="eighteen">Forget Username</p>
<p>Enter the information below to have your username emailed to you.</p>';
if($_GET['e']=="3"){
$content.='<p class="red">Information entered incorrect.</p>
<p class="red twelve">If you continue to have issues, please email <a href="mailto:general@makethemoviehappen.com">general@makethemoviehappen.com</a> for assistance.</p>
';
}
if($_GET['e']=="4"){
$content.='<p class="red">Information entered incorrectly. Please check the format.</p>
<p class="red twelve">If you continue to have issues, please email <a href="mailto:general@makethemoviehappen.com">general@makethemoviehappen.com</a> for assistance.</p>
';
}
$content.='
<form action="./index.php?forgot=username" method="post">
<p><label>E-Mail of Original Donation/Purchase:</label> <input type="text" name="email" size="32" /></p>
<p><label>Total Donation Amount:</label> <input type="text" name="donation_amount"  size="5" /></p>
    <p><input type="submit" value="Submit" name="Submit" /></p>
    </form>
</div>
</div>
<br />
';
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.