//require_once( "../cgi/common.php" );
require_once( "../cgi/mime_mail.inc" );
require_once( "../cgi/smtp_mail.inc" );
$http_vars = array( 'your_name', 'your_email', 'friend_name', 'friend_email', 'topic', 'url', 'submit' );
set_globals();
magic_quotes_remove();
$errormessage = null;
$this_page = 1;
// ******************************************************************
$smtp_server = "localhost";
//$smtp_server = "foraker.com";
$default_from_name = "In Clover Web site";
$default_from_address = "contact@inclover.com";
$set_email_from_as_contact_email = true;
$require_email_address = true;
// ******************************************************************
function htmlClean( $s )
{
if ( $s )
return htmlentities( trim( $s ));
}
function cleanName( $thename )
{
return ereg_replace( "[^ a-zA-Z-]", "", $thename );
}
function echoHTML( $s )
{
echo htmlClean( $s );
}
function magic_quotes_remove()
{
global $http_vars;
if ( get_magic_quotes_gpc() )
{
for ( $i = 0; $i < count( $http_vars ); $i++ )
{
$key = $http_vars[ $i ];
$GLOBALS[ $key ] = stripslashes( $GLOBALS[ $key ] );
}
}
}
function set_globals()
{
global $http_vars;
for ( $i = 0; $i < count( $http_vars ); $i++ )
{
$key = $http_vars[ $i ];
$GLOBALS[ $key ] = $_REQUEST[ $key ];
}
}
function isValidEmail( $theemail )
{
$regexp = "^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$";
if ( eregi( $regexp, $theemail ))
return true;
return false;
}
$email = trim( $email );
if ( $submit != null )
{
if ( $friend_name == null )
$errormessage = "Please provide your friend's name";
else if ( $friend_email == null )
$errormessage = "Please provide your friend's e-mail address";
else if ( isValidEmail( $friend_email ) == false )
$errormessage = "Your friend's e-mail address appears to be invalid. Please check it to make sure it is correct";
else if ( $your_name == null )
$errormessage = "Please provide your name";
else if (( $require_email_address == true ) and ( $your_email == null ))
$errormessage = "Please provide your e-mail address";
else if (( $your_email != null ) and ( isValidEmail( $your_email ) == false ))
$errormessage = "Your e-mail address appears to be invalid. Please check it to make sure it is correct";
if ( $errormessage == null )
{
$to = cleanName( $friend_name ) . " <$friend_email>";
$to_address = $friend_email;
if (( $set_email_from_as_contact_email ) and ( $your_email != null ) and ( isValidEmail( $your_email )))
{
$from = cleanName( $your_name ) . " <$your_email>";
$from_address = $your_email;
}
else
{
$from = $default_from_name . " <$default_from_address>";
$from_address = $default_from_address;
}
$body = "";
if ( $your_name != null )
$subject = "In Clover information from $your_name";
else
$subject = "In Clover Information for you";
if ( $friend_name != null )
$body = "Dear " . $friend_name . ",\n\n";
else
$body = "Dear Friend,\n\n";
$body .= "Your friend";
if ( $your_name != null )
$body .= ", " . $your_name . ", ";
$body .= "wants to share the In Clover Web site with you:\n\n";
$body .= "http://www.inclover.com\n\n";
$body .= "(NOTE: If you are unable to click directly on this link, please paste it into your web browser)\n\n";
//$mail = new mime_mail;
//$mail->from = $from;
//$mail->to = $to_address;
//$mail->headers = "Reply-to: $from_address";
//$mail->subject = $subject;
//$mail->body = $body;
//$data = $mail->get_mail();
//$smtp = new smtp_mail;
//if ( $smtp->send_email( $smtp_server, $from_address, $to_address, $data ) == true )
//$this_page = 2;
// SMTP doesn't seem to work for inclover - use the mail() functionTest
$headers = "FROM: $from_address\n";
$headers .= "Reply-to: $from_address\n";
if (mail($to_address, $subject, $body, $headers))
$this_page = 2;
else
$errormessage = "Sorry, we encountered an error while trying to send this page to your friend. This may be due to some technical issues on our end, a connection problem on your end, or someone else's problem in between. Please try again later.";
}
}
?>
In Clover - Working with Nature to Maximize Pet Health
|
|
|
|
|
|
|
if (( $errormessage != null ) or ( $this_page == 1 )) { ?>
} else { ?>
} ?>
|
|
| |
|
©2008 In Clover, Inc. All rights reserved. |
|
|