Jeg har lavet et spørgeskema på nettet, som folk forhåbentlig vil svare på.
Det drejer sig om at jeg gerne vil have afsenderens ip i den mail jeg
modtager, det kan jeg bare ikke få til at lykkedes.
Jeg kan forestille mig at problemet er der, hvor jeg har markeret med
<<<-----
Som det ses er koden her nedenunder. den er ret rodet, men jeg har også
rettet lidt i den for at få den til at virke.
Men den virker da, og al tak til burt som giver os begyndere en mulighed
Jeg vil blive glad for jeres svar.
mvh Kim
<?
### --- PHP Form2Email v1.3 Copyright burt@dotdragnet.co.uk 2001 --- ###
### --- No changes below this line --- ###
$version = "v1.3";
function show($error, $message){
global $version;
unset($GLOBALS["version"]);
echo "<html><head><title>Form2Email $version</title></head><body>";
echo "<table width=\"500\" border=\"1\" cellspacing=\"1\"
cellpadding=\"0\" align=\"center\" bordercolor=\"#000000\">\n";
echo "<tr><td bgcolor=\"#CCCCCC\"><h5 align=\"center\"><font
face=\"Verdana, Arial, Helvetica, sans-serif\">$error\n";
echo "</font></h5></td></tr><tr><td height=\"115\"
bgcolor=\"#99CCFF\">\n";
echo "<div align=\"center\"><font face=\"Verdana, Arial, Helvetica,
sans-serif\" size=\"2\">$message</font></div></td></tr><tr><td
bgcolor=\"#CCCCCC\">\n";
echo " ...</font></div>";
echo "</td></tr></table></body></html>";
}
if ($action == "send"){
// Date and Time
$time = date("F jS Y, h:iA");
// Grab the config file
require "configmail.inc.php";
// Do we need to log the IP addresses ?
if ($logip == "1"){
// Open the logfile
if (!file_exists($logipfile)){
$error = "Form Error (No Log File)";
$message = "<b>Warning</b> \"Log IP\" file does not exist -
please make a text file named <b>$textname</b> and CHMOD it 777";
show($error, $message);
exit;
}
$fp = @fopen("$logipfile", "a");
if (!($fp)){
$error = "Form Error (CHMOD)";
$message = "<b>Warning</b> The \"Log IP\" file is not set CHMOD
777";
show($error, $message);
exit;
}
}
// Iterate through all the POST variables, add them to the message body:
$message = "";
// Start Iterate
while (list($key, $value) = each($HTTP_POST_VARS)){
$message .= $key . ': ' . $value . "\r\n";
}
// Add extra Info
$message .= "\n\n--------------- Extra Information ---------------\n\n";
$message .= "Powered by Form2Email $version from
www.dotdragnet.co.uk
\n";
$message .= "Submitted: $time"."\n";
$message .= "IP Address: $ip"."\n"; <<<----- <<<-----
$message .= "Browser version: $browser";
// Grab the env config file
if ($envreport == "1"){
require "configenv.inc.php";
}
if (!isset($recipient)){
$recipient = $whoto;
}
if (getenv("REQUEST_METHOD") == "GET"){
$error = "Form Error (Request Method)";
$message = "You may only use this script using the \"POST\" method
from this domain<br><br>$HTTP_HOST";
show($error, $message);
exit;
}
else {
mail("$recipient", "Feedback Results", $message, "From:
$email");
}
if ($logip == "1"){
fputs($fp, "$ip // $time // $email \n");
// close the textfile
fclose($fp);
}
if ($thankspage == "1"){
header("Location: $pagelocation");
}
else {
$error = "Din besked er afsendt og indgår i min statistik.";
$message = $thanksmessage;
show($error, $message);
exit;
}
}
?>