Hello everybody
I got a problem with the script. i.e. when i use this php script
then when it send mail to sender the randomly generated
password which is mentioned here by $newpass
doesn't give access the user to log in to account.
what is the problem. How can i resolve this.
Thanking You
Megha
The script is :
Code:<?php error_reporting(E_ALL & ~E_NOTICE); session_start(); include_once('includes/queryfunctions.php'); include_once('includes/functions.php'); $conn=mysql_connect(HOST . ":" . PORT , USER, PASS); if (!$conn) { die('Could not connect: ' . mysql_error()); } mysql_select_db(DB); function make_seed() { list($usec, $sec) = explode(' ', microtime()); return (float) $sec + ((float) $usec * 100000); } if (isset($_POST["submit"]) && $_POST["submit"]=="Send Password"){ srand(make_seed()); $newpass = rand(); $pass = md5($newpass); $loginname = "'" . $_POST[loginname] . "'"; if (!get_magic_quotes_gpc()) { $pass = addslashes($pass); $loginname = "'" . addslashes($_POST['loginname']) . "'"; } //The username you have specified does not match any user in our system. $sql = "SELECT loginname,email,name as usernames FROM users WHERE loginname = '$_POST[loginname]'"; $results = query($sql,$conn); $user = fetch_object($results); $email = $user->email; $usernames = $user->usernames; if(num_rows($results)){ $sql="UPDATE users SET pass='$pass' WHERE loginname=$loginname"; $results=query($sql,$conn); $msg[0]="Sorry no such user found"; $msg[1]="New password has been send to your email address."; AddSuccess($results,$conn,$msg); $commentinfo = "Dear $usernames,\n Your password has been changed to: $newpass.\n You can now login here http://www.erainfotechbd.com/test/login.php?member=A and use the system."; //send new password to user if ((int) $results==1) sendemail($commentinfo,erainfotech,bcc,$email,"Account changed"); }else{ //else warn that user does not exist echo "<center><font color=\"#0033CC\"><b>Sorry, the loginname ".$_POST['loginname']." does not exist.</b></font></center>"; } } ?>



Reply With Quote



Bookmarks