Hi all i have done a system using php but in my login page made a forgot password link, but dont have any domain name can anyone tell me how i can do that make it work, as in my php when user if forgot the password they system will send a random password to there system but cannot do that. Here is blow my code Thanks all.
PHP Code:<?php
session_start();
// 'Forget your Member Password' script
// Include Files
require_once ("database.php");
require_once ("globals.php");
require_once ("loginlib.php");
$title = $g_system_name . " -- Password reset";
ShowHeader ($title);
echo "<body>";
ShowLinks (3);
$header="User password reset";
$comment = "";
if (isset($_POST['state'])) {
$custemail = $_POST['email'];
// ·-·
$sql_stm = "select cu_user, cu_fname from customer where cu_email = '$custemail'";
$result = mysql_query($sql_stm);
$status = 0;
if($result && (mysql_numrows($result) >= 1)){
$dbarray = mysql_fetch_array($result);
$custname = $dbarray['cu_fname'];
$userid = $dbarray['cu_user'];
$username = GetusernameXID ($userid);
$password = GetRandomPassword();
UpdatePassword ($userid, $password); // update the password in the database
$from = ""; [QUOTE] what shall i put inside that "" so send user random password[/QUOTE]
$ccText = "";
$bccText = "";
$msg = "Hi $custname,\n\nYou have recently requested that a new password be sent to your email address.
Your Login is: $username\n\nYour new Password is: $password\nClick the link below to log in.\n
http://127.0.0.1/login.php\n\nSincerely,\n\nWeb Space Management system Team";
$title="PhpMail";
$toText=$custemail;
$subjectText="Your Random Member Password";
mail($toText, $subjectText, $msg,"To: $toText <$toText>\n" ."From: $from <$from>\n" .$ccText.$bccText. "X-Mailer: PHP 4.x");
$comment = "Email sent!";
} else {
$comment = "No such member account found. Please try a different email";
}
}
?>
<CENTER>
<TABLE WIDTH=400 BORDER=0 CELLPADDING=0 CELLSPACING=0>
<TR VALIGN=TOP>
<TD WIDTH=400 BGCOLOR="#3bb2d9">
 
<center>
<font face=arial size=4>
<b>
<?php
echo "<h1><font size='4'><font color='#FFFF00'>$header</font></font></h1>";
if (strlen($comment = trim($comment)) > 0)
echo "<p>$comment</p>";
?>
</b></font>
</center>
<form method="POST" action="passreset.php">
<table width=400 border=0 cellspacing=10 cellpadding=0>
<tr>
<td colspan='2' valign=top align=left>
Enter your member email address below,
and we'll send you a new password.</td></tr>
<tr>
<td valign=top align=left>
<font face=arial size=-1>
<b>Member Email:</b></font></td>
<td valign=top align=center>
<input type=text name="email" size=25>
</td>
</tr>
<tr><td colspan='2' valign=top align=center>
<input type="submit" value="Send">
<input type="hidden" name="state" value="1">
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</center>
</BODY>
</HTML>




Reply With Quote