When am going to fill a user register page, its all filled data will not insert in sql database, for a reason which confirmation code link is sent on users mail, on click it will not activate and it will give the message like :" Oooops! Your Registration has not been successfully Completed... Please follow the Registration Confirmation Link propely to complete your registration..".
my webpage register link is : http://devadigaportal.co.in/register.php
page config code:
<?PHP
session_start();
include("connection.php");
$sqlsettings = "SELECT * from admin";
$resultsettings = mysql_query($sqlsettings);
$rowsettings = mysql_fetch_array($resultsettings);
$referral_code = $_REQUEST['referral_code'];
if($referral_code)
{
$user_sql = "SELECT LoginID,email FROM users WHERE referral_code='$referral_code'";
$user_result = mysql_query($user_sql,$conn);
$row = mysql_fetch_row($user_result);
$main_userid = $row[0];
$main_user_email = $row[1];
}
$emailMsg = "";
if($POST['continue']=="true")
{
$sql = "SELECT * FROM users WHERE EmailAddress='".mysql_escape_string($POST['email'])."'";
$result = mysql_query($sql,$conn);
$sql2 = "SELECT * FROM users WHERE LoginID='".mysql_escape_string($_POST['login'])."'";
$result2 = mysql_query($sql2,$conn);
if($_REQUEST['dobstatus']=="true")
{
$dobstatus = 1;
}
else
{
$dobstatus = 0;
}
$age = GetAge(mysql_escape_string($POST['year']), mysql_escape_string($POST['month']), mysql_escape_string($_POST['day']));
if (@mysql_num_rows($result)!=0){
$emailMsg = "<font color='#FF0000'><strong>* This E-Mail Address is ALREADY REGISTRED </strong></font>";
}
else if(@mysql_num_rows($result2)!=0){
$emailMsg = "<font color='#FF0000'><strong>* This Profile ID is ALREADY REGISTRED</strong></font>";
}
else if($age < 18 || $age > 60)
{
$emailMsg = "<font color='#FF0000'><strong>You cannot be register with us, if your age is less than 18 or greater than 60</strong></font>";
}
else{
if(!$referral_code)
{
$referral_new_code = md5(uniqid(rand(), true));
$referral_string = "<br/> <br/>Please send the following referral link to your friends so that your profile gets activated <a href='".$rowsettings['url']."/register.php?referral_code=$referral_new_code'>Click here to Register</a>";
}
else
{
$referral_new_code = '';
$referral_string = '';
//Finding the main user userID
$user_sql = "SELECT LoginID FROM users WHERE referral_code='$referral_code'";
$user_result = mysql_query($user_sql,$conn);
$row = mysql_fetch_row($user_result);
$main_userid = $row[0];
$insert_sql = "INSERT INTO users_referral(UserID, newuserID, recorddate)
VALUES ('".$main_userid."', '".mysql_escape_string($_POST['login'])."', NOW())";
//echo $insert_sql;
$result_sql = mysql_query($insert_sql);
}
//exit;
$insert = "insert into users(LoginID, EmailAddress, Password, Gender, BirthDate, BirthMonth, BirthYear, ReligionID, CountryID, ConfirmationCode, referral_code, AddedDate, Age, dobstatus)
VALUES (
'".mysql_escape_string($_POST['login'])."',
'".mysql_escape_string($_POST['email'])."',
'".mysql_escape_string($_POST['password1'])."',
'".mysql_escape_string($_POST['gender'])."',
'".mysql_escape_string($_POST['day'])."',
'".mysql_escape_string($_POST['month'])."',
'".mysql_escape_string($_POST['year'])."',
".$_POST['community'].",
".$_POST['countryofresidence'].",
'".md5(mysql_escape_string($_POST['email']))."',
'".$referral_new_code."',
NOW(),
'".$age."',
".$dobstatus."
)";
$resultt = mysql_query($insert);
if($rowsettings['smtpstatus'] == 1)
{
$email_layout = "<br><br><img src='".$rowsettings['url']."/images/matrimonial-logo-sm.gif'><br><table border='0' width='100%'><tr><Td colspan='2' background='".$rowsettings['url']."/images/footer_seprator.gif' height='2'></Td></tr></table><br><br><br>Dear Member,<br><br>Your Registration with ".$rowsettings['ScriptName']." has been successfully completed, but you need to confirm your registration first by clicking the below link. If you cannot access the confirmation page by clicking at this link, then kindly copy paste this link into your browser's address bar and press enter. After you will confirm your registration, You will be able to create your profile.<br><br><br>click below to confirm your registration:<br><br><a href='".$rowsettings['url']."/registration_confirmation.php?confirm=".md5(mysql_escape_string($POST['email']))."'>".$rowsettings['url']."/registration_confirmation.php?confirm=".md5(mysql_escape_string($POST['email']))."</a>".$referral_string;
require("phpmailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = $rowsettings['smtp'];
$mail->Port = $rowsettings['port'];
$mail->SMTPAuth = true;
$mail->Username = $rowsettings['AdminEmail'];
$mail->Password = $rowsettings['AdminEmailPassword'];
$mail->From = $rowsettings['AdminEmail'];
$mail->FromName = $rowsettings['ScriptName'];
$mail->AddAddress($_POST['email']);
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = "Action Required to Confirm Registration";
$mail->Body = $email_layout;
$mail->Send();
if($referral_code)
{
$new_user_mail= "<br><br><img src='".$rowsettings['url']."/images/matrimonial-logo-sm.gif'><br><table border='0' width='100%'><tr><Td colspan='2' background='".$rowsettings['url']."/images/footer_seprator.gif' height='2'></Td></tr></table><br><br><br>Dear Member,<br><br>Your friend ".$_POST['login']." Joined your group";
$newuser= new PHPMailer();
$newuser->IsSMTP();
$newuser->Host = $rowsettings['smtp'];
$newuser->Port = $rowsettings['port'];
$newuser->SMTPAuth = true;
$newuser->Username = $rowsettings['AdminEmail'];
$newuser->Password = $rowsettings['AdminEmailPassword'];
$newuser->From = $rowsettings['AdminEmail'];
$newuser->FromName = $rowsettings['ScriptName'];
$newuser->AddAddress($mail_user_email);
$newuser->WordWrap = 50; // set word wrap to 50 characters
$newuser->IsHTML(true); // set email format to HTML
$newuser->Subject = "New user ".$_POST['login']." to your group";
$newuser->Body = $new_user_mail;
$newuser->Send();
}
//echo $email_layout;
}
else
{
$to=$_POST['email'];
$email_layout = "<br><br><img src='".$rowsettings['url']."/images/matrimonial-logo-sm.gif'><br><table border='0' width='100%'><tr><Td colspan='2' background='".$rowsettings['url']."/images/footer_seprator.gif' height='2'></Td></tr></table><br><br><br>Dear Member,<br><br>Your Registration with ".$rowsettings['ScriptName']." has been successfully completed, but you need to confirm your registration first by clicking the below link. If you cannot access the confirmation page by clicking at this link, then kindly copy paste this link into your browser's address bar and press enter. After you will confirm your registration, You will be able to create your profile.<br><br><br>click below to confirm your registration:<br><br><a href='".$rowsettings['url']."/registration_confirmation.php?confirm=".md5(mysql_escape_string($_POST['email']))."'>".$rowsettings['url']."/registration_confirmation.php?confirm=".md5(mysql_escape_string($_POST['email']))."</a>".$referral_string;
$subject="Action Required to Confirm Registration";
$description=$email_layout;
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$rowsettings['ScriptName']." <".$rowsettings['AdminEmail'].">\r\n";
$res=@mail($to,$subject,$description,$headers);
}
// echo $email_layout;
header("Location: register2.php?email=".mysql_escape_string($_POST['email']));
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><?PHP echo $rowsettings['ScriptName']?>- Register</title>
Please find if any mistake in coding and let me know the details for the same.
Looking your kind reply
Thanking you sir.