|
JOIN
US
Add
your email address
to be included in the alerts and meetings concerning the fate of
Hope Valley. |
$link = mysql_connect('hopevalleyca.netfirmsmysql.com', 'hopevalleyca', 'p6jme');
mysql_select_db(hopevalleyca);
$form='';
$ts = time();
$timestamp = date('Y-m-d h:m:s', $ts );
$result = mysql_query("select email, id from email");
if ($result && mysql_num_rows($result)) {
while ($row = mysql_fetch_assoc($result)) {
while(list($var, $val) = each($row)) {
$rows[$var]=$val;
}
$emailHistory[$row['email']]=$rows['id'];
unset ($rows);
}
}
if (isset($_POST['dir']) && $_POST['dir']=='email'){
$email=strip_tags($_POST['email']);
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
if (!isset($emailHistory[$email]) ){
$res=mysql_query("
INSERT INTO email (timestamp, email, ip)
VALUES ('$timestamp','$email','".$_SERVER['REMOTE_ADDR']."')");
if (!$res){
echo "Error Saving Email. Please try again";
} else {
echo "Thank you for your submission";
$to = "info@hopevalley.com";
$subject = "New Email Registration";
$message = "A new person has signed up for the email list: $email";
$from = "mailserver@hopevalley.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
}
} else {
echo 'Email already submitted';
}
} else {
echo 'Invalid Email. Please Try again | '.$form;
}
} else {
echo $form;
}
?>
|
if (isset($_POST['print']) ) {
$_POST['addr']=str_replace(array("\r", "\n", "\r\n"),' ',$_POST['addr']);
$_POST['addrFriend']=str_replace(array("\r", "\n", "\r\n"),' ',$_POST['addrFriend']);
$res=mysql_query("
INSERT INTO prospective (timestamp, type, donation, name, address)
VALUES ('$timestamp','mail','".$_POST['amount']."','".$_POST['name']."','".$_POST['addr']."')");
if ($_POST['nameFriend'] !=='') {
$res=mysql_query("
INSERT INTO prospective (timestamp, type, name, address)
VALUES ('$timestamp','friend','".$_POST['nameFriend']."','".$_POST['addrFriend']."')");
}
$get='amount='.$_POST['amount'].'&name='.$_POST['name'].'&addr='.$_POST['addr'].'&nameFriend='.$_POST['nameFriend'].'&addrFriend='.$_POST['addrFriend'];
header('Location: http://friendsofhopevalley.org/print.php?'.$get);
}
elseif (isset($_POST['donate']) ) {
$_POST['addr']=str_replace(array("\r", "\n", "\r\n"),' ',$_POST['addr']);
$_POST['addrFriend']=str_replace(array("\r", "\n", "\r\n"),' ',$_POST['addrFriend']);
$res=mysql_query("
INSERT INTO prospective (timestamp, type, donation, name, address)
VALUES ('$timestamp','mail','".$_POST['amount']."','".$_POST['name']."','".$_POST['addr']."')");
if ($_POST['nameFriend'] !=='') {
$res=mysql_query("
INSERT INTO prospective (timestamp, type, name, address)
VALUES ('$timestamp','friend','".$_POST['nameFriend']."','".$_POST['addrFriend']."')");
}
?>
Thank You. Please click the dontate button below to take you to PayPal:
|
} else {
?>
Name:
|
Address:
|
|
|
Other
Interested Person: |
Address:
|
|
|
}
?>
|