Hi PHP guys...
All I wanna do is the user to receive an activation link after an easy registration. I do everything locally and I set up a local mail server either. When a user enters their mail in a text input how can a link be redirected to this particular mail ? I've been trying mail() but with no results.Any comments max appreciated. Here's the script :
-----------------
$email = mysql_real_escape_string($_POST['email']);
//Get MD5 hash of password
$password = ($_POST['password']);
//Check to see if username exists
$sql = mysql_query("SELECT username FROM usersystem WHERE username = '$username'");
If (mysql_num_rows($sql)>0)
{
die ("This username has been already taken!.");
}
$any=mysql_query("INSERT INTO usersystem (username, password, email) VALUES ( '$username', '$password', '$email')") or die (mysql_error()); echo "<html><br/><br/>Account created.</html>";
if ($any) {
$to = "$email" ;
$from = "newuser@localhost";
$subject = "Complete yourdomain registration";
//Begin HTML Email Message
$message = "Hi $firstname, Thank you for submitting your mail!" ;
//end of message
$headers = "From: $from\r\n";
$headers .= "Content-type: text\r\n";
mail($to, $subject, $message, $headers);
mail ($to) ;
}
}
All I wanna do is the user to receive an activation link after an easy registration. I do everything locally and I set up a local mail server either. When a user enters their mail in a text input how can a link be redirected to this particular mail ? I've been trying mail() but with no results.Any comments max appreciated. Here's the script :
-----------------
$email = mysql_real_escape_string($_POST['email']);
//Get MD5 hash of password
$password = ($_POST['password']);
//Check to see if username exists
$sql = mysql_query("SELECT username FROM usersystem WHERE username = '$username'");
If (mysql_num_rows($sql)>0)
{
die ("This username has been already taken!.");
}
$any=mysql_query("INSERT INTO usersystem (username, password, email) VALUES ( '$username', '$password', '$email')") or die (mysql_error()); echo "<html><br/><br/>Account created.</html>";
if ($any) {
$to = "$email" ;
$from = "newuser@localhost";
$subject = "Complete yourdomain registration";
//Begin HTML Email Message
$message = "Hi $firstname, Thank you for submitting your mail!" ;
//end of message
$headers = "From: $from\r\n";
$headers .= "Content-type: text\r\n";
mail($to, $subject, $message, $headers);
mail ($to) ;
}
}