1

我是 php 新手,我有一个表格需要获取信息并通过邮件发送给我。问题是有时我收到的电子邮件只包含一个 IP 地址而没有其他内容。我尝试按下“发送”而不在字段中输入任何内容,我收到一封电子邮件,其中包含除问题答案之外的所有其他内容,因此看起来并非如此。我的问题是为什么我会收到只包含 IP 地址的电子邮件?谢谢!

<?php
    $to = "mail@gmail.com";
    $subject = "energiebio contact form: {$_POST['ams']['Destination']} ";
    $from = $_POST['ams']['E-mail'];
    $valid=1;
    $message ='';

    foreach ($_POST['mas'] as $k=>$v){
        if (trim($v)=='')$valid=0;
        $k = str_replace('_',' ',$k);
        $message .="$k : $v<br>";
    }

    $message .="<hr />IP: {$_SERVER['REMOTE_ADDR']}";

    function sndmail($from,$to,$subject,$message){
        $headers = "MIME-Version: 1.0\r\n";
        $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
        $headers .= "From:".$from ."\r\n";
        mail($to, $subject, $message, $headers);
    }

    if ($valid=='1') {
        sndmail($from,$to,$subject,$message);
        header( 'Location: http://site.ro/danke.html' ) ;
    }else header( 'Location: http://site.ro/error.html' ) ;
?>

我发现它是同一个 IP,而且我无法在其上获得相同的“whois”:92.85.174.105

4

1 回答 1

1

我会说一些东西,例如谷歌机器人或垃圾邮件机器人,在不使用您的表单的情况下点击您的电子邮件脚本。如果你有这样的 HTML:

<form action="postmail.php">
<!-- stuff -->

a script can just hit your "postmail.php" without using the send button. Then body content would be empty, and you'd get an empty email containing nothing but the senders ip.

于 2012-10-22T12:08:24.403 回答