Skip to content

Instantly share code, notes, and snippets.

@rushdimohamed09
Created May 7, 2016 05:46
Show Gist options
  • Save rushdimohamed09/e727e925d29f62e53d102ee70738ff29 to your computer and use it in GitHub Desktop.
Save rushdimohamed09/e727e925d29f62e53d102ee70738ff29 to your computer and use it in GitHub Desktop.
<html>
<title> Registration in process..</title>
<head><style>
.error {color: #FF0000;}
.errorgreen {color: #0C3;}
</style>
</head>
<body>
<?php
// Create connection
$conn = mysqli_connect("localhost", "leebaylk_leebay", "leebay_admin","leebaylk_leebay");
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$replyemail = "leebaylk@gmail.com";
$random = md5(uniqid(rand(), true));
$sql="insert into users values (null,'$fname1','$lname1','$email1','$password1','$cnumber1','$address','$random','0')";
//$email_checker=mysqli_query("SELECT email FROM users WHERE email = '$email1' LIMIT 1" );
//$exist = mysqli_fetch_row($email_checker);
if (mysqli_query($conn, $sql)) {
// $msg = "New record created successfully";
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = $email1;
$email_subject = "ACCOUNT VERIFICATION";
function died($error) {
// your error code can go here
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
$error_message = "";
$email_message = "Please check your account details.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Full Name: ".$fname1." ".$lname1."\n";
$email_message .= "Email: ".$email1."\n";
$email_message .= "Email: ".$password1."\n";
$email_message .= "Contact Number: ".$cnumber1."\n";
$email_message .= "Message: ".($address)."\n";
$email_message .= "Verification code: ".($random)."\n";
// create email headers
$headers = 'From: '.$replyemail."\r\n".
'Reply-To: '.$replyemail."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
echo "<span style='color:green'>Your Account has been sucessfully created. Please check your inbox to confirm your leebay account.</span>";
} else {
if($exist == true){
$msg= "The email address you entered is already exists. Click <a href='login.php'>here</a> to login";
}else{
$msg= "Please check the errors again";
}
}
mysqli_close($conn);
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment