Skip to content

Instantly share code, notes, and snippets.


Created Jan 15, 2017
What would you like to do?
<head><title>Thanks you for subscribing</title></head>
include "config.php";
if (isset($_POST['submit'])) {
$name = $_POST['name'];
$email = $_POST['email'];
$check = mysql_query("SELECT * FROM users WHERE email='$email'");
$check = mysql_fetch_array($check);
$emailcheck = $check['email'];
$hash = md5($email);
if($emailcheck == $email){
echo "<h1>You are already subscribed!</h1>";
$query = mysql_query("INSERT INTO users(name,email,hash) VALUES('$name','$email','$hash')");
if ($query) {
echo "<h1>You Are Successfully Subscribed to our mailing list. Check you email!</h1>";
$link = ''.$hash; //change your domain here.
$to="$email"; //change to ur mail address
$strSubject="HackerRahul | Email Subscription";
$message = '<p>Thank you for subscribing '.$name.'.<br>Email: '.$email.'.</p>' ;
$message .= '<p>Click here to unsubscribe your email : <a href="'.$link.'">
Unsubscribe</a></p>' ;
$headers = 'MIME-Version: 1.0'."\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1'."\r\n";
$headers .= "From:";
$mail_sent=mail($to, $strSubject, $message, $headers);
} else{
echo mysql_error();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.