HDFilmMaker2112 Posted June 28, 2011 Share Posted June 28, 2011 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>'; } Quote Link to comment Share on other sites More sharing options...
jcbones Posted June 28, 2011 Share Posted June 28, 2011 Is this the whole script? Quote Link to comment Share on other sites More sharing options...
HDFilmMaker2112 Posted June 28, 2011 Author Share Posted June 28, 2011 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 /> '; } ?> Quote Link to comment Share on other sites More sharing options...
revraz Posted June 28, 2011 Share Posted June 28, 2011 And what is the URL that brings you to this page? Quote Link to comment Share on other sites More sharing options...
HDFilmMaker2112 Posted June 28, 2011 Author Share Posted June 28, 2011 And what is the URL that brings you to this page? http://www.makethemoviehappen.com/index.php?forgot The page was working perfectly... I just recently added the amount formatting and the preg_match for the email address. Since then it hasn't been working. Quote Link to comment Share on other sites More sharing options...
HDFilmMaker2112 Posted June 28, 2011 Author Share Posted June 28, 2011 Wow... I'm stupid. I didn't have .00 in my database entries. It was failing because the amount from the function has the decimal point added. Sorry guys. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.