Last active
August 29, 2017 14:10
-
-
Save crucialbit/317f7f1b071d487030c8cd8ca518836b to your computer and use it in GitHub Desktop.
Simple PHP file for logging HTTP requests and parameters.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title></title> | |
<style> | |
body { | |
width: 95%; | |
} | |
p { | |
line-height: 140%; | |
overflow: hidden; | |
white-space: pre-wrap; | |
font-family: "Helvetica Neue","Helvetica","Microsoft JhengHei","Arial",sans-serif; | |
font-size: 16px; | |
word-spacing: 10px; | |
} | |
</style> | |
</head> | |
<body> | |
<p> | |
<?php | |
$now = date("Y-m-d H:i:s"); | |
$today = date("Y-m-d"); | |
$output_path = "logs/$today.log"; | |
$server_dump = print_r($_SERVER, TRUE); | |
$get_dump = print_r($_GET, TRUE); | |
$post_dump = print_r($_POST, TRUE); | |
$file = fopen("$output_path", "a+"); | |
$sep = "\n".str_repeat("=", 50)."\n"; | |
if ($_GET["debug"] !== "1") { | |
fwrite($file, "$now$sep"); | |
fwrite($file, "$server_dump$sep"."GET"."$sep$get_dump$sep"."POST"."$sep$post_dump$sep"); | |
} | |
fseek($file, 0); | |
$today_requests = fread($file, filesize($output_path)); | |
fclose($file); | |
if ($_GET["secret"] === "YOUR_SECRET") { | |
echo htmlentities($today_requests); | |
} | |
?> | |
<p> | |
<script> | |
window.scrollTo(0,document.body.scrollHeight); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment