My registration confirmation code is not sending out emails.
Please help.
Please help.
Code:
<?php
if (isset($_POST['Submit'])) {
//$Bday = date("dd-mm-yyyy");
include "dbCon.php";
$EmailAd = $_POST['EmailAd'];
$Password = $_POST['Password'];
$Name = $_POST['Name'];
$Gender = $_POST['Gender'];
$Bday = $_POST['Bday'];
$Phone = $_POST['Phone'];
$College = $_POST['College'];
$Course = $_POST['Course'];
$Yr = $_POST['Yr'];
$UserType = $_POST['UserType'];
/* Let's strip some slashes in case the user entered
any escaped characters. */
$EmailAd = stripslashes($EmailAd);
$Password = stripslashes($Password);
$Name = stripslashes($Name);
$Gender = stripslashes($Gender);
$Bday = stripslashes($Bday);
$Phone = stripslashes($Phone);
$College = stripslashes($College);
$Course = stripslashes($Course);
$Yr = stripslashes($Yr);
$UserType = stripslashes($UserType);
/* Let's do some checking and ensure that the user's email address or username
does not exist in the database */
$sql_email_check = mysql_query("SELECT emailad FROM user WHERE EmailAd='$EmailAd'");
// $sql_username_check = mysql_query("SELECT username FROM users WHERE username='$username'");
$email_check = mysql_num_rows($sql_email_check);
// $username_check = mysql_num_rows($sql_username_check);
if(($email_check > 0)){
echo "Please fix the following errors: <br />";
if($email_check > 0){
echo "<strong>Your email address has already been used. Please use a different Email address!<br />";
unset($email_address);
include 'index.php'; // Show the form again!
exit(); // exit the script so that we do not create this account!
}}
// table name
// Random confirmation code
$confirm_code=md5(uniqid(rand()));
$query = mysql_query("INSERT into temp_user (confirm_code, EmailAd, Password, Name, Gender, Bday, Phone, College, Course, Yr, UserType)
VALUES('$confirm_code', '$EmailAd', '$Password', '$Name', '$Gender', '$Bday', '$Phone', '$College', '$Course', '$Yr', '$UserType')");
// $sql= "INSERT INTO user SET Regdate='$now', expire='$exp'";
if($result){
// ---------------- SEND MAIL FORM ----------------
// send e-mail to ...
$to=$emailad;
// Your subject
$subject="Your confirmation link here";
// From
//$header="from: mysite <alart@mysite.org>";
// Your message
mysql_query($query);
$to = $emailad;
$subject = 'Imostars e-mail address confirmation';
$message = "
<p>Hey! Thanks for being part of our alumni portal. Click below to confirm your e-mail address.</p>
<p><a href='http://mysite.org/confirm.php?emailad=$emailad'>below</a></p>";
$headers = "ImoStars Alumni <alart@mysite.org>" . "\r\n" .
'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to,$subject,$message,$headers);
?>
<span style='color:green'>Congratulations, you've registered successfully! A confirmation e-mail has been sent to the address you entered.</span>
}
?>
Comment