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 = "none@none.com";
$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
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<xxx@website.com> \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!

Link to comment
Share on other sites

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 = "none@none.com";
$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.

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.