Save
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
|
||||
use support\Request;
|
||||
|
||||
class IndexController
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
return response('hello webman');
|
||||
}
|
||||
|
||||
public function view(Request $request)
|
||||
{
|
||||
return view('index/view', ['name' => 'webman']);
|
||||
}
|
||||
|
||||
public function json(Request $request)
|
||||
{
|
||||
return json(['code' => 0, 'msg' => 'ok']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
|
||||
use support\Request;
|
||||
|
||||
class IndexController
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
return view('index');
|
||||
}
|
||||
|
||||
public function view(Request $request)
|
||||
{
|
||||
return view('index/view', ['name' => 'webman']);
|
||||
}
|
||||
|
||||
public function json(Request $request)
|
||||
{
|
||||
return json(['code' => 0, 'msg' => 'ok']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
|
||||
use support\Request;
|
||||
|
||||
class IndexController
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
return view('index');
|
||||
}
|
||||
|
||||
public function user(Request $request)
|
||||
{
|
||||
return view('user');
|
||||
}
|
||||
|
||||
public function json(Request $request)
|
||||
{
|
||||
return json(['code' => 0, 'msg' => 'ok']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use support\Redis;
|
||||
$redis = Redis::connection('default');
|
||||
|
||||
class IndexController
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
return view('index');
|
||||
}
|
||||
|
||||
public function user(Request $request)
|
||||
{
|
||||
return view('user');
|
||||
}
|
||||
|
||||
public function json(Request $request)
|
||||
{
|
||||
return json(['code' => 0, 'msg' => 'ok']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use support\Redis;
|
||||
|
||||
class IndexController
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
return view('index');
|
||||
}
|
||||
|
||||
public function user(Request $request)
|
||||
{
|
||||
$redis = Redis::connection('default');
|
||||
$user=$redis->hgetall('User');
|
||||
return view('user');
|
||||
}
|
||||
|
||||
public function json(Request $request)
|
||||
{
|
||||
return json(['code' => 0, 'msg' => 'ok']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use support\Redis;
|
||||
use support\View;
|
||||
|
||||
class IndexController
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
return view('index');
|
||||
}
|
||||
|
||||
public function user(Request $request)
|
||||
{
|
||||
$redis = Redis::connection('default');
|
||||
$user=$redis->hgetall('User');
|
||||
return view('user');
|
||||
}
|
||||
|
||||
public function json(Request $request)
|
||||
{
|
||||
return json(['code' => 0, 'msg' => 'ok']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use support\Redis;
|
||||
use support\View;
|
||||
|
||||
class IndexController
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
return view('index');
|
||||
}
|
||||
|
||||
public function user(Request $request)
|
||||
{
|
||||
$redis = Redis::connection('default');
|
||||
$user=$redis->hgetall('User');
|
||||
View::assign('user', $user);
|
||||
return view('user');
|
||||
}
|
||||
|
||||
public function json(Request $request)
|
||||
{
|
||||
return json(['code' => 0, 'msg' => 'ok']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use support\Redis;
|
||||
use support\View;
|
||||
|
||||
class IndexController
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
return view('index');
|
||||
}
|
||||
|
||||
public function user(Request $request)
|
||||
{
|
||||
$redis = Redis::connection('default');
|
||||
$user=$redis->hgetall('User');
|
||||
View::assign('user', $user);
|
||||
View::assign('userinfo', $request->session()->get('userinfo'));
|
||||
return view('user');
|
||||
}
|
||||
|
||||
public function json(Request $request)
|
||||
{
|
||||
return json(['code' => 0, 'msg' => 'ok']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use support\Redis;
|
||||
use support\View;
|
||||
|
||||
class IndexController
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
View::assign('userinfo', $request->session()->get('userinfo'));
|
||||
return view('index');
|
||||
}
|
||||
|
||||
public function user(Request $request)
|
||||
{
|
||||
$redis = Redis::connection('default');
|
||||
$user=$redis->hgetall('User');
|
||||
View::assign('user', $user);
|
||||
View::assign('userinfo', $request->session()->get('userinfo'));
|
||||
return view('user');
|
||||
}
|
||||
|
||||
public function json(Request $request)
|
||||
{
|
||||
return json(['code' => 0, 'msg' => 'ok']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use support\Redis;
|
||||
use support\View;
|
||||
|
||||
class IndexController
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
print_r($request->session()->get('userinfo'));
|
||||
View::assign('userinfo', $request->session()->get('userinfo'));
|
||||
return view('index');
|
||||
}
|
||||
|
||||
public function user(Request $request)
|
||||
{
|
||||
$redis = Redis::connection('default');
|
||||
$user=$redis->hgetall('User');
|
||||
View::assign('user', $user);
|
||||
View::assign('userinfo', $request->session()->get('userinfo'));
|
||||
return view('user');
|
||||
}
|
||||
|
||||
public function json(Request $request)
|
||||
{
|
||||
return json(['code' => 0, 'msg' => 'ok']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use support\Redis;
|
||||
use support\View;
|
||||
|
||||
class IndexController
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
View::assign('userinfo', $request->session()->get('userinfo'));
|
||||
return view('index');
|
||||
}
|
||||
|
||||
public function user(Request $request)
|
||||
{
|
||||
$redis = Redis::connection('default');
|
||||
$user=$redis->hgetall('User');
|
||||
View::assign('user', $user);
|
||||
View::assign('userinfo', $request->session()->get('userinfo'));
|
||||
return view('user');
|
||||
}
|
||||
|
||||
public function json(Request $request)
|
||||
{
|
||||
return json(['code' => 0, 'msg' => 'ok']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// Copyright (C) 2022 enoch@Laysense.com
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->post('content');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
|
||||
return view('login');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->post('content');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$msg['location']=$locate->raw['country']['names']['zh-CN'].'--'.$locate->raw['city']['names']['zh-CN'];
|
||||
$msg['Network']=$locate->traits->record['network'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
return view('login');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->post('content');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$msg['location']=$locate->raw['country']['names']['zh-CN'].'--'.$locate->raw['city']['names']['zh-CN'];
|
||||
$msg['Network']=$locate->traits->record['network'];
|
||||
$asnreader=$reader = new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnreader->autonomousSystemNumber' target='_ipip'>AS:"$asnreader->autonomousSystemNumber.'/'.$asnreader->autonomousSystemOrganization.'</a>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
return d($msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$msg['location']=$locate->raw['country']['names']['zh-CN'].'--'.$locate->raw['city']['names']['zh-CN'];
|
||||
$msg['Network']=$locate->traits->record['network'];
|
||||
$asnreader=$reader = new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnreader->autonomousSystemNumber' target='_ipip'>AS:"$asnreader->autonomousSystemNumber.'/'.$asnreader->autonomousSystemOrganization.'</a>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
return d($msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$msg['location']=$locate->raw['country']['names']['zh-CN'].'--'.$locate->raw['city']['names']['zh-CN'];
|
||||
$msg['Network']=$locate->traits->record['network'];
|
||||
$asnreader=$reader = new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnreader->autonomousSystemNumber' target='_ipip'>AS:"$asnreader->autonomousSystemNumber.'/'.$asnreader->autonomousSystemOrganization.'</a>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
return d($msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$msg['location']=$locate->raw['country']['names']['zh-CN'].'--'.$locate->raw['city']['names']['zh-CN'];
|
||||
$msg['Network']=$locate->traits->record['network'];
|
||||
$asnreader=$reader = new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnreader->autonomousSystemNumber' target='_ipip'>AS:"$asnreader->autonomousSystemNumber.'/'.$asnreader->autonomousSystemOrganization.'</a>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
return d($msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$msg['location']=$locate->raw['country']['names']['zh-CN'].'--'.$locate->raw['city']['names']['zh-CN'];
|
||||
$msg['Network']=$locate->traits->record['network'];
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnreader->autonomousSystemNumber' target='_ipip'>AS:"$asnreader->autonomousSystemNumber.'/'.$asnreader->autonomousSystemOrganization.'</a>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
return d($msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$msg['location']=$locate->raw['country']['names']['zh-CN'].'--'.$locate->raw['city']['names']['zh-CN'];
|
||||
$msg['Network']=$locate->traits->record['network'];
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS".$asnreader->autonomousSystemNumber." ' target="_ipip">AS:"$asnreader->autonomousSystemNumber.'/'.$asnreader->autonomousSystemOrganization.'</a>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
return d($msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$msg['location']=$locate->raw['country']['names']['zh-CN'].'--'.$locate->raw['city']['names']['zh-CN'];
|
||||
$msg['Network']=$locate->traits->record['network'];
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asnreader=$asnreader->Asn("$content");
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS".$asnreader->autonomousSystemNumber." ' target="_ipip">AS:"$asnreader->autonomousSystemNumber.'/'.$asnreader->autonomousSystemOrganization.'</a>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
return d($msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$msg['location']=$locate->raw['country']['names']['zh-CN'].'--'.$locate->raw['city']['names']['zh-CN'];
|
||||
$msg['Network']=$locate->traits->record['network'];
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asnreader=$asnreader->Asn("$content");
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS".$asnreader->autonomousSystemNumber." ' target='_ipip'>AS:"$asnreader->autonomousSystemNumber.'/'.$asnreader->autonomousSystemOrganization.'</a>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
return d($msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$msg['location']=$locate->raw['country']['names']['zh-CN'].'--'.$locate->raw['city']['names']['zh-CN'];
|
||||
$msg['Network']=$locate->traits->record['network'];
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS".$asn->autonomousSystemNumber." ' target='_ipip'>AS:"$asn->autonomousSystemNumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
return d($msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$msg['location']=$locate->raw['country']['names']['zh-CN'].'--'.$locate->raw['city']['names']['zh-CN'];
|
||||
$msg['Network']=$locate->traits->record['network'];
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
#$msg['ASN']="<a href='//whois.ipip.net/AS".$asn->autonomousSystemNumber." ' target='_ipip'>AS:"$asn->autonomousSystemNumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
$msg['ASN']=$asn->autonomousSystemNumber;
|
||||
}
|
||||
|
||||
|
||||
return d($msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$msg['location']=$locate->raw['country']['names']['zh-CN'].'--'.$locate->raw['city']['names']['zh-CN'];
|
||||
$msg['Network']=$locate->traits->record['network'];
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
#$msg['ASN']="<a href='//whois.ipip.net/AS".$asn->autonomousSystemNumber." ' target='_ipip'>AS:"$asn->autonomousSystemNumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
$msg['ASN']=$asn->autonomousSystemNumber.$asn->autonomousSystemOrganization;
|
||||
}
|
||||
|
||||
|
||||
return d($msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$msg['location']=$locate->raw['country']['names']['zh-CN'].'--'.$locate->raw['city']['names']['zh-CN'];
|
||||
$msg['Network']=$locate->traits->record['network'];
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:"$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
|
||||
return d($msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$msg['location']=$locate->raw['country']['names']['zh-CN'].'--'.$locate->raw['city']['names']['zh-CN'];
|
||||
$msg['Network']=$locate->traits->record['network'];
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS' target='_ipip'>AS:"$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
|
||||
return d($msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$msg['location']=$locate->raw['country']['names']['zh-CN'].'--'.$locate->raw['city']['names']['zh-CN'];
|
||||
$msg['Network']=$locate->traits->record['network'];
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
|
||||
return d($msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$msg['location']=$locate->raw['country']['names']['zh-CN'].'--'.$locate->raw['city']['names']['zh-CN'];
|
||||
$msg['Network']=$locate->traits->record['network'];
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
|
||||
return d($msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN']
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['location']="$city/$country";
|
||||
$msg['Network']=$locate->traits->record['network'];
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
|
||||
return d($msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['location']="$city/$country";
|
||||
$msg['Network']=$locate->traits->record['network'];
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
|
||||
return d($msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['location']="$city/$country";
|
||||
#$msg['Network']=$locate->traits->record['network'];
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
|
||||
return d($msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['location']="$city/$country";
|
||||
#$msg['Network']=$locate->traits->record['network'];
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print',);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['location']="$city/$country";
|
||||
#$msg['Network']=$locate->traits->record['network'];
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print',);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['location']="$city/$country";
|
||||
#$msg['Network']=$locate->traits->record['network'];
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['location']="$city/$country";
|
||||
$msg['Network']=$locate->traits->record['network'];
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['location']="$city/$country";
|
||||
$msg['Network']=$locate->traits->record;
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['location']="$city/$country";
|
||||
$msg['Network']=$locate->traits->record;
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['location']="$city/$country";
|
||||
$msg['Network']=$locate->traits->validAttributes[17];
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['location']="$city/$country";
|
||||
$msg['Network']=$locate->traits;
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['location']="$city/$country";
|
||||
$msg['Network']=$locate->traits->validAttributes:protected;
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['location']="$city/$country";
|
||||
$msg['Network']=$locate->traits['network'];
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['location']="$city/$country";
|
||||
$msg['Network']=$locate->traits->network;
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['Host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['Location']="$city/$country";
|
||||
$msg['Network']=$locate->traits->network;
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
use yzh52521\EasyHttp\Response;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
$msg['DNS']=dns_get_record("$content",DNS_ANY);
|
||||
$whois = Http::get('https://api.devopsclub.cn/api/whoisquery?type=json&standard=true', ['domain' => "$content"]);
|
||||
$whois=json_decode($whois);
|
||||
if($whois->code)
|
||||
$msg['Whois']=array;
|
||||
|
||||
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['Host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['Location']="$city/$country";
|
||||
$msg['Network']=$locate->traits->network;
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
use yzh52521\EasyHttp\Response;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
$msg['DNS']=dns_get_record("$content",DNS_ANY);
|
||||
$whois = Http::get('https://api.devopsclub.cn/api/whoisquery?type=json&standard=true', ['domain' => "$content"]);
|
||||
$whois=json_decode($whois);
|
||||
if($whois->code);
|
||||
$msg['Whois']=array;
|
||||
|
||||
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['Host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['Location']="$city/$country";
|
||||
$msg['Network']=$locate->traits->network;
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
use yzh52521\EasyHttp\Response;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
$msg['DNS']=dns_get_record("$content",DNS_ANY);
|
||||
$whois = Http::get('https://api.devopsclub.cn/api/whoisquery?type=json&standard=true', ['domain' => "$content"]);
|
||||
$whois=json_decode($whois);
|
||||
#if($whois->code);
|
||||
$msg['Whois']=array;
|
||||
|
||||
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['Host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['Location']="$city/$country";
|
||||
$msg['Network']=$locate->traits->network;
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
use yzh52521\EasyHttp\Response;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
$msg['DNS']=dns_get_record("$content",DNS_ANY);
|
||||
$whois = Http::get('https://api.devopsclub.cn/api/whoisquery?type=json&standard=true', ['domain' => "$content"]);
|
||||
$whois=json_decode($whois);
|
||||
#if($whois->code);
|
||||
$msg['Whois']=array
|
||||
|
||||
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['Host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['Location']="$city/$country";
|
||||
$msg['Network']=$locate->traits->network;
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
use yzh52521\EasyHttp\Response;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
$msg['DNS']=dns_get_record("$content",DNS_ANY);
|
||||
$whois = Http::get('https://api.devopsclub.cn/api/whoisquery?type=json&standard=true', ['domain' => "$content"]);
|
||||
$whois=json_decode($whois);
|
||||
#if($whois->code);
|
||||
$msg['Whois']=array();
|
||||
|
||||
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['Host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['Location']="$city/$country";
|
||||
$msg['Network']=$locate->traits->network;
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
use yzh52521\EasyHttp\Http;
|
||||
use yzh52521\EasyHttp\Response;
|
||||
use yzh52521\EasyHttp\RequestException;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
$msg['DNS']=dns_get_record("$content",DNS_ANY);
|
||||
$whois = Http::get('https://api.devopsclub.cn/api/whoisquery?type=json&standard=true', ['domain' => "$content"])->body();
|
||||
$whois=json_decode($whois);
|
||||
if($whois->code !=0){
|
||||
$msg['Whois']='Whois查询失败';
|
||||
};
|
||||
if($data->status !=0){
|
||||
$msg['Whois']='Whois查询出错,请稍后重试';
|
||||
};
|
||||
if($data->status =2 || $data->status =3 ){
|
||||
$msg['Whois']='该域名未注册或该后缀暂不支持查询';
|
||||
};
|
||||
$msg['Whois']=array();
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['Host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['Location']="$city/$country";
|
||||
$msg['Network']=$locate->traits->network;
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
use yzh52521\EasyHttp\Http;
|
||||
use yzh52521\EasyHttp\Response;
|
||||
use yzh52521\EasyHttp\RequestException;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
$msg['DNS']=dns_get_record("$content",DNS_ANY);
|
||||
$whois = Http::get('https://api.devopsclub.cn/api/whoisquery?type=json&standard=true', ['domain' => "$content"])->body();
|
||||
$whois=json_decode($whois);
|
||||
if($whois->code !=0){
|
||||
$msg['Whois']='Whois查询失败';
|
||||
};
|
||||
if($whois->data->status !=0){
|
||||
$msg['Whois']='Whois查询出错,请稍后重试';
|
||||
};
|
||||
if($whois->data->status =2 || $data->status =3 ){
|
||||
$msg['Whois']='该域名未注册或该后缀暂不支持查询';
|
||||
};
|
||||
$msg['Whois']=$whois->data->data;
|
||||
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['Host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['Location']="$city/$country";
|
||||
$msg['Network']=$locate->traits->network;
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
use yzh52521\EasyHttp\Http;
|
||||
use yzh52521\EasyHttp\Response;
|
||||
use yzh52521\EasyHttp\RequestException;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
$msg['DNS']=dns_get_record("$content",DNS_ANY);
|
||||
$whois = Http::get('https://api.devopsclub.cn/api/whoisquery?type=json&standard=true', ['domain' => "$content"])->body();
|
||||
$whois=json_decode($whois);
|
||||
if($whois->code !=0){
|
||||
$msg['Whois']='Whois查询失败';
|
||||
};
|
||||
if($whois->data->status !=0){
|
||||
$msg['Whois']='Whois查询出错,请稍后重试';
|
||||
};
|
||||
if($whois->data->status ==2 || $data->status ==3 ){
|
||||
$msg['Whois']='该域名未注册或该后缀暂不支持查询';
|
||||
};
|
||||
if($whois->code == 0 && $whois->data->status == 0){
|
||||
$msg['Whois']=$whois->data->data;
|
||||
}
|
||||
$safe = Http::get('https://api.devopsclub.cn/api/dcheck', ['url' => "$content"])->body();
|
||||
$safe=json_decode($safe);
|
||||
if($safe->code == 0){
|
||||
$msg['Safe']='说明:Wx-Safe和QQ-Safe为该域名的微信/QQ红白状态 danger为红 unknown未知 safe安全 仅供参考'
|
||||
$msg['Wx-Safe']=$safe->data->wx;
|
||||
$msg['QQ-Safe']=$safe->data->qq;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['Host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['Location']="$city/$country";
|
||||
$msg['Network']=$locate->traits->network;
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
use yzh52521\EasyHttp\Http;
|
||||
use yzh52521\EasyHttp\Response;
|
||||
use yzh52521\EasyHttp\RequestException;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
$msg['DNS']=dns_get_record("$content",DNS_ANY);
|
||||
$whois = Http::get('https://api.devopsclub.cn/api/whoisquery?type=json&standard=true', ['domain' => "$content"])->body();
|
||||
$whois=json_decode($whois);
|
||||
if($whois->code !=0){
|
||||
$msg['Whois']='Whois查询失败';
|
||||
};
|
||||
if($whois->data->status !=0){
|
||||
$msg['Whois']='Whois查询出错,请稍后重试';
|
||||
};
|
||||
if($whois->data->status ==2 || $data->status ==3 ){
|
||||
$msg['Whois']='该域名未注册或该后缀暂不支持查询';
|
||||
};
|
||||
if($whois->code == 0 && $whois->data->status == 0){
|
||||
$msg['Whois']=$whois->data->data;
|
||||
}
|
||||
$safe = Http::get('https://api.devopsclub.cn/api/dcheck', ['url' => "$content"])->body();
|
||||
$safe=json_decode($safe);
|
||||
if($safe->code == 0){
|
||||
$msg['Safe']='说明:Wx-Safe和QQ-Safe为该域名的微信/QQ红白状态 danger为红 unknown未知 safe安全 仅供参考';
|
||||
$msg['Wx-Safe']=$safe->data->wx;
|
||||
$msg['QQ-Safe']=$safe->data->qq;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['Host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['Location']="$city/$country";
|
||||
$msg['Network']=$locate->traits->network;
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
use yzh52521\EasyHttp\Http;
|
||||
use yzh52521\EasyHttp\Response;
|
||||
use yzh52521\EasyHttp\RequestException;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
$msg['DNS']=dns_get_record("$content",DNS_ANY);
|
||||
$whois = Http::get('https://api.devopsclub.cn/api/whoisquery?type=json&standard=true', ['domain' => "$content"])->body();
|
||||
$whois=json_decode($whois);
|
||||
if($whois->code !=0){
|
||||
$msg['Whois']='Whois查询失败';
|
||||
};
|
||||
if($whois->data->status !=0){
|
||||
$msg['Whois']='Whois查询出错,请稍后重试';
|
||||
};
|
||||
if($whois->data->status ==2 || $whois->data->status ==3 ){
|
||||
$msg['Whois']='该域名未注册或该后缀暂不支持查询';
|
||||
};
|
||||
if($whois->code == 0 && $whois->data->status == 0){
|
||||
$msg['Whois']=$whois->data->data;
|
||||
}
|
||||
$safe = Http::get('https://api.devopsclub.cn/api/dcheck', ['url' => "$content"])->body();
|
||||
$safe=json_decode($safe);
|
||||
if($safe->code == 0){
|
||||
$msg['Safe']='说明:Wx-Safe和QQ-Safe为该域名的微信/QQ红白状态 danger为红 unknown未知 safe安全 仅供参考';
|
||||
$msg['Wx-Safe']=$safe->data->wx;
|
||||
$msg['QQ-Safe']=$safe->data->qq;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['Host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['Location']="$city/$country";
|
||||
$msg['Network']=$locate->traits->network;
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
use GeoIp2\Database\Reader;
|
||||
use yzh52521\EasyHttp\Http;
|
||||
use yzh52521\EasyHttp\Response;
|
||||
use yzh52521\EasyHttp\RequestException;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
if(!$contenttype){
|
||||
return '请输入合法的IP或域名';
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
$msg['DNS']=dns_get_record("$content",DNS_ANY);
|
||||
$whois = Http::get('https://api.devopsclub.cn/api/whoisquery?type=json&standard=true', ['domain' => "$content"])->body();
|
||||
$whois=json_decode($whois);
|
||||
if($whois->code !=0){
|
||||
$msg['Whois']='Whois查询失败';
|
||||
};
|
||||
if($whois->data->status !=0){
|
||||
$msg['Whois']='Whois查询出错,请稍后重试';
|
||||
};
|
||||
if($whois->data->status ==2 || $whois->data->status ==3 ){
|
||||
$msg['Whois']='该域名未注册或该后缀暂不支持查询';
|
||||
};
|
||||
if($whois->code == 0 && $whois->data->status == 0){
|
||||
$msg['Whois']=$whois->data->data;
|
||||
}
|
||||
$safe = Http::get('https://api.devopsclub.cn/api/dcheck', ['url' => "$content"])->body();
|
||||
$safe=json_decode($safe);
|
||||
if($safe->code == 0){
|
||||
$msg['Safe']='说明:Wx-Safe和QQ-Safe为该域名的微信/QQ红白状态 danger为红 unknown未知(或白) safe安全 仅供参考';
|
||||
$msg['Wx-Safe']=$safe->data->wx;
|
||||
$msg['QQ-Safe']=$safe->data->qq;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
$msg['Host']=gethostbyaddr("$content");
|
||||
$reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb');
|
||||
$locate=$reader->city($content);
|
||||
$country=$locate->raw['country']['names']['zh-CN'];
|
||||
if(array_key_exists("city",$locate->raw)){
|
||||
$city=$locate->raw['city']['names']['zh-CN'];
|
||||
}else{
|
||||
$city=$country;
|
||||
}
|
||||
$msg['Location']="$city/$country";
|
||||
$msg['Network']=$locate->traits->network;
|
||||
$asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb');
|
||||
$asn=$asnreader->Asn("$content");
|
||||
$asnnumber=$asn->autonomousSystemNumber;
|
||||
$msg['ASN']="<a href='//whois.ipip.net/AS$asnnumber' target='_ipip'>AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.'</a>';
|
||||
}
|
||||
|
||||
View::assign('msg', $msg);
|
||||
return view('print');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// Copyright (C) 2022 enoch@Laysense.com
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
// Copyright (C) 2022 enoch@Laysense.com
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$msg=$request->get('msg', '');
|
||||
$to=$request->get('to', '/admin');
|
||||
View::assign('msg', $msg);
|
||||
View::assign('to', $to);
|
||||
return view('index/login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$captcha = $request->post('code','0');
|
||||
// 对比session中的captcha值
|
||||
if (strtolower($captcha) !== $request->session()->get('captcha')) {
|
||||
return redirect('/login?msg=验证码错误');
|
||||
}
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
if($name==getenv('admin') && $password==getenv('password')){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', 'admin');
|
||||
$to = $request->post('to','/admin');
|
||||
return redirect("$to");
|
||||
}else{
|
||||
return redirect('/login?msg=账号密码错误');
|
||||
}
|
||||
|
||||
|
||||
return response('错误');
|
||||
}
|
||||
|
||||
public function captcha(Request $request)
|
||||
{
|
||||
// 初始化验证码类
|
||||
$builder = new CaptchaBuilder;
|
||||
// 生成验证码
|
||||
$builder->build();
|
||||
// 将验证码的值存储到session中
|
||||
$request->session()->set('captcha', strtolower($builder->getPhrase()));
|
||||
// 获得验证码图片二进制数据
|
||||
$img_content = $builder->get();
|
||||
// 输出验证码二进制数据
|
||||
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
// Copyright (C) 2022 enoch@Laysense.com
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$msg=$request->get('msg', '');
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('msg', $msg);
|
||||
View::assign('to', $to);
|
||||
return view('index/login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$captcha = $request->post('code','0');
|
||||
// 对比session中的captcha值
|
||||
if (strtolower($captcha) !== $request->session()->get('captcha')) {
|
||||
return redirect('/login?msg=验证码错误');
|
||||
}
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
if($name==getenv('admin') && $password==getenv('password')){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', 'admin');
|
||||
$to = $request->post('to','/admin');
|
||||
return redirect("$to");
|
||||
}else{
|
||||
return redirect('/login?msg=账号密码错误');
|
||||
}
|
||||
|
||||
|
||||
return response('错误');
|
||||
}
|
||||
|
||||
public function captcha(Request $request)
|
||||
{
|
||||
// 初始化验证码类
|
||||
$builder = new CaptchaBuilder;
|
||||
// 生成验证码
|
||||
$builder->build();
|
||||
// 将验证码的值存储到session中
|
||||
$request->session()->set('captcha', strtolower($builder->getPhrase()));
|
||||
// 获得验证码图片二进制数据
|
||||
$img_content = $builder->get();
|
||||
// 输出验证码二进制数据
|
||||
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
// Copyright (C) 2022 enoch@Laysense.com
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$msg=$request->get('msg', '');
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('msg', $msg);
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$captcha = $request->post('code','0');
|
||||
// 对比session中的captcha值
|
||||
if (strtolower($captcha) !== $request->session()->get('captcha')) {
|
||||
return redirect('/login?msg=验证码错误');
|
||||
}
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
if($name==getenv('admin') && $password==getenv('password')){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', 'admin');
|
||||
$to = $request->post('to','/admin');
|
||||
return redirect("$to");
|
||||
}else{
|
||||
return redirect('/login?msg=账号密码错误');
|
||||
}
|
||||
|
||||
|
||||
return response('错误');
|
||||
}
|
||||
|
||||
public function captcha(Request $request)
|
||||
{
|
||||
// 初始化验证码类
|
||||
$builder = new CaptchaBuilder;
|
||||
// 生成验证码
|
||||
$builder->build();
|
||||
// 将验证码的值存储到session中
|
||||
$request->session()->set('captcha', strtolower($builder->getPhrase()));
|
||||
// 获得验证码图片二进制数据
|
||||
$img_content = $builder->get();
|
||||
// 输出验证码二进制数据
|
||||
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
// Copyright (C) 2022 enoch@Laysense.com
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
<?php
|
||||
namespace app\controller;
|
||||
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$msg=$request->get('msg', '');
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('msg', $msg);
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$captcha = $request->post('code','0');
|
||||
// 对比session中的captcha值
|
||||
if (strtolower($captcha) !== $request->session()->get('captcha')) {
|
||||
return redirect('/login?msg=验证码错误');
|
||||
}
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
if($name==getenv('admin') && $password==getenv('password')){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', 'admin');
|
||||
$to = $request->post('to','/admin');
|
||||
return redirect("$to");
|
||||
}else{
|
||||
return redirect('/login?msg=账号密码错误');
|
||||
}
|
||||
|
||||
|
||||
return response('错误');
|
||||
}
|
||||
|
||||
public function captcha(Request $request)
|
||||
{
|
||||
// 初始化验证码类
|
||||
$builder = new CaptchaBuilder;
|
||||
// 生成验证码
|
||||
$builder->build();
|
||||
// 将验证码的值存储到session中
|
||||
$request->session()->set('captcha', strtolower($builder->getPhrase()));
|
||||
// 获得验证码图片二进制数据
|
||||
$img_content = $builder->get();
|
||||
// 输出验证码二进制数据
|
||||
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
// Copyright (C) 2022 enoch@Laysense.com
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<?php
|
||||
namespace app\controller;
|
||||
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$msg=$request->get('msg', '');
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('msg', $msg);
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$captcha = $request->post('code','0');
|
||||
// 对比session中的captcha值
|
||||
if (strtolower($captcha) !== $request->session()->get('captcha')) {
|
||||
return redirect('/login?msg=验证码错误');
|
||||
}
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
if($name==getenv('admin') && $password==getenv('password')){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', 'admin');
|
||||
$to = $request->post('to','/admin');
|
||||
return redirect("$to");
|
||||
}else{
|
||||
return redirect('/login?msg=账号密码错误');
|
||||
}
|
||||
|
||||
|
||||
return response('错误');
|
||||
}
|
||||
|
||||
public function captcha(Request $request)
|
||||
{
|
||||
// 初始化验证码类
|
||||
$builder = new CaptchaBuilder;
|
||||
// 生成验证码
|
||||
$builder->build();
|
||||
// 将验证码的值存储到session中
|
||||
$request->session()->set('captcha', strtolower($builder->getPhrase()));
|
||||
// 获得验证码图片二进制数据
|
||||
$img_content = $builder->get();
|
||||
// 输出验证码二进制数据
|
||||
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$msg=$request->get('msg', '');
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('msg', $msg);
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$captcha = $request->post('code','0');
|
||||
// 对比session中的captcha值
|
||||
if (strtolower($captcha) !== $request->session()->get('captcha')) {
|
||||
return redirect('/login?msg=验证码错误');
|
||||
}
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
if($name==getenv('admin') && $password==getenv('password')){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', 'admin');
|
||||
$to = $request->post('to','/admin');
|
||||
return redirect("$to");
|
||||
}else{
|
||||
return redirect('/login?msg=账号密码错误');
|
||||
}
|
||||
|
||||
|
||||
return response('错误');
|
||||
}
|
||||
|
||||
public function captcha(Request $request)
|
||||
{
|
||||
// 初始化验证码类
|
||||
$builder = new CaptchaBuilder;
|
||||
// 生成验证码
|
||||
$builder->build();
|
||||
// 将验证码的值存储到session中
|
||||
$request->session()->set('captcha', strtolower($builder->getPhrase()));
|
||||
// 获得验证码图片二进制数据
|
||||
$img_content = $builder->get();
|
||||
// 输出验证码二进制数据
|
||||
return response($img_content, 200, ['Content-Type' => 'image/jpeg']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$msg=$request->get('msg', '');
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('msg', $msg);
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
if($name==getenv('admin') && $password==getenv('password')){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', 'admin');
|
||||
$to = $request->post('to','/admin');
|
||||
return redirect("$to");
|
||||
}else{
|
||||
return redirect('/login?msg=账号密码错误');
|
||||
}
|
||||
|
||||
|
||||
return response('错误');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$msg=$request->get('msg', '');
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('msg', $msg);
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
$redis = Redis::connection('default');
|
||||
$userinfo=$redis->hget('User',"$name");
|
||||
try {
|
||||
$usernameValidator->StringType()->setName('用户名')->check($name);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
try {
|
||||
$usernameValidator->StringType()->setName('用户名')->check($password);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
|
||||
if($name==getenv('admin') && $password==getenv('password')){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', 'admin');
|
||||
$to = $request->post('to','/admin');
|
||||
return redirect("$to");
|
||||
}else{
|
||||
return redirect('/login?msg=账号密码错误');
|
||||
}
|
||||
|
||||
|
||||
return response('错误');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$msg=$request->get('msg', '');
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('msg', $msg);
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
|
||||
try {
|
||||
$usernameValidator->StringType()->setName('用户名')->check($name);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
try {
|
||||
$usernameValidator->StringType()->setName('密码')->check($password);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
$redis = Redis::connection('default');
|
||||
$userinfo=$redis->hget('User',"$name");
|
||||
if($name==getenv('admin') && $password==getenv('password')){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', 'admin');
|
||||
$to = $request->post('to','/admin');
|
||||
return redirect("$to");
|
||||
}else{
|
||||
return redirect('/login?msg=账号密码错误');
|
||||
}
|
||||
|
||||
|
||||
return response('错误');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$msg=$request->get('msg', '');
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('msg', $msg);
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
|
||||
try {
|
||||
$usernameValidator->StringType()->setName('用户名')->check($name);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
try {
|
||||
$usernameValidator->StringType()->setName('密码')->check($password);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
$redis = Redis::connection('default');
|
||||
$userinfo=$redis->hget('User',"$name");
|
||||
if($name==getenv('admin') && $password==getenv('password')){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', 'admin');
|
||||
$to = $request->post('to','/admin');
|
||||
return redirect("$to");
|
||||
}else{
|
||||
return redirect('/login?msg=账号密码错误');
|
||||
}
|
||||
|
||||
|
||||
return response('错误');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$msg=$request->get('msg', '');
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('msg', $msg);
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
|
||||
try {
|
||||
$usernameValidator->StringType()->setName('用户名')->check($name);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
try {
|
||||
$usernameValidator->StringType()->setName('密码')->check($password);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
$redis = Redis::connection('default');
|
||||
$userinfo=$redis->hget('User',"$name");
|
||||
if($name==getenv('admin') && $password==getenv('password')){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', 'admin');
|
||||
$to = $request->post('to','/admin');
|
||||
return redirect("$to");
|
||||
}else{
|
||||
return redirect('/login?msg=账号密码错误');
|
||||
}
|
||||
|
||||
|
||||
return response('错误');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$msg=$request->get('msg', '');
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('msg', $msg);
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
|
||||
try {
|
||||
$usernameValidator->StringType()->setName('用户名')->check($name);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
try {
|
||||
$usernameValidator->StringType()->setName('密码')->check($password);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
$redis = Redis::connection('default');
|
||||
$userinfo=$redis->hget('User',"$name");
|
||||
if($userinfo===false){
|
||||
return json(['code'=>501, 'msg'=>'No Such Username']);
|
||||
}
|
||||
|
||||
if($name==getenv('admin') && $password==getenv('password')){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', 'admin');
|
||||
$to = $request->post('to','/admin');
|
||||
return redirect("$to");
|
||||
}else{
|
||||
return redirect('/login?msg=账号密码错误');
|
||||
}
|
||||
|
||||
|
||||
return response('错误');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$msg=$request->get('msg', '');
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('msg', $msg);
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
|
||||
try {
|
||||
$usernameValidator->StringType()->setName('用户名')->check($name);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
try {
|
||||
$usernameValidator->StringType()->setName('密码')->check($password);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
$redis = Redis::connection('default');
|
||||
$userinfo=$redis->hget('User',"$name");
|
||||
if($userinfo===false){
|
||||
return json(['code'=>501, 'msg'=>'No Such Username']);
|
||||
}
|
||||
$realpass=json_decode($userinfo)->passwd;
|
||||
|
||||
if(hash("sha256", $realpass)==$realpass){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', $userinfo);
|
||||
$to = $request->post('to','/admin');
|
||||
return redirect("$to");
|
||||
}else{
|
||||
return redirect('/login?msg=账号密码错误');
|
||||
}
|
||||
|
||||
|
||||
return response('错误');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$msg=$request->get('msg', '');
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('msg', $msg);
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
|
||||
try {
|
||||
$usernameValidator->StringType()->setName('用户名')->check($name);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
try {
|
||||
$usernameValidator->StringType()->setName('密码')->check($password);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
$redis = Redis::connection('default');
|
||||
$userinfo=$redis->hget('User',"$name");
|
||||
if($userinfo===false){
|
||||
return json(['code'=>501, 'msg'=>'No Such Username']);
|
||||
}
|
||||
$realpass=json_decode($userinfo)->passwd;
|
||||
|
||||
if(hash("sha256", $realpass)==$realpass){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', $userinfo);
|
||||
$to = $request->post('to','/admin');
|
||||
return json(['code'=>200, 'msg'=>'Login Successfully']);
|
||||
}else{
|
||||
return json(['code'=>502, 'msg'=>'Auth Failed']);
|
||||
}
|
||||
|
||||
|
||||
return json(['code'=>999, 'msg'=>'Unknown Problem']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
|
||||
try {
|
||||
$usernameValidator->StringType()->setName('用户名')->check($name);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
try {
|
||||
$usernameValidator->StringType()->setName('密码')->check($password);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
$redis = Redis::connection('default');
|
||||
$userinfo=$redis->hget('User',"$name");
|
||||
if($userinfo===false){
|
||||
return json(['code'=>501, 'msg'=>'No Such Username']);
|
||||
}
|
||||
$realpass=json_decode($userinfo)->passwd;
|
||||
|
||||
if(hash("sha256", $realpass)==$realpass){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', $userinfo);
|
||||
$to = $request->post('to','/admin');
|
||||
return json(['code'=>200, 'msg'=>'Login Successfully']);
|
||||
}else{
|
||||
return json(['code'=>502, 'msg'=>'Auth Failed']);
|
||||
}
|
||||
|
||||
|
||||
return json(['code'=>999, 'msg'=>'Unknown Problem']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
$usernameValidator = v::StringType()->noWhitespace()->length(1, 15);
|
||||
try {
|
||||
$usernameValidator->setName('用户名')->check($name);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
try {
|
||||
$usernameValidator->setName('密码')->check($password);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
$redis = Redis::connection('default');
|
||||
$userinfo=$redis->hget('User',"$name");
|
||||
if($userinfo===false){
|
||||
return json(['code'=>501, 'msg'=>'No Such Username']);
|
||||
}
|
||||
$realpass=json_decode($userinfo)->passwd;
|
||||
|
||||
if(hash("sha256", $realpass)==$realpass){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', $userinfo);
|
||||
$to = $request->post('to','/admin');
|
||||
return json(['code'=>200, 'msg'=>'Login Successfully']);
|
||||
}else{
|
||||
return json(['code'=>502, 'msg'=>'Auth Failed']);
|
||||
}
|
||||
|
||||
|
||||
return json(['code'=>999, 'msg'=>'Unknown Problem']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
$usernameValidator = v::StringType()->noWhitespace()->length(1, 15);
|
||||
try {
|
||||
$usernameValidator->setName('用户名')->check($name);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
try {
|
||||
$usernameValidator->setName('密码')->check($password);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
$redis = Redis::connection('default');
|
||||
$userinfo=$redis->hget('User',"$name");
|
||||
if($userinfo===false){
|
||||
return json(['code'=>501, 'msg'=>'No Such Username']);
|
||||
}
|
||||
$realpass=json_decode($userinfo)->passwd;
|
||||
|
||||
if(hash("sha256", $realpass)==$realpass){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', $userinfo);
|
||||
$to = $request->post('to','/admin');
|
||||
return json(['code'=>200, 'msg'=>'Login Successfully']);
|
||||
}else{
|
||||
return json(['code'=>502, 'msg'=>'Auth Failed']);
|
||||
}
|
||||
|
||||
|
||||
return json(['code'=>999, 'msg'=>'Unknown Problem']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
$usernameValidator = v::StringType()->noWhitespace()->length(1, 15);
|
||||
try {
|
||||
$usernameValidator->setName('用户名')->check($name);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
try {
|
||||
$usernameValidator->setName('密码')->check($password);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
$redis = Redis::connection('default');
|
||||
$userinfo=$redis->hget('User',"$name");
|
||||
if($userinfo===false){
|
||||
return json(['code'=>501, 'msg'=>'No Such Username']);
|
||||
}
|
||||
$realpass=json_decode($userinfo)->passwd;
|
||||
echo($realpass);
|
||||
|
||||
if(hash("sha256", $realpass)==$realpass){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', $userinfo);
|
||||
$to = $request->post('to','/admin');
|
||||
return json(['code'=>200, 'msg'=>'Login Successfully']);
|
||||
}else{
|
||||
return json(['code'=>502, 'msg'=>'Auth Failed']);
|
||||
}
|
||||
|
||||
|
||||
return json(['code'=>999, 'msg'=>'Unknown Problem']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
$usernameValidator = v::StringType()->noWhitespace()->length(1, 15);
|
||||
try {
|
||||
$usernameValidator->setName('用户名')->check($name);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
try {
|
||||
$usernameValidator->setName('密码')->check($password);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
$redis = Redis::connection('default');
|
||||
$userinfo=$redis->hget('User',"$name");
|
||||
if($userinfo===false){
|
||||
return json(['code'=>501, 'msg'=>'No Such Username']);
|
||||
}
|
||||
$realpass=json_decode($userinfo)->passwd;
|
||||
|
||||
if(hash("sha256", $password)==$realpass){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', $userinfo);
|
||||
$to = $request->post('to','/admin');
|
||||
return json(['code'=>200, 'msg'=>'Login Successfully']);
|
||||
}else{
|
||||
return json(['code'=>502, 'msg'=>'Auth Failed']);
|
||||
}
|
||||
|
||||
|
||||
return json(['code'=>999, 'msg'=>'Unknown Problem']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
$usernameValidator = v::StringType()->noWhitespace()->length(1, 15);
|
||||
try {
|
||||
$usernameValidator->setName('用户名')->check($name);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
try {
|
||||
$usernameValidator->setName('密码')->check($password);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
$redis = Redis::connection('default');
|
||||
$userinfo=$redis->hget('User',"$name");
|
||||
if($userinfo===false){
|
||||
return json(['code'=>501, 'msg'=>'No Such Username']);
|
||||
}
|
||||
$realpass=json_decode($userinfo)->passwd;
|
||||
echo ($realpass);
|
||||
if(hash("sha256", $password)==$realpass){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', $userinfo);
|
||||
$to = $request->post('to','/admin');
|
||||
return json(['code'=>200, 'msg'=>'Login Successfully']);
|
||||
}else{
|
||||
return json(['code'=>502, 'msg'=>'Auth Failed']);
|
||||
}
|
||||
|
||||
|
||||
return json(['code'=>999, 'msg'=>'Unknown Problem']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
$usernameValidator = v::StringType()->noWhitespace()->length(1, 15);
|
||||
try {
|
||||
$usernameValidator->setName('用户名')->check($name);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
try {
|
||||
$usernameValidator->setName('密码')->check($password);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
$redis = Redis::connection('default');
|
||||
$userinfo=$redis->hget('User',"$name");
|
||||
if($userinfo===false){
|
||||
return json(['code'=>501, 'msg'=>'No Such Username']);
|
||||
}
|
||||
$realpass=json_decode($userinfo)->passwd;
|
||||
echo ($realpass."\n".hash("sha256", $password));
|
||||
if(hash("sha256", $password)==$realpass){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', $userinfo);
|
||||
$to = $request->post('to','/admin');
|
||||
return json(['code'=>200, 'msg'=>'Login Successfully']);
|
||||
}else{
|
||||
return json(['code'=>502, 'msg'=>'Auth Failed']);
|
||||
}
|
||||
|
||||
|
||||
return json(['code'=>999, 'msg'=>'Unknown Problem']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
$usernameValidator = v::StringType()->noWhitespace()->length(1, 15);
|
||||
try {
|
||||
$usernameValidator->setName('用户名')->check($name);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
try {
|
||||
$usernameValidator->setName('密码')->check($password);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
$redis = Redis::connection('default');
|
||||
$userinfo=$redis->hget('User',"$name");
|
||||
if($userinfo===false){
|
||||
return json(['code'=>501, 'msg'=>'No Such Username']);
|
||||
}
|
||||
$realpass=json_decode($userinfo)->passwd;
|
||||
echo ($realpass."\n".hash("sha256", $password));
|
||||
if(hash("sha256", $password)==$realpass){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', $userinfo);
|
||||
$to = $request->post('to','/admin');
|
||||
return json(['code'=>200, 'msg'=>'Login Successfully']);
|
||||
}else{
|
||||
return json(['code'=>502, 'msg'=>'Auth Failed']);
|
||||
}
|
||||
|
||||
|
||||
return json(['code'=>999, 'msg'=>'Unknown Problem']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
$usernameValidator = v::StringType()->noWhitespace()->length(1, 15);
|
||||
try {
|
||||
$usernameValidator->setName('用户名')->check($name);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
try {
|
||||
$usernameValidator->setName('密码')->check($password);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
$redis = Redis::connection('default');
|
||||
$userinfo=$redis->hget('User',"$name");
|
||||
if($userinfo===false){
|
||||
return json(['code'=>501, 'msg'=>'No Such Username']);
|
||||
}
|
||||
$realpass=json_decode($userinfo)->passwd;
|
||||
echo ($realpass."\n".hash("sha256", $password)."\n".hash("sha256", 'admin123456'));
|
||||
if(hash("sha256", $password)==$realpass){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', $userinfo);
|
||||
$to = $request->post('to','/admin');
|
||||
return json(['code'=>200, 'msg'=>'Login Successfully']);
|
||||
}else{
|
||||
return json(['code'=>502, 'msg'=>'Auth Failed']);
|
||||
}
|
||||
|
||||
|
||||
return json(['code'=>999, 'msg'=>'Unknown Problem']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
$usernameValidator = v::StringType()->noWhitespace()->length(1, 15);
|
||||
try {
|
||||
$usernameValidator->setName('用户名')->check($name);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
try {
|
||||
$usernameValidator->setName('密码')->check($password);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
$redis = Redis::connection('default');
|
||||
$userinfo=$redis->hget('User',"$name");
|
||||
if($userinfo===false){
|
||||
return json(['code'=>501, 'msg'=>'No Such Username']);
|
||||
}
|
||||
$realpass=json_decode($userinfo)->passwd;
|
||||
echo ($realpass."\n".hash("sha256", $password)."\n".hash("sha256", 'admin123456')."\n".$password);
|
||||
if(hash("sha256", $password)==$realpass){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', $userinfo);
|
||||
$to = $request->post('to','/admin');
|
||||
return json(['code'=>200, 'msg'=>'Login Successfully']);
|
||||
}else{
|
||||
return json(['code'=>502, 'msg'=>'Auth Failed']);
|
||||
}
|
||||
|
||||
|
||||
return json(['code'=>999, 'msg'=>'Unknown Problem']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
$usernameValidator = v::StringType()->noWhitespace()->length(1, 15);
|
||||
try {
|
||||
$usernameValidator->setName('用户名')->check($name);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
try {
|
||||
$usernameValidator->setName('密码')->check($password);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
$redis = Redis::connection('default');
|
||||
$userinfo=$redis->hget('User',"$name");
|
||||
if($userinfo===false){
|
||||
return json(['code'=>501, 'msg'=>'No Such Username']);
|
||||
}
|
||||
$realpass=json_decode($userinfo)->passwd;
|
||||
if(hash("sha256", $password)==$realpass){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', $userinfo);
|
||||
$to = $request->post('to','/admin');
|
||||
return json(['code'=>200, 'msg'=>'Login Successfully']);
|
||||
}else{
|
||||
return json(['code'=>502, 'msg'=>'Auth Failed']);
|
||||
}
|
||||
|
||||
|
||||
return json(['code'=>999, 'msg'=>'Unknown Problem']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
use support\Request;
|
||||
use Webman\Captcha\CaptchaBuilder;
|
||||
use support\View;
|
||||
use Respect\Validation\Validator as v;
|
||||
use support\Redis;
|
||||
|
||||
|
||||
class login
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$to=$request->get('to', '/');
|
||||
View::assign('to', $to);
|
||||
return view('login');
|
||||
}
|
||||
|
||||
public function check(Request $request)
|
||||
{
|
||||
$name = $request->post('name','0');
|
||||
$password = $request->post('password','0');
|
||||
$usernameValidator = v::StringType()->noWhitespace()->length(1, 15);
|
||||
try {
|
||||
$usernameValidator->setName('用户名')->check($name);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
try {
|
||||
$usernameValidator->setName('密码')->check($password);
|
||||
} catch (ValidationException $exception) {
|
||||
return json(['code'=>500, 'msg'=>$e->getMessage()]);
|
||||
}
|
||||
$redis = Redis::connection('default');
|
||||
$userinfo=$redis->hget('User',"$name");
|
||||
if($userinfo===false){
|
||||
return json(['code'=>501, 'msg'=>'No Such Username']);
|
||||
}
|
||||
$realpass=json_decode($userinfo)->passwd;
|
||||
if(hash("sha256", $password)==$realpass){
|
||||
$session = $request->session();
|
||||
$session->set('userinfo', json_decode($userinfo));
|
||||
$to = $request->post('to','/admin');
|
||||
return json(['code'=>200, 'msg'=>'Login Successfully']);
|
||||
}else{
|
||||
return json(['code'=>502, 'msg'=>'Auth Failed']);
|
||||
}
|
||||
|
||||
|
||||
return json(['code'=>999, 'msg'=>'Unknown Problem']);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user