Jump to content

help with password retrival


xcoderx

Recommended Posts

dear friends im again here with a problem, ok my site stores a registered users details on a folder as usersname.php something like this

 

roger.php

<?php
$password = "d909f530e0103b0fcbd0ba70a836c4ac";
$name = "roger";
$status = "admin";
$email = "[email protected]";
$location = "Great Britain";
$info = "im cool";
$website = "http://www.somesite.com";
?>

 

i would like to add forgot password and when user enters the email they used to registered and send a new password now how do i do that? ???

Link to comment
https://forums.phpfreaks.com/topic/135473-help-with-password-retrival/
Share on other sites

try this, you need to customize to fit your setup html etc.

<?Php session_start();
    
function Validate($user,&$num_rows,&$ry){
         
    $mysql = mysql_connect('my server', 'user','password') or die("Could not connect : " . mysql_error());
    mysql_select_db("database name") or die("Could not select database");
    
    $query = "SELECT * FROM `Inet_User` WHERE eMail = \"$user\""; 
    
    $result = mysql_query($query) or die("Query failed : " . mysql_error());
    $ry = mysql_fetch_array($result, MYSQL_NUM);
    $num_rows = mysql_num_rows($result);

//echo "Query:".$query."<br>";
//echo "Rye:".$num_rows;

    if ($num_rows >0):
        $_SESSION['temp_acc']=$ry;
    endif;    
    mysql_free_result($result);
    mysql_close($mysql);
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Fetch your password</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div>
<br><center>
<font face="Airial" font size="+1">
Enter your e-mail you use to commuicate with us and we will mail your password to that e-mail address.
<br><br>
Make sure to press "Fetch Details" once only, Thank you.
<br>
<br>
<center>
<table align='center' border='1' width='40%' bgcolor='#FF7700'>
<tr>
<form name="fpw" method="POST" action="same php file.php">
<td align="center" height="60">Email : <input type="text" name="user"></td>
</form>
</tr>
<tr>
<td align="center" ><input type="submit" value="Fetch Datails"></td> 
</tr>
<tr><td> </td>
</tr>
</table>

<?php
if (!$user . "B" == "B"){
      
      Validate($user,&$ret,&$acc);
        if ($ret +1>1)
        {
            $MESSAGE="Your password = ".$acc[number of the row where password is stored like 22];
            // $MESSAGE .="\n login <a href='http://www.website.com/dir'>here</a>";
            $FROM="from: Support Team<[email protected]> \r\n";  
            mail($user,"your username",$MESSAGE,$FROM);
            
            echo "<br><br><table align='center' border='5' width='80%' bgcolor='#FF7700'";
            echo "<tr><td align='center'>Your password has been send to $user</td></tr>";
            echo "</table>";
        }else{
            echo "<br><br><table align='center' border='5' width='80%' bgcolor='#FF7700'";
            echo "<tr><td align='center'>Your contact email address is not known to us</td></tr>";
            echo "<tr><td align='center'>Contact our support by pressing <a href=\"contact location\">here</a></td></tr>";
            echo "</table>";
        }
}
?>
<br>
  <br>
  <center><font face="Airial" font size="+1" color="black">
  <a href="index.htm">Back to Start page</a></font>
</body>
</html>

this is all of mine and it works!

dear friends im again here with a problem, ok my site stores a registered users details on a folder as usersname.php something like this

 

roger.php

<?php
$password = "d909f530e0103b0fcbd0ba70a836c4ac";
$name = "roger";
$status = "admin";
$email = "[email protected]";
$location = "Great Britain";
$info = "im cool";
$website = "http://www.somesite.com";
?>

 

i would like to add forgot password and when user enters the email they used to registered and send a new password now how do i do that? ???

 

That's a MD5 hash for the password, meaning you can't just send someone their password unless you either encrypt it somewhere or store it in plaintext (bad!)

 

You may want to build a password reset system instead.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.