Added code to not send me email when I go to my own resume
authorAndrew DeFaria <Andrew@DeFaria.com>
Fri, 1 Mar 2019 18:12:31 +0000 (11:12 -0700)
committerAndrew DeFaria <Andrew@DeFaria.com>
Fri, 1 Mar 2019 18:12:31 +0000 (11:12 -0700)
web/Resumes/Andrew/index.php

index eb90840..a7a970d 100644 (file)
@@ -72,27 +72,38 @@ function stoptimer () {
   $msg .= '<h1>Somebody just visited your resume.</h1>';
   $msg .= "<p>Here's what I know about them:</p>";
 
+  $me = false;
+
   foreach ($_SERVER as $key => $value) {
-   if (preg_match("/^REMOTE/", $key)) {
-    $msg .= "$key: $value<br>";
+    if (preg_match("/^REMOTE/", $key)) {
+      $msg .= "$key: $value<br>";
+
+      if ($key == 'REMOTE_ADDR') {
+        // Skip me...
+        if ($value == '184.182.63.133') {
+         $me = true;
 
-    if ($key == 'REMOTE_ADDR') {
-     exec("whois $value", $output, $result);
+         break;
+       } // if
 
-     foreach ($output as $line) {
-      $msg .= "$line<br>";
-     } // foreach
+        exec("whois $value", $output, $result);
+
+        foreach ($output as $line) {
+         $msg .= "$line<br>";
+        } // foreach
+      } // if
     } // if
-   } // if
   } // foreach
 
-  $msg     .= '</body></html>';
-  $headers  = "MIME-Version: 1.0\r\n";
-  $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
-  $headers .= "From: Andrew DeFaria <Andrew@DeFaria.com>";
+  if (!$me) {
+    $msg     .= '</body></html>';
+    $headers  = "MIME-Version: 1.0\r\n";
+    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
+    $headers .= "From: Andrew DeFaria <Andrew@DeFaria.com>";
 
-  mail("andrew@defaria.com", "Somebody visited your resume", $msg, $headers);
-  ?>
+    mail("andrew@defaria.com", "Somebody visited your resume", $msg, $headers);
+  } // if
+?>
 </head>
 
 <body onload="blink()" onunload="stoptimer()" id="homepage">