daily pastebin goal
56%
SHARE
TWEET

ErrorReportingServer.cs

starbeamrainbowlabs Apr 11th, 2016 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /// Settings ///
  3. $settings = new stdClass();
  4. $settings->fromAddress = "postasaurus@starbeamrainbowlabs.com";
  5. $settings->toAddress = "bugs@starbeamrainbowlabs.com";
  6.  
  7. // Get the error report from the client
  8. $errorReport = file_get_contents("php://input");
  9.  
  10. // Add some extra information to it
  11. $errorReport .= "\n*** Server Information ***\n";
  12. $errorReport .= "Date / time reported: " . date("r") . "\n";
  13. $errorReport .= "Reporting ip: " . $_SERVER['REMOTE_ADDR'] . "\n";
  14. if(isset($_SERVER["HTTP_X_FORWARDED_FOR"]))
  15. {
  16.     $errorReport .= "The error report was forwarded through a proxy.\n";
  17.     $errorReport .= "The proxy says that it forwarded the request from this address: " . $_SERVER['HTTP_X_FORWARDED_FOR'] . "\n\n";
  18. }
  19. if(isset($_SERVER["HTTP_USER_AGENT"]))
  20. {
  21.     $errorReport .= "The reporting client identifies themselves as: " . $_SERVER["HTTP_USER_AGENT"] . ".\n";
  22. }
  23.  
  24. $emailHeaders = [
  25.     "From: $settings->fromAddress",
  26.     "Content-Type: text/plain",
  27.     "X-Mailer: PHP/" . phpversion()
  28. ];
  29.  
  30. $subject = "Error Report";
  31. if(isset($_SERVER["HTTP_USER_AGENT"]))
  32.     $subject .= " from " . $_SERVER["HTTP_USER_AGENT"];
  33.  
  34. mail($settings->toAddress, $subject, $errorReport, implode("\r\n", $emailHeaders), "-t");
  35.  
  36. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top