Skip to content

Instantly share code, notes, and snippets.

@ildarkhasanshin
Last active October 25, 2016 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ildarkhasanshin/4a275a7cb305f2034221b70cb54d84b0 to your computer and use it in GitHub Desktop.
Save ildarkhasanshin/4a275a7cb305f2034221b70cb54d84b0 to your computer and use it in GitHub Desktop.
report_admin
<?php
$path = htmlspecialchars($_REQUEST['path']);
$type = htmlspecialchars($_REQUEST['type']);
if (!empty($path)) {
switch ($type) {
case 'email':
$header = "Content-type:text/html; charset=\"utf-8\"\r\n";
$header .= "From: " . $_SERVER["SERVER_NAME"] . " <noreply@" . $_SERVER["SERVER_NAME"] . ">\r\n";
if (mail("email@gmail.com", $_SERVER["SERVER_NAME"] . '/report_admin.php', 'check url: ' . $path, $header)) {
header('Location: /');
exit();
}
break;
default:
$filename = $_SERVER['DOCUMENT_ROOT'] . '/report_admin.txt';
$tmp = file_get_contents($filename);
file_put_contents($filename, $tmp . "\r\n" . $path);
header('Location: /');
exit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment