This repository has been archived on 2022-12-28. You can view files and clone it, but cannot push or open issues or pull requests.
gemcapi/rqdeal/index.php
2020-07-24 15:53:10 +08:00

1190 lines
57 KiB
PHP

<?php
session_start();
//Deal the request
if($_GET['path'] == null){
echo '{"wikis": "https://gitee.com/ghink/gemcapi/wikis","serverid": "cn-19;gemcapi-rqdeal-s1","servertime": "'.date('Y-m-d H:i:s').'"}';
}else{
if($_GET['token'] == null){
if($_SESSION['times1'] < 11){
$rqresult='http://1.free.gemcapi.ghink.net:10000/'.$_GET['path'];
$_SESSION['times1'] = $_SESSION['times1'] + 1;
$_SESSION['times2'] = 0;
}else{
$rqresult='http://2.free.gemcapi.ghink.net:10000/'.$_GET['path'];
$_SESSION['times2'] = $_SESSION['times2'] + 1;
if($_SESSION['times2'] = 10){
$_SESSION['times1'] = 0;
}
}
}else{
$rqresult='http://1.free.gemcapi.ghink.net:10000/'.$_GET['path'];
}
}
//Return the result
if($_GET['type'] == 'json'){
echo '{"address": "'.$rqresult.'","serverid": "cn-19;gemcapi-rqdeal-s1","servertime": "'.date('Y-m-d H:i:s').'"}';
}elseif($_GET['type'] == 'redirect'){
header('Location: '.$rqresult);
}else{
}
//Get which kind of the connection is.
$ua=$_SERVER['HTTP_USER_AGENT'];
//Get where the connection from.
$ipinfo=@file_get_contents("http://api.ghink.net/ipinfo/?ip=".$_SERVER['HTTP_X_FORWARDED_FOR']);
$ipinfo=json_decode($ipinfo);
foreach($ipinfo as $ii=>$ii2){
$$ii = $ii2;
}
$link=mysqli_connect("localhost","gemcapi","ghink2014","gemcapi", 10202);
//Deal the data of province_day.
$result=mysqli_query($link,"SELECT * FROM `province_day` WHERE `date`='".date("Y-m-d")."'");
if(empty(mysqli_fetch_array($result))){
//The data of today in province_day is not exist.
if($pro == '北京市'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `beijing`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '天津市'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `tianjin`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '上海市'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `shanghai`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '重庆市'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `chongqing`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '河北省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `hebei`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '山西省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `shanxijing`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '辽宁省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `liaoning`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '吉林省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `jilin`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '黑龙江省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `heilongjiang`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '江苏省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `jiangsu`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '浙江省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `zhejiang`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '安徽省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `anhui`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '福建省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `fujian`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '江西省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `jiangxi`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '山东省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `shandong`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '河南省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `henan`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '湖北省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `hubei`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '湖南省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `hunan`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '广东省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `guangdong`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '海南省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `hainan`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '四川省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `sichuan`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '贵州省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `guizhou`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '云南省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `yunnan`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '陕西省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `shanxiqing`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '甘肃省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `gansu`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '青海省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `qinhai`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '台湾省'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `taiwan`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '内蒙古'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `neimenggu`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '广西'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `guangxi`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '西藏'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `xizang`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '宁夏'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `ninxia`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '新疆'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `xinjiang`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '香港'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `xianggang`) VALUES ('".date("Y-m-d")."', '1')");
}elseif($pro == '澳门'){
mysqli_query($link,"INSERT INTO `province_day` (`date`, `aomen`) VALUES ('".date("Y-m-d")."', '1')");
}
}else{
//The data of today in province_day has already exist.
if($pro == '北京市'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['beijing'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `beijing`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '天津市'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['tianjin'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `tianjin`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '上海市'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['shanghai'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `shanghai`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '重庆市'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['chongqing'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `chongqing`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '河北省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['hebei'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `hebei`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '山西省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['shanxijing'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `shanxijing`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '辽宁省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['liaoning'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `liaoning`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '吉林省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['jilin'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `jilin`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '黑龙江省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['heilongjiang'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `heilongjiang`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '江苏省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['jiangsu'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `jiangsu`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '浙江省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['zhejiang'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `zhejiang`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '安徽省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['anhui'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `anhui`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '福建省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['fujian'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `fujian`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '江西省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['jiangxi'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `jiangxi`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '山东省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['shandong'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `shandong`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '河南省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['henan'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `henan`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '湖北省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['hubei'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `hubei`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '湖南省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['hunan'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `hunan`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '广东省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['guangdong'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `guangdong`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '海南省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['hainan'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `hainan`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '四川省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['sichuan'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `sichuan`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '贵州省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['guizhou'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `guizhou`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '云南省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['yunnan'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `yunnan`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '陕西省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['shanxiqing'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `shanxiqing`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '甘肃省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['gansu'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `gansu`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '青海省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['qinhai'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `qinhai`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '台湾省'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['taiwan'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `taiwan`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '内蒙古'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['neimenggu'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `neimenggu`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '广西'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['guangxi'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `guangxi`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '西藏'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['xizang'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `xizang`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '宁夏'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['ninxia'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `ninxia`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '新疆'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['xinjiang'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `xinjiang`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '香港'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['xianggang'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `xianggang`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}elseif($pro == '澳门'){
$result = mysqli_query($link,"SELECT * FROM `province_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['aomen'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_day` SET `aomen`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}
}
//Deal the data of province_month.
$result=mysqli_query($link,"SELECT * FROM `province_month` WHERE `date`='".date("Y-m")."'");
if(empty(mysqli_fetch_array($result))){
//The data of today in province_month is not exist.
if($pro == '北京市'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `beijing`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '天津市'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `tianjin`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '上海市'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `shanghai`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '重庆市'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `chongqing`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '河北省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `hebei`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '山西省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `shanxijing`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '辽宁省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `liaoning`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '吉林省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `jilin`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '黑龙江省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `heilongjiang`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '江苏省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `jiangsu`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '浙江省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `zhejiang`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '安徽省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `anhui`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '福建省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `fujian`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '江西省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `jiangxi`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '山东省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `shandong`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '河南省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `henan`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '湖北省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `hubei`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '湖南省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `hunan`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '广东省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `guangdong`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '海南省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `hainan`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '四川省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `sichuan`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '贵州省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `guizhou`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '云南省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `yunnan`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '陕西省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `shanxiqing`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '甘肃省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `gansu`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '青海省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `qinhai`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '台湾省'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `taiwan`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '内蒙古'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `neimenggu`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '广西'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `guangxi`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '西藏'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `xizang`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '宁夏'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `ninxia`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '新疆'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `xinjiang`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '香港'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `xianggang`) VALUES ('".date("Y-m")."', '1')");
}elseif($pro == '澳门'){
mysqli_query($link,"INSERT INTO `province_month` (`date`, `aomen`) VALUES ('".date("Y-m")."', '1')");
}
}else{
//The data of today in province_month has already exist.
if($pro == '北京市'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['beijing'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `beijing`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '天津市'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['tianjin'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `tianjin`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '上海市'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['shanghai'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `shanghai`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '重庆市'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['chongqing'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `chongqing`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '河北省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['hebei'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `hebei`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '山西省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['shanxijing'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `shanxijing`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '辽宁省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['liaoning'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `liaoning`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '吉林省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['jilin'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `jilin`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '黑龙江省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['heilongjiang'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `heilongjiang`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '江苏省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['jiangsu'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `jiangsu`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '浙江省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['zhejiang'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `zhejiang`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '安徽省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['anhui'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `anhui`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '福建省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['fujian'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `fujian`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '江西省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['jiangxi'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `jiangxi`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '山东省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['shandong'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `shandong`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '河南省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['henan'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `henan`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '湖北省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['hubei'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `hubei`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '湖南省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['hunan'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `hunan`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '广东省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['guangdong'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `guangdong`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '海南省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['hainan'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `hainan`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '四川省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['sichuan'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `sichuan`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '贵州省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['guizhou'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `guizhou`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '云南省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['yunnan'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `yunnan`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '陕西省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['shanxiqing'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `shanxiqing`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '甘肃省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['gansu'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `gansu`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '青海省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['qinhai'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `qinhai`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '台湾省'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['taiwan'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `taiwan`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '内蒙古'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['neimenggu'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `neimenggu`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '广西'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['guangxi'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `guangxi`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '西藏'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['xizang'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `xizang`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '宁夏'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['ninxia'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `ninxia`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '新疆'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['xinjiang'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `xinjiang`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '香港'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['xianggang'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `xianggang`='".$number."' WHERE `date`='".date("Y-m")."'");
}elseif($pro == '澳门'){
$result = mysqli_query($link,"SELECT * FROM `province_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['aomen'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_month` SET `aomen`='".$number."' WHERE `date`='".date("Y-m")."'");
}
}
//Deal the data of province_year.
$result=mysqli_query($link,"SELECT * FROM `province_year` WHERE `date`='".date("Y")."'");
if(empty(mysqli_fetch_array($result))){
//The data of today in province_year is not exist.
if($pro == '北京市'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `beijing`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '天津市'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `tianjin`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '上海市'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `shanghai`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '重庆市'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `chongqing`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '河北省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `hebei`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '山西省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `shanxijing`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '辽宁省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `liaoning`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '吉林省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `jilin`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '黑龙江省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `heilongjiang`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '江苏省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `jiangsu`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '浙江省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `zhejiang`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '安徽省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `anhui`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '福建省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `fujian`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '江西省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `jiangxi`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '山东省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `shandong`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '河南省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `henan`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '湖北省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `hubei`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '湖南省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `hunan`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '广东省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `guangdong`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '海南省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `hainan`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '四川省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `sichuan`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '贵州省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `guizhou`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '云南省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `yunnan`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '陕西省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `shanxiqing`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '甘肃省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `gansu`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '青海省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `qinhai`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '台湾省'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `taiwan`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '内蒙古'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `neimenggu`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '广西'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `guangxi`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '西藏'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `xizang`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '宁夏'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `ninxia`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '新疆'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `xinjiang`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '香港'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `xianggang`) VALUES ('".date("Y")."', '1')");
}elseif($pro == '澳门'){
mysqli_query($link,"INSERT INTO `province_year` (`date`, `aomen`) VALUES ('".date("Y")."', '1')");
}
}else{
//The data of today in province_year has already exist.
if($pro == '北京市'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['beijing'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `beijing`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '天津市'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['tianjin'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `tianjin`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '上海市'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['shanghai'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `shanghai`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '重庆市'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['chongqing'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `chongqing`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '河北省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['hebei'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `hebei`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '山西省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['shanxijing'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `shanxijing`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '辽宁省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['liaoning'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `liaoning`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '吉林省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['jilin'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `jilin`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '黑龙江省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['heilongjiang'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `heilongjiang`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '江苏省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['jiangsu'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `jiangsu`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '浙江省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['zhejiang'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `zhejiang`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '安徽省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['anhui'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `anhui`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '福建省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['fujian'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `fujian`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '江西省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['jiangxi'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `jiangxi`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '山东省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['shandong'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `shandong`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '河南省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['henan'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `henan`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '湖北省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['hubei'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `hubei`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '湖南省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['hunan'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `hunan`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '广东省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['guangdong'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `guangdong`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '海南省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['hainan'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `hainan`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '四川省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['sichuan'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `sichuan`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '贵州省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['guizhou'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `guizhou`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '云南省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['yunnan'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `yunnan`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '陕西省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['shanxiqing'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `shanxiqing`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '甘肃省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['gansu'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `gansu`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '青海省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['qinhai'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `qinhai`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '台湾省'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['taiwan'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `taiwan`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '内蒙古'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['neimenggu'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `neimenggu`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '广西'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['guangxi'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `guangxi`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '西藏'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['xizang'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `xizang`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '宁夏'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['ninxia'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `ninxia`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '新疆'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['xinjiang'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `xinjiang`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '香港'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['xianggang'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `xianggang`='".$number."' WHERE `date`='".date("Y")."'");
}elseif($pro == '澳门'){
$result = mysqli_query($link,"SELECT * FROM `province_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row['aomen'];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `province_year` SET `aomen`='".$number."' WHERE `date`='".date("Y")."'");
}
}
//Deal the data of useragent_day.
$result=mysqli_query($link,"SELECT * FROM `useragent_day` WHERE `date`='".date("Y-m-d")."'");
if(empty(mysqli_fetch_array($result))){
if(strpos($ua,"/") == false){
//Not the standard useragent.
mysqli_query($link,"INSERT INTO `useragent_day` (`date`, `unknown`) VALUES ('".date("Y-m-d")."', '1')");
if(empty(@mysqli_fetch_array($ua))){
mysqli_query($link,"ALTER TABLE `useragent_day` ADD `".$ua."` INT NOT NULL;");
mysqli_query($link,"INSERT INTO `useragent_day` (`date`, `".$ua."`) VALUES ('".date("Y-m-d")."', '1')");
}else{
mysqli_query($link,"INSERT INTO `useragent_day` (`date`, `".$ua."`) VALUES ('".date("Y-m-d")."', '1')");
}
}else{
//The standard useragent.
$type=strstr($ua,"/",true);
$result=mysqli_query($link,"SELECT `".$type."` FROM `useragent_day`");
if(empty(@mysqli_fetch_array($result))){
mysqli_query($link,"ALTER TABLE `useragent_day` ADD `".$type."` INT NOT NULL;");
mysqli_query($link,"INSERT INTO `useragent_day` (`date`, `".$type."`) VALUES ('".date("Y-m-d")."', '1')");
}else{
mysqli_query($link,"INSERT INTO `useragent_day` (`date`, `".$type."`) VALUES ('".date("Y-m-d")."', '1')");
}
}
}else{
if(strpos($ua,"/") == false){
//Not the standard useragent.
if(empty(@mysqli_fetch_array($ua))){
mysqli_query($link,"ALTER TABLE `useragent_day` ADD `".$ua."` INT NOT NULL;");
$result = mysqli_query($link,"SELECT * FROM `useragent_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row[$ua];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `useragent_day` SET `".$ua."`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}else{
$result = mysqli_query($link,"SELECT * FROM `useragent_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row[$ua];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `useragent_day` SET `".$ua."`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}
}else{
//The standard useragent.
$type=stristr($ua,"/",true);
$result=mysqli_query($link,"SELECT `".$type."` FROM `useragent_day`");
if(empty(@mysqli_fetch_array($result))){
mysqli_query($link,"ALTER TABLE `useragent_day` ADD `".$type."` INT NOT NULL;");
$result = mysqli_query($link,"SELECT * FROM `useragent_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row[$type];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `useragent_day` SET `".$type."`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}else{
$result = mysqli_query($link,"SELECT * FROM `useragent_day` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row[$type];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `useragent_day` SET `".$type."`='".$number."' WHERE `date`='".date("Y-m-d")."'");
}
}
}
//Deal the data of useragent_month.
$result=mysqli_query($link,"SELECT * FROM `useragent_month` WHERE `date`='".date("Y-m")."'");
if(empty(mysqli_fetch_array($result))){
if(strpos($ua,"/") == false){
//Not the standard useragent.
mysqli_query($link,"INSERT INTO `useragent_month` (`date`, `unknown`) VALUES ('".date("Y-m")."', '1')");
if(empty(@mysqli_fetch_array($ua))){
mysqli_query($link,"ALTER TABLE `useragent_month` ADD `".$ua."` INT NOT NULL;");
mysqli_query($link,"INSERT INTO `useragent_month` (`date`, `".$ua."`) VALUES ('".date("Y-m")."', '1')");
}else{
mysqli_query($link,"INSERT INTO `useragent_month` (`date`, `".$ua."`) VALUES ('".date("Y-m")."', '1')");
}
}else{
//The standard useragent.
$type=strstr($ua,"/",true);
$result=mysqli_query($link,"SELECT `".$type."` FROM `useragent_month`");
if(empty(@mysqli_fetch_array($result))){
mysqli_query($link,"ALTER TABLE `useragent_month` ADD `".$type."` INT NOT NULL;");
mysqli_query($link,"INSERT INTO `useragent_month` (`date`, `".$type."`) VALUES ('".date("Y-m")."', '1')");
}else{
mysqli_query($link,"INSERT INTO `useragent_month` (`date`, `".$type."`) VALUES ('".date("Y-m")."', '1')");
}
}
}else{
if(strpos($ua,"/") == false){
//Not the standard useragent.
if(empty(@mysqli_fetch_array($ua))){
mysqli_query($link,"ALTER TABLE `useragent_month` ADD `".$ua."` INT NOT NULL;");
$result = mysqli_query($link,"SELECT * FROM `useragent_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row[$ua];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `useragent_month` SET `".$ua."`='".$number."' WHERE `date`='".date("Y-m")."'");
}else{
$result = mysqli_query($link,"SELECT * FROM `useragent_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row[$ua];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `useragent_month` SET `".$ua."`='".$number."' WHERE `date`='".date("Y-m")."'");
}
}else{
//The standard useragent.
$type=stristr($ua,"/",true);
$result=mysqli_query($link,"SELECT `".$type."` FROM `useragent_month`");
if(empty(@mysqli_fetch_array($result))){
mysqli_query($link,"ALTER TABLE `useragent_month` ADD `".$type."` INT NOT NULL;");
$result = mysqli_query($link,"SELECT * FROM `useragent_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row[$type];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `useragent_month` SET `".$type."`='".$number."' WHERE `date`='".date("Y-m")."'");
}else{
$result = mysqli_query($link,"SELECT * FROM `useragent_month` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row[$type];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `useragent_month` SET `".$type."`='".$number."' WHERE `date`='".date("Y-m")."'");
}
}
}
//Deal the data of useragent_year.
$result=mysqli_query($link,"SELECT * FROM `useragent_year` WHERE `date`='".date("Y")."'");
if(empty(mysqli_fetch_array($result))){
if(strpos($ua,"/") == false){
//Not the standard useragent.
mysqli_query($link,"INSERT INTO `useragent_year` (`date`, `unknown`) VALUES ('".date("Y")."', '1')");
if(empty(@mysqli_fetch_array($ua))){
mysqli_query($link,"ALTER TABLE `useragent_year` ADD `".$ua."` INT NOT NULL;");
mysqli_query($link,"INSERT INTO `useragent_year` (`date`, `".$ua."`) VALUES ('".date("Y")."', '1')");
}else{
mysqli_query($link,"INSERT INTO `useragent_year` (`date`, `".$ua."`) VALUES ('".date("Y")."', '1')");
}
}else{
//The standard useragent.
$type=strstr($ua,"/",true);
$result=mysqli_query($link,"SELECT `".$type."` FROM `useragent_year`");
if(empty(@mysqli_fetch_array($result))){
mysqli_query($link,"ALTER TABLE `useragent_year` ADD `".$type."` INT NOT NULL;");
mysqli_query($link,"INSERT INTO `useragent_year` (`date`, `".$type."`) VALUES ('".date("Y")."', '1')");
}else{
mysqli_query($link,"INSERT INTO `useragent_year` (`date`, `".$type."`) VALUES ('".date("Y")."', '1')");
}
}
}else{
if(strpos($ua,"/") == false){
//Not the standard useragent.
if(empty(@mysqli_fetch_array($ua))){
mysqli_query($link,"ALTER TABLE `useragent_year` ADD `".$ua."` INT NOT NULL;");
$result = mysqli_query($link,"SELECT * FROM `useragent_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row[$ua];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `useragent_year` SET `".$ua."`='".$number."' WHERE `date`='".date("Y")."'");
}else{
$result = mysqli_query($link,"SELECT * FROM `useragent_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row[$ua];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `useragent_year` SET `".$ua."`='".$number."' WHERE `date`='".date("Y")."'");
}
}else{
//The standard useragent.
$type=stristr($ua,"/",true);
$result=mysqli_query($link,"SELECT `".$type."` FROM `useragent_year`");
if(empty(@mysqli_fetch_array($result))){
mysqli_query($link,"ALTER TABLE `useragent_year` ADD `".$type."` INT NOT NULL;");
$result = mysqli_query($link,"SELECT * FROM `useragent_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row[$type];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `useragent_year` SET `".$type."`='".$number."' WHERE `date`='".date("Y")."'");
}else{
$result = mysqli_query($link,"SELECT * FROM `useragent_year` WHERE 1");
while($row = mysqli_fetch_array($result)){
$number=$row[$type];
}
$number=(int)$number + 1;
mysqli_query($link,"UPDATE `useragent_year` SET `".$type."`='".$number."' WHERE `date`='".date("Y")."'");
}
}
}
//Output the site logs.
$logs="[GEMCAPI-RQDEAL-S1][".date('Y-m-d H:i:d')."][HOST:".$_SERVER['HTTP_HOST']."][IP:".$_SERVER['HTTP_X_FORWARDED_FOR']."][PRO:".$pro."][GET:path=".$_GET['path']."&type=".$_GET['type']."][RQRESULT:".$rqsult."\n";
$fd = fopen("logs/".date('Y-m-d').".txt",'a');
fwrite($fd,$logs);
fclose($fd);
mysqli_close($link);//Close the link with database.