Initial add of defaria.com
[clearscm.git] / defaria.com / php / reportem.php
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2    "http://www.w3.org/TR/html4/strict.dtd">
3 <html>
4 <head>
5   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6   <meta name="GENERATOR" content="Mozilla/4.61 [en] (Win98; U) [Netscape]">
7   <link rel="stylesheet" type="text/css" media="screen" href="/css/Plain.css">
8   <title>Your violation has been reported</title>
9 <?php
10 $ip=$_SERVER ["REMOTE_ADDR"];
11
12 function GetEmails ($ip) {
13   $whois_list = array (
14     "",
15     "whois.arin.net",
16     "whois.nsiregistry.net",
17     "whois.opensrs.net",
18     "whois.networksolutions.com"
19   );
20
21   $email_address = array ();
22
23   foreach ($whois_list as $whois_server) {
24     $lines = "";
25
26     if ($whois_server == "") {
27       $lines = `whois $ip`;
28     } else {
29       $lines = `whois -h $whois_server $ip`;
30     } // if
31
32     preg_match_all ("/\s(\S+\@\S[\.\S]+)/", $lines, $matches, PREG_PATTERN_ORDER);
33
34     foreach ($matches [1] as $match) {
35       $email_address [$match] = $match;
36     } // foreach
37
38     $count = count ($email_address);
39     if (count ($email_address) > 0) {
40       break;
41     } // if
42   } // foreach
43
44   return $email_address;
45 } // GetEmails
46
47 function SendViolation ($email_address) {
48   global $ip;
49
50   $domain  = "DeFaria.com";
51   $contact = "Andrew@DeFaria.com";
52   $subject = "Illegal attempts to break into $domain from your domain ($ip)";
53   $message = "
54 <html>
55 <head>
56   <title>$subject</title>
57 </head>
58 <body>
59   <h3>$subject</h3>
60
61   <p>Somebody from your domain with an IP Address of $ip has been
62   attempting to break into my domain, <a
63   href=\"http://$domain\">$domain</a>. Breaking into somebody else's
64   computer is <font color=\"red\"><b>illegal</b></font> and <font
65   color=\"red\"><b>criminal prosecution can result</b></font>. As a
66   responsible ISP it is in your best interests to investigate such
67   activity and to shutdown any such illegal activity as it is a
68   <u>violation of law</u> and most likely a violation of your user
69   level agreement. It is expected that you will investigate this and
70   send the result and/or disposition of your investigation back to <a
71   href=\"mailto:$contact\">$contact</a>. <font color=\"red\"><b>If you
72   fail to do so then criminal prosecution may result!</b></font>
73 </body>
74 </html>
75 ";
76
77   // To send HTML mail, the Content-type header must be set
78   $extra_headers  = "MIME-Version: 1.0\n";
79   $extra_headers .= "Content-type: text/html; charset=iso-8859-1\n";
80
81   // Additional headers
82   $extra_headers .= "From: Andrew DeFaria <$contact>\n";
83   $extra_headers .= "Cc: $contact\n";
84
85   if (mail ($email_address, $subject, $message, $extra_headers)) {
86     print "Sent violation report to $email_address<br>";
87   } else {
88     print "Error sending violation report to $email_address</br>";
89   } // if
90 } // function
91 ?>
92 </head>
93
94 <body>
95
96 <div class="heading">
97   <h1 class="centered">Your violation has been reported!</h1>
98 </div>
99
100 <div id="content">
101   <p>You have purposely and illegal probed my site to arrive at this page. As a
102   result your IP address <?php echo $ip;?> has been logged and a 
103   report was sent to your ISP.</p>
104
105 <?php
106 $email_addresses = GetEmails ($ip);
107
108 foreach ($email_addresses as $email_address) {
109   SendViolation ($email_address);
110 } // foreach
111 ?>
112
113 </div>
114
115 </body>
116 </html>