Initial commit
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* 查看HTTP请求
|
||||
*/
|
||||
|
||||
namespace plugin\web\http;
|
||||
|
||||
use app\Plugin;
|
||||
use think\facade\View;
|
||||
|
||||
class App extends Plugin
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
$ip = real_ip();
|
||||
$new = new \app\lib\IpLocation();
|
||||
$arr = $new->getlocation($ip);
|
||||
$location = '';
|
||||
if($arr){
|
||||
$location = $arr['province'].$arr['city'].' '.$arr['area'];
|
||||
}
|
||||
|
||||
$cookie = '';
|
||||
foreach($_COOKIE as $cookie_key=>$cookie_value){
|
||||
if($cookie_key == 'admin_token' || $cookie_key == 'user_token' || $cookie_key == 'PHPSESSID') continue;
|
||||
$cookie .= $cookie_key.'='.$cookie_value.'; ';
|
||||
}
|
||||
$_SERVER['HTTP_COOKIE'] = $cookie;
|
||||
|
||||
$line = ['<b>'.$_SERVER['REQUEST_METHOD'].'</b> '.$_SERVER['REQUEST_URI'].' '.$_SERVER['SERVER_PROTOCOL']];
|
||||
|
||||
foreach ($_SERVER as $name => $value)
|
||||
{
|
||||
if (substr($name, 0, 5) == 'HTTP_')
|
||||
{
|
||||
$name = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))));
|
||||
$line[] = '<b>'.$name.'</b>: '.$value;
|
||||
}
|
||||
}
|
||||
|
||||
if($_SERVER['REQUEST_METHOD'] == 'POST'){
|
||||
$line[] = '';
|
||||
$line[] = file_get_contents('php://input');
|
||||
}
|
||||
|
||||
View::assign('ip', $ip);
|
||||
View::assign('location', $location);
|
||||
View::assign('line', $line);
|
||||
return $this->view();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
{extend name="common/plugin_layout" /}
|
||||
{block name="title"}{$plugin.title} - {:config_get('title')}{/block}
|
||||
{block name="main"}
|
||||
<div class="container-xl" id="app">
|
||||
<div class="col-sm-12 col-md-10 col-xl-8 center-block">
|
||||
<div class="card card-preview">
|
||||
<div class="card-inner mt-3" style="word-break: break-all;">
|
||||
<div class="nya-title nk-ibx-action-item progress-rating">
|
||||
<span class="nk-menu-text font-weight-bold">查看HTTP请求</span>
|
||||
</div>
|
||||
IP地址:{$ip}({$location})
|
||||
<hr/>HTTP请求行:
|
||||
<hr/>
|
||||
{volist name="line" id="vo"}
|
||||
{$vo|raw}<br/>
|
||||
{/volist}
|
||||
<hr/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
{block name="script"}
|
||||
|
||||
{/block}
|
||||
Reference in New Issue
Block a user