Newsletter Sign-Up
To receive our occasional newsletter and updates, please enter your e-mail address in the box below.
#
# subscribe.php - User request for newsletter subscription
#
include("/home/html/.treenews.php");
con_db();
###########
# MAIN
###########
if ($action != "signup")
{
echo "
"; } else { if ( valid_email ( $email )) { $path=$HTTP_HOST."/newsletter/activate.php"; subscribe_notice( $email, $path ); } else { print_alert("Please check your e-mail address and subscribe again.", $email); } } ########### # E-mail Validation Function ########### function valid_email ($host) { // replace any ' ' and \n in the email $host = eregi_replace("\n", "", $host); $host = eregi_replace(" +", "", $host); $host = strtolower( $host ); // check the e-mail syntax if (empty($host) || eregi("^[0-9a-z_]([-_.]?[0-9a-z])*@[0-9a-z][-.0-9a-z]*\\.[a-z]{2,3}[.]?$", $host, $check)) { $host = substr(strstr($check[0], '@'), 1)."."; if ( getmxrr($host, $validate_email_temp) ) return TRUE; // THIS WILL CATCH DNSs THAT ARE NOT MX. $arr = explode( ".", $host); $count = count($arr); $tld = $arr[$count - 2].".".$arr[$count - 1]; if(checkdnsrr($tld, "MX")) return TRUE; } return FALSE; } ########## # Print Alert Box on Browser ########## function print_alert ( $pass, $mail ) { echo "
\n"; echo "
"; exit; } ########## # Send Subscription Notice - Part 1 ########## function subscribe_notice ( $email, $path ) { $query = mysql_query ("SELECT * FROM activate ORDER BY id DESC"); $mailid = mysql_result($query,0,"id"); $mailid++; $ID = uniqid("m"); $date=date("Y-m-d-H:i:s",time() ); $query = mysql_query ("INSERT INTO activate (id, email, code, date) VALUES ('$mailid', '$email', '$ID', '$date')"); $subject = "EdensLostAndFound.org News & Alerts Subscription Confirmation"; $message = " You have asked to be added to the subscription list for e-mail newsletters and alerts from edenslostandfound.org. We don't want to send our information to anyone who doesn't want it, so to confirm that your email address is correct, please click on the link below or enter it in the address line of your Internet browser. If you do not do this, your address will not be entered in our database. http://".$path."?uid=$ID You may leave our subscription list at any time. To unsubscribe, click on the link which appears at the bottom of every newsletter. EdensLostAndFound.org "; mail("$email", "$subject", "$message", "From: "); echo "
\n"; exit; } ?>