dao
Wed 22 June 2011, 12:40 pm GMT +0200
Hi my code lost password how to method use password md5, hash how to?:
I'am italian my name luigi.
My code custom php user class.
<?php
require_once 'lib/allibrary.php';
if (!empty($_POST['invia'])){
$getUser = $allib->query("SELECT * FROM users WHERE Email = '".$_POST["email"]."'");
if(mysql_num_rows($getUser)==1)
{
$temp_pass = $allib->randomPass(10);
$row = mysql_fetch_assoc($getUser);
$query = $allib->query("UPDATE users SET password='".md5($temp_pass)."', active=1 WHERE Email='".$row['Email']."'");
$email = "My Password new : ".$temp_pass."";
if(mail($row['email'], 'Password your account', $email))
{
$msg = 'Password Resettata , verificare nella posta elletronica.';
$msg .="".$temp_pass."";
}
else {
$error = 'Failed sending email';
}
}
else {
$error = 'There is no member to match your email.';
}
}
?>
<p class="title2">Recupera Password</p>
<?php if ( isset ( $error ) ) { echo ' <p class="error">' . $error . '</p>' . "\n"; } ?>
<?php if ( isset ( $msg ) ) { echo ' <p class="msg">' . $msg . '</p>' . "\n"; } else {?>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
<input type="hidden" name="_submit_check" value="1"/>
<table align="center" width="99%">
<tr>
<td><table width="100%" border="0">
? <tr>
? ? <td>Email</td>
? ? <td><input class="input" type="text" id="email" name="email" size="32" value="<?php if(isset($_POST['email'])){echo $_POST['email'];}?>" /></td>
? ? ? </tr>
? <tr>
? ? <td><input type="submit" name="invia" value="Recupera" ? alt="submit" title="submit" /></td>
? ? <td>.</td>
? ? ? </tr>
? ? </table></td>
</tr>
</table>
</form>
<?php } ?>
I'am italian my name luigi.
My code custom php user class.
<?php
require_once 'lib/allibrary.php';
if (!empty($_POST['invia'])){
$getUser = $allib->query("SELECT * FROM users WHERE Email = '".$_POST["email"]."'");
if(mysql_num_rows($getUser)==1)
{
$temp_pass = $allib->randomPass(10);
$row = mysql_fetch_assoc($getUser);
$query = $allib->query("UPDATE users SET password='".md5($temp_pass)."', active=1 WHERE Email='".$row['Email']."'");
$email = "My Password new : ".$temp_pass."";
if(mail($row['email'], 'Password your account', $email))
{
$msg = 'Password Resettata , verificare nella posta elletronica.';
$msg .="".$temp_pass."";
}
else {
$error = 'Failed sending email';
}
}
else {
$error = 'There is no member to match your email.';
}
}
?>
<p class="title2">Recupera Password</p>
<?php if ( isset ( $error ) ) { echo ' <p class="error">' . $error . '</p>' . "\n"; } ?>
<?php if ( isset ( $msg ) ) { echo ' <p class="msg">' . $msg . '</p>' . "\n"; } else {?>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
<input type="hidden" name="_submit_check" value="1"/>
<table align="center" width="99%">
<tr>
<td><table width="100%" border="0">
? <tr>
? ? <td>Email</td>
? ? <td><input class="input" type="text" id="email" name="email" size="32" value="<?php if(isset($_POST['email'])){echo $_POST['email'];}?>" /></td>
? ? ? </tr>
? <tr>
? ? <td><input type="submit" name="invia" value="Recupera" ? alt="submit" title="submit" /></td>
? ? <td>.</td>
? ? ? </tr>
? ? </table></td>
</tr>
</table>
</form>
<?php } ?>