Forum Moderators: coopster
You have successfully Registered
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\register.php on line 65
Your information has been mailed to your email address.
this is the code:
<html>
<head>
<title>Register</title>
<head>
<body>
<?PHP
//Connect to database
mysql_connect("localhost", "admin", "admin") or die(mysql_error());
mysql_select_db("ueros_db") or die(mysql_error());
$name = $_POST['name'];
$email = $_POST['email'];
$username = $_POST['username'];
$password = md5($_POST['password']);
$emailedpass = $_POST['password'];
// lets check to see if the username already exists
$checkuser = mysql_query("SELECT username FROM users WHERE username='$username'");
$username_exist = mysql_num_rows($checkuser);
if($username_exist > 0){
echo "I'm sorry but the username you specified has already been taken. Please pick another one.";
unset($username);
include 'register.html';
exit();
}
// lf no errors present with the username
// use a query to insert the data into the database.
$query = "INSERT INTO users (name, email, username, password)
VALUES('$name', '$email', '$username', '$password')";
mysql_query($query) or die(mysql_error());
mysql_close();
echo "You have successfully Registered";
// mail user their information
$mysite = ‘www.example.com’;
$webmaster = ‘adib’;
$myemail = "email@example.com";
$subject = "You have successfully registered at $mysite...";
$message = "Dear $name, you are now registered at our web site.
To login, simply go to our web page and enter in the following details in the login form:
Username: $username
Password: $emailedpass
Please print this information out and store it for future reference.
Thanks,
$webmaster";
mail($email, $subject, $message, "From: $mysite <$myemail>\nX-Mailer:PHP/" . phpversion());
echo "Your information has been mailed to your email address.";
?>
</body>
</html>
anyone can help me with this?
thanks
[edited by: eelixduppy at 4:40 pm (utc) on Aug. 28, 2008]
[edit reason] exemplified [/edit]