I have a registration/login script (php/mysql) that automatically sends the user the password.
The username is chosen by the registrant, the password is random
I need to modify the script so that the email also includes the selected user name...any help much appreciated.
Partial script as follows.......
$pass = substr(md5($_SERVER['REMOTE_ADDR'].microtime().rand(1,100000)),0,6);
// Generate a random password
$_POST['email'] = mysql_real_escape_string($_POST['email']);
$_POST['username'] = mysql_real_escape_string($_POST['username']);
// Escape the input data
mysql_query(" INSERT INTO
tz2_members(company,first,last,address1,address2,city,state,zip,phone,usr,pass,email,regIP,dt)
VALUES(
'".$_POST['company']."',
'".$_POST['first']."',
'".$_POST['last']."',
'".$_POST['address1']."',
'".$_POST['address2']."',
'".$_POST['city']."',
'".$_POST['state']."',
'".$_POST['zip']."',
'".$_POST['phone']."',
'".$_POST['username']."',
'".md5($pass)."',
'".$_POST['email']."',
'".$_SERVER['REMOTE_ADDR']."',
NOW()
)");
if(mysql_affected_rows($link)==1)
{
send_mail('admin@yourdomain.com',
$_POST['email'],
'Registration System - Your New Password',
'Your password is: '.$pass);
$_SESSION['msg']['reg-success']='We sent you an email with your new password!';
}
else $err[]='This username is already taken!';
}
if(count($err))
{
$_SESSION['msg']['reg-err'] = implode('<br />',$err);
}
header("Location: sdlogin3.php");
exit;
}
?>
Need help with register/login script
Moderator: General Moderators
-
mainsailcom
- Forum Newbie
- Posts: 8
- Joined: Sun Oct 09, 2011 11:09 am
Re: Need help with register/login script
Code: Select all
if(mysql_affected_rows($link)==1)
{
send_mail('admin@yourdomain.com',
$_POST['email'],
'Registration System - Your New Password',
"Your username is: {$_POST['username']}\r\nYour password is: {$pass}");
etc.-
mainsailcom
- Forum Newbie
- Posts: 8
- Joined: Sun Oct 09, 2011 11:09 am
Re: Need help with register/login script
Celuran:
No joy...adding the additional code still returns the new password but does not
include the username
No joy...adding the additional code still returns the new password but does not
include the username
-
mainsailcom
- Forum Newbie
- Posts: 8
- Joined: Sun Oct 09, 2011 11:09 am
Re: Need help with register/login script
Celuran:
My apologies..your code works fine, I had a gremlin elsewhere.
All fine now, Thanks for the help
My apologies..your code works fine, I had a gremlin elsewhere.
All fine now, Thanks for the help