Gå til innhold

Hjelp Php contact


Anbefalte innlegg



<?php

/*

Email Processing Program
By James Warkentin
Copyright 2005

Optional Variables used by the script
$destination_email
$followup_url
$required
$subject

Variables Requuired for Autoresponder
$autoresponse_file
$email

*/

################################## BEGIN EDITING HERE ##################################
# You will want to configure the following variables to suit your needs

# This variable will be used if the destination_email variable is not set on the form.
$default_destination_email = "[email protected]";

# The name of your website
$site_name = "HVusortland";

# The default followup URL in case one isn't supplied on the form.
$default_followup_url = "http://www.itverden.com";

# The value of this variable will be displayed if the followup_url is not specified.
$default_response = "Thank you for contacting us.<br>We will respond to your email as soon as possible";

################ YOU SHOULDN'T NEED TO EDIT ANYTHING BEYOND THIS POINT ################


function error($code = "No Error Specified")
{
global $destination_email;
mail("$destination_email","FORM_CONTACT Script Error","Warning!
The FORM_CONTACT script on your site generated the following error:
$code","From: $destination_email");
}


if($HTTP_POST_VARS)
{
if(!$destination_email)
{
$destination_email = $default_destination_email;
}
if($destination_email == "[email protected]")
{
echo "Script Error:  This form processing script has not yet been correctly set up.<br>Please contact the webmaster.";
exit;
}

$arrexclude = array("Submit", "destination_email", "required", "followup_url");
if($required){
$a_required = explode(" ",$required);
for ($n = 0; $n < count($a_required); $n++)
{
if(!$HTTP_POST_VARS[$a_required[$n]])
{
 echo "You must enter a value for: $a_required[$n]";
 exit;
}
}
}

$msg = "";
while (list($key, $value) = each($HTTP_POST_VARS)) {
$exclude = false;
for ($n = 0; $n <= count($arrexclude); $n++) {
if ($key == $arrexclude[$n]) {
 $exclude = true;
}
}

if ($exclude == false) {
$key = strtoupper($key);
$msg .= "\n\n".$key.": \n";
if (is_array($value)) {
 for ($n =0; $n < count($value); ++$n) {
  $msg .= $value[$n]."\n   ";
 }
} else {
 $msg .= $value;
}
}
}

$msg = trim(stripslashes($msg));

mail("$destination_email","Website Feedback Form: $subject","$msg\n","FROM: $destination_email");

if($autoresponse_file && $email)
{
if(@$file = implode(file("autoresponse/$autoresponse_file"), ""))
{
$fp = 0;
while(strpos(" $file", "{~", $fp))
{
 $fp = strpos($file, "{~", $fp);
 $ep = strpos($file, "~}", $fp)+2;
 $temp = substr($file, $fp, $ep-$fp);
 $temp2 = substr($temp, 2, strlen($temp)-4);

 if(strpos("-$temp", " "))
 {
  error("You may not have spaces in variable names in the autoresponse files.
The file containing the error is: $autoresponse_file");
  break;
 }

 if(strpos("-$temp", "\n"))
 {
  error("You may not have newline characters in the autoresponse files.
The file containing the error is: $autoresponse_file");
  break;
 }

 $file = str_replace($temp, $$temp2, $file);
}
mail("$email","$site_name: Automated Response","$file","From: $destination_email");
}
else
{
error("The following form asked for a non-existent autoresponse to be sent:\n$HTTP_REFERER\n\nThe autoresponse file that it asked for was:\n$autoresponse_file");
}
}

if(!$followup_url) $followup_url = $default_followup_url;
if($followup_url != "http://www.your site name.com/thanks.html")
header("Location: $followup_url");
else
echo "$default_response";

}
?>

 

Hvordan kanb jeg inkludere senders IP=

Lenke til kommentar
Videoannonse
Annonse

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
  • Hvem er aktive   0 medlemmer

    • Ingen innloggede medlemmer aktive
×
×
  • Opprett ny...