NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page forgotten password

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 07-09-2006, 12:44 PM THREAD STARTER               #1 (permalink)
Account Closed
Join Date: Jul 2006
Posts: 81
electricbeat is an unknown quantity at this point
 



forgotten password


PHP Code:
<?php
include("config.php");
?>
<form method="post">


Forgot your password?
Email address<input type="text" name="email">
<input type="submit" name="lostpass" value="Recover Password">
<?php
if(isset($_POST['lostpass'])) {
????: NamePros.com http://www.namepros.com/programming/215165-forgotten-password.html
$email $_POST['email'];

$select mysql_query("SELECT * FROM users WHERE email='$email'") or die(mysql_error());
????: NamePros.com http://www.namepros.com/showthread.php?t=215165
$checkmail mysql_num_rows($select) or die(mysql_error());
$query mysql_fetch_object($select) or die(mysql_error());

if(empty(
$email)) {
    echo 
"<tr><td colspan='2'>You need to fill in an email</td></tr>";
}elseif(!
ereg("^[_a-zA-Z0-9-]+(\.[*@([a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,4})$"$email)) {
    echo 
"<tr><td colspan='2'>Your email has to be valid</td></tr>";
}elseif(
$checkmail == 0) {
    echo 
"<tr><td colspan='2'>This email address was not found in our database</td></tr>";
}else{

$username $query->username;
$password createcode($len
    { 
        
$nps ""
        
mt_srand ((double) microtime() * 1000000); 
        while (
strlen($nps)<$len) { 
        
$c chr(mt_rand (0,255)); 
        if (
eregi("^[a-z0-9]$"$c)) $nps $nps.$c
        } 
        return (
$nps); 
    } 

$hash md5($password);

mysql_query("UPDATE users SET password = '$hash' WHERE username = '$username'");

        
mail($email"New Password""
Hi 
$username,
Here is your password you requested
   
   Username: "
.$username."
   Password: "
.$password."
   
"
);

echo 
"<tr><td colspan='2'>Your new password has been send to you</td></tr>";

        }
    }
?>
I have that - it doesn't work. It send the user an thats about it. it doesn't generate or update a new password in the mysql database. Can anyone either make it so it sends the users current password to the users email or can anyone generate a random password, update the mysql db and send it to the user?
electricbeat is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 02:07 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger