OK -
First, I put a link in my webpage like, "href="http://www.mysite.com/tell_a_friend/index.php"
Then I upload the index.php and settings.php to a folder "tell_a_friend" on my host. (Does it matter that it's a Windows server??)
I hadn't changed the index.php or settings.php when it stopped working. The only thing I can think of that changed, is that I moved to a different server. I don't know anything about PHP, except that I used it in this case to perform a needed function.
Here's the index.php:
<?php
include('settings.php');
// If they submitted the form
if ($Submit=="Submit"){
//****************************************************************************************************
function check_email($email) {
if( (preg_match('/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/', $email)) ||
(preg_match('/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/',$email)) ) {
return true;
}
return false;
}
//****************************************************************************************************
// Retrieve all the info
$pageurl = $_POST["pageurl"];
$in_name = $_POST["name"];
$in_email = $_POST["email"];
$in_count = $_POST["count"];
$in_message = $_POST["message"];
// Loop through the recipients email, only count the valid ones
for ( $count=1; $count<=$in_count; $count++ ){
$email = $_POST["friend_" . $count];
if ( check_email($email) ){
$to_emails[$count] = $email;
$bcc .= "$email";
if ($count != $in_count){
$bcc .=", ";
}
}
}
// Validate the info
if ( empty($in_name) ){ $error="yes"; $log[] = "$msg_name"; };
if ( empty($in_message) ){ $error="yes"; $log[] = "$msg_message"; };
if ( !check_email($in_email) ){ $error="yes"; $log[] = "$msg_email"; };
if ( empty($to_emails[1]) ){ $error="yes"; $log[] = "$msg_recipient"; };
// Start forming the email
$mail_from = "$in_email";
$mail_replyto = "$in_email";
$mail_bcc = $bcc;
$mail_headers = "From: $in_name <$mail_from>\r\n";
$mail_headers .= "Reply-to: $mail_replyto\r\n";
$mail_headers .= "Bcc: $mail_bcc";
$mail_subject = "$subject";
$mail_message = "The following Virtual Tour was sent to you by $in_name\n";
$mail_message .= "Click here:\n";
$mail_message .= "$pageurl \n\n";
$mail_message .= "$in_message";
if ( $error != "yes" ){ // If there are no errors, send the email(s)
if ( mail($mailto, $mail_subject, $mail_message, $mail_headers) ){
$log[] = "$msg_success";
}else{
$log[] = "$msg_failure";
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><? print $setting_title; ?></title>
<style type="text/css">
</body>
</html>
Here's the settings.php:
<?php
// Be sure when editing the following, you keep the words surrounded by double quotes, and ending in a semicolin if that's the way it was.
// FOLLOW THE PATTERN!
// message reported if they didn't fill in a valid name
$msg_name = "Your name is required";
// message reported if they didn't fill in a valid message
$msg_message = "A message is required";
// message reported if they didn't fill in a valid email
$msg_email = "Your email address is not valid";
// message reported if they didn't fill at least one valid recipient
$msg_recipient = "At least one recipient email is required";
// message reported if they try to add too many recievers
$msg_toomuch = "If you want to tell the whole world, dont do it all at once please";
// message reported if the emails were successfully sent
$msg_success = "Your messages have been sent! Please go back to the tour page.";
// message reported if the emails were NOT successfully sent
$msg_failure = "Your messages could not been sent!";
// What the emails subject will be
$subject = "Check out this Virtual Tour";
// The maximum nuber of recievers, 15 is recomended
$setting_limit = 10;
// The title of the tell-a-friend page
$setting_title = "Show-A-Friend";
?>
Any ideas??
-jinx