2 $date_full = date("d M Y, H:i:s");
4 $ip = getenv('REMOTE_ADDR');
5 $ip_proxy = getenv('HTTP_X_FORWARDED_FOR');
6 $host = gethostbyaddr($ip);
9 $email=$_POST['email'];
10 $comments = ($_POST['comments']) ? stripslashes($_POST['comments']) : '';
11 $nopreview= (int)$_POST['nopreview'];
14 $subject="grml bug report: $name";
16 function checkname($name) {
17 $filter = "/^([a-zA-ZöäüÖÄÜß0-9_\.\-\+\ ])+$/";
18 return preg_match($filter,$name);
21 function checkmail($email) {
22 $filter = "/^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/";
23 return preg_match($filter,$email);
26 function badwords($text) {
27 $spamfilter = array('viagra','sex ', 'phentermine','free time', 'you may find', 'interesting', 'good site', 'keep alive', 'webmaster', 'web-master', 'great web', 'casino', 'isurance', 'buy', 'porn', 'loan', 'pharmacy', 'closeup', 'goodlife', 'multipart', 'zion', 'jude', 'ausländer', 'content-type', 'url=');
29 $text = strtolower($text);
30 foreach($spamfilter as $word) {
31 $pos = strpos($text, $word);
44 if(!checkname($name)){
45 $error = "Sorry, this does not seem to be a valid name.";
49 $error = "Sorry, without your email address we won't be able to contact you. ;-)";
52 if (!checkmail($email)) {
53 $error = "Sorry, no valid email address found.";
57 $error = "Empty bug report - we don't like empty messages. ;-)";
60 if(badwords($comments)){
61 $error = "We don't accept spam messages.";
64 if ($error) $nopreview = 1;
68 if (($nopreview == 1) && !$error) {
72 $xtra = "From: $name <$email>\r\n";
73 $xtra .= "Content-Type: text/plain; charset=ISO-8859-15\nContent-Transfer-Encoding: 8bit\r\n";
74 $xtra .= "X-Mailer: PHP ". phpversion();
78 $message="$comments\n";
80 if(mail($to,$subject,$message,$xtra)) {
81 $mailsent = "Sending the message was <b>successful</b>. Thanks for your message.";
83 $error = "An error occured while sending mail. Sorry :-(";