function.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. <?
  2. require("return.php");
  3. function zwzr(){}
  4. function intotable($itable,$zdarr,$resarr){global $conn;$sqlinto="insert into ".$itable."(".$zdarr.")values(".$resarr.")";mysql_query("SET NAMES 'GBK'");mysql_query($sqlinto,$conn);}
  5. function updatetable($utable,$ures){global $conn;$sqlupdate="update ".$utable." set ".$ures;mysql_query("SET NAMES 'GBK'");mysql_query($sqlupdate,$conn);}
  6. function deletetable($dsql){global $conn;$sqldelete="delete from ".$dsql;mysql_query("SET NAMES 'GBK'");mysql_query($sqldelete,$conn);}
  7. function createDir($path){if(!is_dir($path)){mkdir($path,0777);}}
  8. function sesCheck(){
  9. if(empty($_SESSION["SHOPUSER"]) || empty($_SESSION["SHOPUSERPWD"])){php_toheader("../reg/");}
  10. $sqluy="select * from yjcode_user where uid='".$_SESSION["SHOPUSER"]."' and pwd='".$_SESSION["SHOPUSERPWD"]."'";mysql_query("SET NAMES 'GBK'");
  11. $resuy=mysql_query($sqluy);if(!$rowuy=mysql_fetch_array($resuy)){$_SESSION["SHOPUSER"]="";$_SESSION["SHOPUSERPWD"]="";php_toheader(weburl);}
  12. }
  13. function sesCheck_m(){
  14. if(empty($_SESSION["SHOPUSER"]) || empty($_SESSION["SHOPUSERPWD"])){php_toheader("../reg/");}
  15. $sqluy="select * from yjcode_user where uid='".$_SESSION["SHOPUSER"]."' and pwd='".$_SESSION["SHOPUSERPWD"]."'";mysql_query("SET NAMES 'GBK'");
  16. $resuy=mysql_query($sqluy);if(!$rowuy=mysql_fetch_array($resuy)){$_SESSION["SHOPUSER"]="";$_SESSION["SHOPUSERPWD"]="";php_toheader(weburl);}
  17. }
  18. function AdminSes_audit(){
  19. if($_SESSION["SHOPADMIN"]=="" || $_SESSION["SHOPADMINPWD"]==""){php_toheader("index.php");}
  20. global $adminqx;
  21. $sqladmin="select * from yjcode_admin where adminuid='".$_SESSION["SHOPADMIN"]."' and adminpwd='".$_SESSION["SHOPADMINPWD"]."'";mysql_query("SET NAMES 'GBK'");
  22. $resadmin=mysql_query($sqladmin);
  23. if(!$rowadmin=mysql_fetch_array($resadmin)){$_SESSION["SHOPADMIN"]="";$_SESSION["SHOPADMINPWD"]="";php_toheader("./");}else{$adminqx=$rowadmin[qx];}
  24. $wzget=$_SERVER['PHP_SELF'];
  25. if(empty($wzget)){echo "HT001 [yj.928vip.cn]";exit;}
  26. $ht1=preg_split("/\//",$wzget);
  27. $houtai=$ht1[count($ht1)-2];
  28. if(strstr($adminqx,",0,")){if(strcmp("yjadmin",$houtai)==0 || strcmp("admin",$houtai)==0 || strcmp("manage",$houtai)==0 || strcmp("admin888",$houtai)==0){php_toheader("ht.php");}}
  29. }
  30. function php_toheader($nurlx){echo "<script>";echo "location.href='".$nurlx."';";echo "</script>";exit;}
  31. function Audit_alert($alertStr,$alertUrl,$par=""){echo "<meta http-equiv=\"content-type\" content=\"text/html; charset=gb2312\"><script>";echo "alert('".$alertStr."');".$par."location.href='".$alertUrl."';";echo "</script>";exit;}define("CHR",weburl);
  32. function tjbtnr($a,$b="",$c=""){
  33. if($c==""){$ts="正在处理数据,请不要刷新页面,也不要关闭页面 ^_^";}else{$ts=$c;}
  34. $bk="";
  35. if($b!=""){$bk="<input type=\"button\" class=\"btn3 tjinput\" onmouseover=\"this.className='btn3 btn4 tjinput';\" onclick=\"gourl('".$b."')\" onmouseout=\"this.className='btn3 tjinput';\" value=\"返回\" />";}
  36. echo "<div id=\"tjbtn\"><input type=\"submit\" class=\"btn1 tjinput\" onmouseover=\"this.className='btn1 btn2 tjinput';\" onmouseout=\"this.className='btn1 tjinput';\" value=\"".$a."\" />".$bk."</div><div id=\"tjing\" style=\"display:none;color:#F96F39;\"><img style=\"margin:0 0 6px 0;\" src=\"../img/ajax_loader.gif\" width=\"208\" height=\"13\" /><br>".$ts."</div>";}
  37. function pagef($se,$ps,$ptable,$px,$pzd="*"){global $res;global $count;global $page_count;global $page;global $row;$ses=$se;$pagesize=$ps;$sql="select count(*) as id from ".$ptable." ".$ses;mysql_query("SET NAMES 'GBK'");$res=mysql_query($sql);$row=mysql_fetch_array($res);$count=$row["id"];if($count%$pagesize==0){$allpage=$count/$pagesize;}else{$allpage=($count-$count%$pagesize)/$pagesize+1;}if($count % $pagesize){$page_count=(int)($count / $pagesize)+1;}else{$page_count=$count / $pagesize;}
  38. if($page>$page_count){$page=$page_count;}if($page<1){$page=1;}$sql="select ".$pzd." from ".$ptable." ".$ses." ".$px." limit ".($page-1)*$pagesize.",".$pagesize."";mysql_query("SET NAMES 'GBK'");$res=mysql_query($sql);}
  39. function tjbtnr_m($a){echo "<input type=\"submit\" class=\"tjinput\" value=\"".$a."\" />";}
  40. function uploadtpnodata($tpi,$lj,$mc,$tpgs,$bw,$bg,$sw=0,$sh=0,$needsy="yes",$xw=0,$xh=0){
  41. $i=$tpi;
  42. if(check_in(";",$_FILES["inp$i"]["tmp_name"])){exit;}
  43. $cm=new CreatMiniature();
  44. createDir("../".$lj);
  45. if(!empty($_FILES["inp$i"]["tmp_name"])){
  46. if($tpgs=="jpg"){$tp = array("image/pjpeg","image/jpeg","image/jpg");}
  47. elseif($tpgs=="gif"){$tp = array("image/gif");}
  48. elseif($tpgs=="allpic"){$tp = array("image/pjpeg","image/jpeg","image/jpg","image/gif","image/x-png","image/png");}
  49. if(!in_array($_FILES["inp$i"]["type"],$tp)){echo "<script>alert('格式不对');history.go(-1);</script>";exit;}
  50. $filetype = $_FILES["inp$i"]['type'];
  51. if($filetype == 'image/jpeg' || $filetype == 'image/jpg' || $filetype == 'image/pjpeg'){$type = '.jpg';}
  52. if($filetype == 'image/gif'){$type = '.gif';}$tna=$_FILES["inp$i"]["name"];
  53. move_uploaded_file($_FILES["inp$i"]['tmp_name'], "../".$lj.$mc);
  54. list($width, $height) = getimagesize(weburl.$lj.$mc);
  55. if($bg==0){$bgv=intval($height/($width/$bw));}else{$bgv=$bg;}
  56. $cm->SetVar("../".$lj.$mc,"file");
  57. if($width>$bw){$cm->Cut("../".$lj.$mc,$bw,$bgv);}
  58. if($needsy=="yes"){imageWaterMark("../".$lj.$mc,websypos,"../img/shuiyin.png","","","","",0,0);}
  59. if($sw!=0){$a=preg_split("/\./",$mc);$cm->Cut("../".$lj.$a[0]."-1.".$a[1],$sw,$sh);}
  60. if($xw!=0){$a=preg_split("/\./",$mc);$cm->Cut("../".$lj.$a[0]."-2.".$a[1],$xw,$xh);}
  61. }
  62. }
  63. function uploadtp($tbh,$tty,$tuid){
  64. global $res3;
  65. while3("*","yjcode_clear where bh='".$tbh."' and type1='".$tty."' order by id asc");
  66. $i=1;
  67. while($row3=mysql_fetch_array($res3)){
  68. $nxh=returnxh("yjcode_tp"," and bh='".$tbh."' and type1='".$tty."'");
  69. if(panduan("*","yjcode_tp where bh='".$tbh."' and type1='".$tty."' and iffm=1")==1){$fmv=0;}else{$fmv=1;}
  70. intotable("yjcode_tp","bh,tp,type1,iffm,sj,userid,xh","'".$tbh."','".$row3[tp]."','".$tty."',".$fmv.",'".$row3[sj]."','".$tuid."',".$nxh."");
  71. deletetable("yjcode_clear where id=".$row3[id]);
  72. $i++;
  73. }
  74. }
  75. function delDirAndFile($dirName){
  76. if(is_dir($dirName)){
  77. if ( $handle = opendir( "$dirName" ) ) {
  78. while ( false !== ( $item = readdir( $handle ) ) ) {
  79. if ( $item != "." && $item != ".." ) {
  80. if ( is_dir( "$dirName/$item" ) ) {delDirAndFile( "$dirName/$item" );}
  81. else {if( unlink( "$dirName/$item" ) );}}
  82. }
  83. closedir($handle);
  84. if(rmdir($dirName));}
  85. }
  86. }
  87. function delFile($nowu){if(is_file($nowu)){unlink($nowu);}}
  88. function html_template($yurl,$nurl){
  89. $url =weburl.$yurl;
  90. $ch = curl_init();
  91. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  92. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
  93. curl_setopt($ch, CURLOPT_URL, $url);
  94. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  95. curl_setopt($ch, CURLOPT_HEADER, 0);
  96. $output = curl_exec($ch);
  97. curl_close($ch);
  98. $fp= fopen($nurl,"w");
  99. fwrite($fp,$output);
  100. fclose($fp);
  101. }
  102. function html1(){
  103. global $rowcontrol;
  104. $mb=$rowcontrol[nowmb];
  105. if(empty($mb)){updatetable("yjcode_control","nowmb='default'");$mb="default";}
  106. recurse_copy("../tem/moban/".$mb."/css/","../css/");
  107. recurse_copy("../tem/moban/".$mb."/homeimg/","../homeimg/");
  108. recurse_copy("../tem/moban/".$mb."/js/","../js/");
  109. html_template("tem/moban/".$mb."/tem/top.php","../tem/top.html");
  110. html_template("tem/moban/".$mb."/tem/top1.php","../tem/top1.html");
  111. html_template("tem/moban/".$mb."/tem/bottom.php","../tem/bottom.html");
  112. html_template("tem/moban/".$mb."/indextemplate.php","../index.html");
  113. html_template("news/indextemplate.php","../news/index.html");
  114. html_template("help/map.php","../help/map.html");
  115. if(empty($rowcontrol[ifwap])){
  116. $wapmb=$rowcontrol[wapmb];
  117. if(empty($wapmb)){updatetable("yjcode_control","wapmb='default'");$wapmb="default";}
  118. recurse_copy("../m/tem/moban/".$wapmb."/css/","../m/css/");
  119. recurse_copy("../m/tem/moban/".$wapmb."/homeimg/","../m/homeimg/");
  120. recurse_copy("../m/tem/moban/".$wapmb."/js/","../m/js/");
  121. html_template("m/tem/moban/".$wapmb."/indextemplate.php","../m/index.html");
  122. }
  123. $nsj=date("Y-m-d H:i:s",strtotime("-1 day"));
  124. deletetable("yjcode_help where zt=99");
  125. deletetable("yjcode_news where zt=99 and sj<='".$nsj."'");
  126. deletetable("yjcode_newspj where zt=99 and sj<='".$nsj."'");
  127. deletetable("yjcode_ad where zt=99 and sj<='".$nsj."'");
  128. deletetable("yjcode_adlx where zt=99 and sj<='".$nsj."'");
  129. deletetable("yjcode_pro where zt=99 and sj<='".$nsj."'");
  130. deletetable("yjcode_protype where zt=99 and sj<='".$nsj."'");
  131. deletetable("yjcode_gg where zt=99 and sj<='".$nsj."'");
  132. deletetable("yjcode_gd where zt=99 and sj<='".$nsj."'");
  133. deletetable("yjcode_gdhf where zt=99 and sj<='".$nsj."'");
  134. deletetable("yjcode_taocan where zt=99");
  135. deletetable("yjcode_kuaidi where zt=99");
  136. deletetable("yjcode_userdj where zt=99");
  137. deletetable("yjcode_shdz where zt=99 and sj<='".$nsj."'");
  138. deletetable("yjcode_yunfei where zt=99");
  139. deletetable("yjcode_provideo where zt=99");
  140. deletetable("yjcode_djl");
  141. deletetable("yjcode_servertype where zt=99 and sj<='".$nsj."'");
  142. deletetable("yjcode_server where zt=99 and sj<='".$nsj."'");
  143. }
  144. function recurse_copy($src,$dst) {$dir = opendir($src);@mkdir($dst);while(false !== ( $file = readdir($dir)) ) {if (( $file != '.' ) && ( $file != '..' )) {if ( is_dir($src . '/' . $file) ) {recurse_copy($src . '/' . $file,$dst . '/' . $file);}else {copy($src . '/' . $file,$dst . '/' . $file);}}}closedir($dir);}
  145. function PointUpdateM($c_uid,$c_money){global $conn;$m=sprintf("%.2f",$c_money);updatetable("yjcode_user","money1=money1+(".$m.") where id=".$c_uid);}
  146. function PointIntoM($c_uid,$c_tit,$c_money,$c_admin=0,$c_jyh=''){
  147. global $conn;
  148. $m=sprintf("%.2f",$c_money);
  149. intotable("yjcode_moneyrecord","bh,userid,tit,moneynum,sj,uip,admin,jyh","'".time()."',".$c_uid.",'".$c_tit."',".$m.",'".date('Y-m-d H:i:s')."','".$_SERVER['REMOTE_ADDR']."',".intval($c_admin).",'".$c_jyh."'");
  150. }
  151. function PointUpdateB($c_uid,$c_money){global $conn;$m=sprintf("%.2f",$c_money);updatetable("yjcode_user","baomoney=baomoney+(".$m.") where id=".$c_uid);}
  152. function PointIntoB($c_uid,$c_tit,$c_money,$c_admin=0,$c_zt=0){global $conn;$m=sprintf("%.2f",$c_money);intotable("yjcode_baomoneyrecord","bh,userid,tit,moneynum,sj,uip,admin,zt","'".time()."',".$c_uid.",'".$c_tit."',".$m.",'".date('Y-m-d H:i:s')."','".$_SERVER['REMOTE_ADDR']."',".$c_admin.",".$c_zt."");}
  153. function PointUpdate($c_uid,$c_jf){global $conn;updatetable("yjcode_user","jf=jf+(".$c_jf.") where id=".$c_uid);}
  154. function PointInto($c_uid,$c_tit,$c_jf){global $conn;intotable("yjcode_jfrecord","userid,tit,jfnum,sj,uip","".$c_uid.",'".$c_tit."',".$c_jf.",'".date('Y-m-d H:i:s')."','".$_SERVER['REMOTE_ADDR']."'");}
  155. function while0($wzd,$wses){global $res;$sql="select ".$wzd." from ".$wses;mysql_query("SET NAMES 'GBK'");$res=mysql_query($sql);}function while1($wzd,$wses){global $res1;$sql1="select ".$wzd." from ".$wses;mysql_query("SET NAMES 'GBK'");$res1=mysql_query($sql1);}function while2($wzd,$wses){global $res2;$sql2="select ".$wzd." from ".$wses;mysql_query("SET NAMES 'GBK'");$res2=mysql_query($sql2);}function while3($wzd,$wses){global $res3;$sql3="select ".$wzd." from ".$wses;mysql_query("SET NAMES 'GBK'");$res3=mysql_query($sql3);}
  156. function delproduct($b,$u){
  157. $pid=returnproid($b);
  158. deletetable("yjcode_clear where bh='".$b."'");
  159. deletetable("yjcode_tp where bh='".$b."'");
  160. deletetable("yjcode_propj where probh='".$b."'");
  161. deletetable("yjcode_car where probh='".$b."'");
  162. deletetable("yjcode_profav where probh='".$b."'");
  163. deletetable("yjcode_kc where probh='".$b."'");
  164. deletetable("yjcode_taocan where probh='".$b."'");
  165. deletetable("yjcode_taocan_kc where probh='".$b."'");
  166. deletetable("yjcode_prouserdj where probh='".$b."'");
  167. deletetable("yjcode_provideo where probh='".$b."'");
  168. deletetable("yjcode_jubao where jbid=".$pid." and admin=1");
  169. deletetable("yjcode_wenda where probh='".$b."'");
  170. delDirAndFile("../upload/".$u."/".$b."/");
  171. deletetable("yjcode_pro where bh='".$b."'");
  172. }
  173. function deluid($u){//删除会员
  174. global $res3;
  175. $userid=returnuserid($u);
  176. if(is_numeric($userid)){
  177. deletetable("yjcode_news where userid=".$userid);
  178. deletetable("yjcode_tp where userid=".$userid);
  179. deletetable("yjcode_loginlog where userid=".$userid);
  180. deletetable("yjcode_moneyrecord where userid=".$userid);
  181. deletetable("yjcode_baomoneyrecord where userid=".$userid);
  182. deletetable("yjcode_jfrecord where userid=".$userid);
  183. deletetable("yjcode_tixian where userid=".$userid);
  184. while3("bh,userid","yjcode_pro where userid=".$userid);while($row3=mysql_fetch_array($res3)){delproduct($row3[bh],$row3[userid]);}
  185. deletetable("yjcode_protype where userid=".$userid);
  186. deletetable("yjcode_shopmenu where userid=".$userid);
  187. deletetable("yjcode_shopbannar where userid=".$userid);
  188. deletetable("yjcode_propj where userid=".$userid);
  189. deletetable("yjcode_car where userid=".$userid);
  190. deletetable("yjcode_order where selluserid=".$userid." or userid=".$userid);
  191. deletetable("yjcode_db where selluserid=".$userid." or userid=".$userid);
  192. deletetable("yjcode_tk where selluserid=".$userid." or userid=".$userid);
  193. deletetable("yjcode_shopfav where shopid=".$userid." or userid=".$userid);
  194. deletetable("yjcode_profav where userid=".$userid);
  195. deletetable("yjcode_dingdang where userid=".$userid);
  196. deletetable("yjcode_qiandao where userid=".$userid);
  197. deletetable("yjcode_task where userid=".$userid);
  198. deletetable("yjcode_taskhf where userid=".$userid." or useridhf=".$userid);
  199. deletetable("yjcode_tasklog where userid=".$userid." or useridhf=".$userid);
  200. deletetable("yjcode_kc where userid=".$userid." or userid1=".$userid);
  201. deletetable("yjcode_taocan_kc where userid=".$userid." or userid1=".$userid);
  202. deletetable("yjcode_smsmail where userid=".$userid);
  203. deletetable("yjcode_gd where userid=".$userid);
  204. deletetable("yjcode_gdhf where userid=".$userid);
  205. deletetable("yjcode_sms where userid=".$userid);
  206. deletetable("yjcode_payreng where userid=".$userid);
  207. deletetable("yjcode_prouserdj where userid=".$userid);
  208. deletetable("yjcode_shdz where userid=".$userid);
  209. deletetable("yjcode_yunfei where userid=".$userid);
  210. deletetable("yjcode_provideo where userid=".$userid);
  211. deletetable("yjcode_orderlog where userid=".$userid." or selluserid=".$userid);
  212. deletetable("yjcode_fbhis where userid=".$userid);
  213. deletetable("yjcode_wenda where userid=".$userid." or selluserid=".$userid);
  214. deletetable("yjcode_server where userid=".$userid);
  215. deletetable("yjcode_serverorder where userid=".$userid." or selluserid=".$userid);
  216. deletetable("yjcode_serverorderlog where userid=".$userid." or selluserid=".$userid);
  217. deletetable("yjcode_serverpj where userid=".$userid." or selluserid=".$userid);
  218. delDirAndFile("../upload/".$userid."/");
  219. clearstatcache();
  220. if(!is_dir("../upload/".$userid."/")){deletetable("yjcode_user where uid='".$u."'");}
  221. }
  222. }
  223. function checkdjl($c,$bhid,$tb){
  224. $uid=returnuserid($_SESSION[SHOPUSER]);
  225. $sj1=date("Y-m-d H:i:s");
  226. $uip1=$_SERVER["REMOTE_ADDR"];
  227. global $res1;
  228. $y=0;
  229. while1("sj,uip,admin,bhid","yjcode_djl where admin='".$c."' and uip='".$uip1."' and bhid='".$bhid."' order by sj desc");
  230. if(!$row1=mysql_fetch_array($res1)){$y=2;}else{
  231. $sjc=DateDiff($sj1,$row1[sj],"s");
  232. if($sjc>600){$y=1;}else{$y=0;}
  233. }
  234. if(2==$y){intotable("yjcode_djl","userid,sj,uip,admin,bhid","".$uid.",'".$sj1."','".$uip1."','".$c."','".$bhid."'");}
  235. elseif(1==$y){updatetable("yjcode_djl","sj='".$sj1."' where admin='".$c."' and uip='".$uip1."' and bhid='".$bhid."'");}
  236. if(0!=$y){
  237. if(check_in($c,"c1,c2,c3,c4")){
  238. updatetable($tb,"djl=djl+1 where id=".$bhid);
  239. }
  240. }
  241. }
  242. function sellmoneytj($u){
  243. $ma=0;
  244. $sqlb="select sum(money1*num) as totalall from yjcode_order where ddzt='suc' and selluserid=".$u;
  245. mysql_query("SET NAMES 'GBK'");$resb=mysql_query($sqlb);if($rowb=mysql_fetch_array($resb)){$ma=$rowb["totalall"];}
  246. $mb=0;
  247. $sqlb="select sum(money1*num) as totalall from yjcode_order where ddzt='suc' and month(sj) = month(curdate()) and year(sj) = year(curdate()) and selluserid=".$u;
  248. mysql_query("SET NAMES 'GBK'");$resb=mysql_query($sqlb);if($rowb=mysql_fetch_array($resb)){$mb=$rowb["totalall"];}
  249. updatetable("yjcode_user","sellmall=".$ma.",sellmyue=".$mb." where id=".$u);
  250. }
  251. function taskok($tid){ //自动验证任务状态
  252. global $rowcontrol;
  253. global $conn;
  254. $sj1=date("Y-m-d H:i:s");
  255. $sqla="select * from yjcode_task where id=".$tid;mysql_query("SET NAMES 'GBK'");$resa=mysql_query($sqla,$conn);if($rowa=mysql_fetch_array($resa)){
  256. //单人任务到期B
  257. if(empty($rowa[taskty]) && $sj1>=$rowa[yxq] && 0==$rowa[zt]){
  258. updatetable("yjcode_task","zt=10 where id=".$rowa[id]);
  259. if($rowa[money4]>0){
  260. PointIntoM($rowa[userid],"任务到期,退回订金(任务编号".$rowa[bh].")",$rowa[money4]);
  261. PointUpdateM($rowa[userid],$rowa[money4]);
  262. }
  263. if(!empty($rowa[jsbao])){
  264. $sqlb="select * from yjcode_taskhf where bh='".$rowa[bh]."'";mysql_query("SET NAMES 'GBK'");$resb=mysql_query($sqlb,$conn);while($rowb=mysql_fetch_array($resb)){
  265. PointIntoB($rowb[useridhf],"雇主未在有效期内选标,任务结束,退还保证金",$rowa[jsbao],2);
  266. PointUpdateB($rowb[useridhf],$rowa[jsbao]);
  267. }
  268. }
  269. }
  270. //单人任务到期E
  271. //单人任务接手未完成B
  272. if(empty($rowa[taskty]) && 3==$rowa[zt]){
  273. $sqlb="select * from yjcode_taskhf where bh='".$rowa[bh]."' and ifxz=1 and useridhf=".$rowa[useridhf]."";mysql_query("SET NAMES 'GBK'");$resb=mysql_query($sqlb,$conn);
  274. if($rowb=mysql_fetch_array($resb)){
  275. if($rowb[rwdq]<=$sj1){
  276. updatetable("yjcode_task","zt=10 where id=".$rowa[id]);
  277. if($rowa[money4]>0){
  278. PointIntoM($rowa[userid],"任务到期,退回订金(任务编号".$rowa[bh].")",$rowa[money4]);
  279. PointUpdateM($rowa[userid],$rowa[money4]);
  280. }
  281. PointIntoM($rowa[userid],"接手方未在时规定时间里提交验收,退回款项(任务编号".$rowa[bh].")",$rowa[money3]);
  282. PointUpdateM($rowa[userid],$rowa[money3]);
  283. if(!empty($rowa[jsbao])){
  284. PointIntoB($rowa[userid],"接手方未在规定时间里提交验收,雇主获赔保证金",$rowa[jsbao],2);
  285. PointUpdateB($rowa[userid],$rowa[jsbao]);
  286. }
  287. }
  288. }
  289. }
  290. //单人任务接手未完成E
  291. //单人任务接手方验收B
  292. if(empty($rowa[taskty]) && 4==$rowa[zt]){
  293. $sqlb="select * from yjcode_taskhf where bh='".$rowa[bh]."' and ifxz=1 and useridhf=".$rowa[useridhf]."";mysql_query("SET NAMES 'GBK'");$resb=mysql_query($sqlb,$conn);
  294. if($rowb=mysql_fetch_array($resb)){
  295. if($rowb[oksj]<=$sj1){
  296. PointIntoM($rowa[useridhf],"任务完成,获得佣金(任务编号".$rowa[bh].")",$rowb[money1]);
  297. PointUpdateM($rowa[useridhf],$rowb[money1]);
  298. if(1==$rowa[yjfs]){
  299. $m=$rowcontrol[taskyj]*$rowb[money1]*(-1);
  300. PointIntoM($rowa[useridhf],"任务完成,扣除平台中介费(任务编号".$rowa[bh].")",$m);
  301. PointUpdateM($rowa[useridhf],$m);
  302. }elseif(2==$rowa[yjfs]){
  303. $m=$rowcontrol[taskyj]*$rowb[money1]*(-1)*0.5;
  304. PointIntoM($rowa[useridhf],"任务完成,扣除平台中介费(任务编号".$rowa[bh].")",$m);
  305. PointUpdateM($rowa[useridhf],$m);
  306. }
  307. updatetable("yjcode_task","zt=5 where id=".$rowa[id]);
  308. $txt="雇主未在指定时间内进行验收,系统自动处理";
  309. intotable("yjcode_tasklog","bh,userid,useridhf,admin,txt,sj,fj","'".$rowa[bh]."',".$rowa[userid].",".$rowa[useridhf].",3,'".$txt."','".$sj1."',''");
  310. if(!empty($rowa[jsbao])){
  311. PointIntoB($rowa[useridhf],"任务完成通过验收,退还保证金",$rowa[jsbao],2);
  312. PointUpdateB($rowa[useridhf],$rowa[jsbao]);
  313. }
  314. }
  315. }
  316. }
  317. //单人任务接手方验收E
  318. //多人任务到期B
  319. if($rowa[taskty]==1 && $sj1>=$rowa[yxq] && 101==$rowa[zt]){
  320. updatetable("yjcode_task","zt=104 where id=".$rowa[id]);
  321. }
  322. if($rowa[taskty]==1 && 104==$rowa[zt]){
  323. if(panduan("*","yjcode_taskhf where bh='".$rowa[bh]."' and (zt=1 or zt=3 or zt=4)")==0){
  324. if($rowa[money3]>0){
  325. PointIntoM($rowa[userid],"任务到期,退回已冻结金额(任务编号".$rowa[bh].")",$rowa[money3]);
  326. PointUpdateM($rowa[userid],$rowa[money3]);
  327. updatetable("yjcode_task","money3=0 where id=".$rowa[id]);
  328. }
  329. }
  330. }
  331. //多人任务到期E
  332. //多人任务接手未完成B
  333. if(1==$rowa[taskty] && 101==$rowa[zt]){
  334. $sqlb="select * from yjcode_taskhf where bh='".$rowa[bh]."' and zt=0";mysql_query("SET NAMES 'GBK'");$resb=mysql_query($sqlb,$conn);
  335. while($rowb=mysql_fetch_array($resb)){
  336. if($rowb[rwdq]<=$sj1){
  337. updatetable("yjcode_taskhf","zt=7 where id=".$rowb[id]);
  338. if(!empty($rowa[jsbao])){
  339. PointIntoB($rowa[userid],"接手方未在规定时间里提交验收,雇主获赔保证金",$rowa[jsbao],2);
  340. PointUpdateB($rowa[userid],$rowa[jsbao]);
  341. }
  342. }
  343. }
  344. }
  345. //多人任务接手未完成E
  346. //多人任务接手判断B
  347. if($rowa[taskty]==1 && (101==$rowa[zt] || 104==$rowa[zt])){
  348. $sqlb="select * from yjcode_taskhf where bh='".$rowa[bh]."' and zt=1 and taskty=1";mysql_query("SET NAMES 'GBK'");$resb=mysql_query($sqlb,$conn);
  349. while($rowb=mysql_fetch_array($resb)){
  350. if($rowb[oksj]<=$sj1){
  351. if(1==$rowb[zt]){
  352. PointIntoM($rowb[useridhf],"任务完成,获得佣金(任务编号".$rowb[bh].")",$rowb[money1]);
  353. PointUpdateM($rowb[useridhf],$rowb[money1]);
  354. $zjm=0;
  355. if(0==$rowtask[yjfs]){
  356. $zjm=$rowcontrol[taskyj]*$rowb[money1];
  357. }elseif(1==$rowa[yjfs]){
  358. $m=$rowcontrol[taskyj]*$rowb[money1]*(-1);
  359. PointIntoM($rowb[useridhf],"任务完成,扣除平台中介费(任务编号".$rowb[bh].")",$m);
  360. PointUpdateM($rowb[useridhf],$m);
  361. }elseif(2==$rowa[yjfs]){
  362. $m=$rowcontrol[taskyj]*$rowb[money1]*(-1)*0.5;
  363. $zjm=$m;
  364. PointIntoM($rowb[useridhf],"任务完成,扣除平台中介费(任务编号".$rowb[bh].")",$m);
  365. PointUpdateM($rowb[useridhf],$m);
  366. }
  367. $djm=$rowb[money1]+abs($zjm);
  368. updatetable("yjcode_task","money3=money3-".$djm." where id=".$rowa[id]);
  369. updatetable("yjcode_taskhf","zt=2 where id=".$rowb[id]);
  370. $txt="雇主未在指定时间内进行验收,系统自动处理";
  371. intotable("yjcode_tasklog","bh,userid,useridhf,admin,txt,sj,fj","'".$rowb[bh]."',".$rowb[userid].",".$rowb[useridhf].",3,'".$txt."','".$sj1."',''");
  372. if(!empty($rowa[jsbao])){
  373. PointIntoB($rowb[useridhf],"雇主未在指定时间内进行验收,退还保证金",$rowa[jsbao],2);
  374. PointUpdateB($rowb[useridhf],$rowa[jsbao]);
  375. }
  376. }elseif(3==$rowb[zt]){
  377. updatetable("yjcode_taskhf","zt=7 where id=".$rowb[id]);
  378. }
  379. }
  380. }
  381. }
  382. //多人任务接手判断E
  383. //多人任务参与B
  384. if($rowa[taskty]==1){
  385. $anu=returncount("yjcode_taskhf where bh='".$rowa[bh]."' and taskty=1 and (zt=0 or zt=1 or zt=2 or zt=3 or zt=4)");
  386. updatetable("yjcode_task","taskcy=".$anu." where id=".$rowa[id]);
  387. $anok=returncount("yjcode_taskhf where bh='".$rowa[bh]."' and taskty=1 and zt=2");
  388. if($anok>=$rowa[tasknum]){
  389. updatetable("yjcode_task","zt=102 where id=".$rowa[id]);
  390. }
  391. }
  392. //多人任务参与E
  393. }
  394. }
  395. function kamikc($b){
  396. if(!empty($b)){
  397. if(panduan("bh,fhxs","yjcode_pro where bh='".$b."' and fhxs=4")==1){
  398. $a=returncount("yjcode_kc where ifok=0 and probh='".$b."'");
  399. updatetable("yjcode_pro","kcnum=".$a." where bh='".$b."'");
  400. }
  401. }
  402. }
  403. function kamikc_tc($b,$d){
  404. if(!empty($b)){
  405. if(panduan("id,fhxs","yjcode_taocan where fhxs=4 and id=".$d)==1){
  406. $a=returncount("yjcode_taocan_kc where ifok=0 and probh='".$b."' and tcid=".$d);
  407. updatetable("yjcode_taocan","kcnum=".$a." where id=".$d);
  408. }
  409. }
  410. }
  411. function autoAD($ab){
  412. $sj1=date("Y-m-d H:i:s");
  413. $sqlad="select * from yjcode_ad where adbh='".$ab."' and zt=0 order by id asc";mysql_query("SET NAMES 'GBK'");$resad=mysql_query($sqlad);
  414. while($rowad=mysql_fetch_array($resad)){
  415. if($sj1>$rowad[dqsj]){
  416. deletetable("yjcode_ad where id=".$rowad[id]);
  417. }
  418. }
  419. $sqlad1="select * from yjcode_adlx where adbh='".$ab."' and admin=1 order by id asc";mysql_query("SET NAMES 'GBK'");$resad1=mysql_query($sqlad1);
  420. if($rowad1=mysql_fetch_array($resad1)){
  421. if(1==$rowad1[fflx]){
  422. $maxnum=$rowad1[maxnum];
  423. $nnum=returncount("yjcode_ad where adbh='".$ab."' and zt=0");
  424. if($maxnum>$nnum){
  425. $ni=$maxnum-$nnum;
  426. $sqlad2="select * from yjcode_ad where adbh='".$ab."' and zt=1 order by sj asc limit ".$ni;mysql_query("SET NAMES 'GBK'");$resad2=mysql_query($sqlad2);
  427. while($rowad2=mysql_fetch_array($resad2)){
  428. $sjc=strtotime($rowad2[dqsj])-strtotime($rowad2[sj])+strtotime($sj1);
  429. $dq=date("Y-m-d H:i:s",$sjc);
  430. updatetable("yjcode_ad","zt=0,dqsj='".$dq."' where id=".$rowad2[id]);
  431. }
  432. }
  433. }elseif(2==$rowad1[fflx]){
  434. $sqlad4="select * from yjcode_ad where adbh='".$ab."' and zt=1 order by sj asc";mysql_query("SET NAMES 'GBK'");$resad4=mysql_query($sqlad4);
  435. while($rowad4=mysql_fetch_array($resad4)){
  436. $sqlad2="select * from yjcode_ad where adbh='".$ab."' and zt=0 and xh=".$rowad4[xh];mysql_query("SET NAMES 'GBK'");$resad2=mysql_query($sqlad2);
  437. if(!$rowad2=mysql_fetch_array($resad2)){
  438. $sjc=strtotime($rowad2[dqsj])-strtotime($rowad2[sj])+strtotime($sj1);
  439. $dq=date("Y-m-d H:i:s",$sjc);
  440. updatetable("yjcode_ad","zt=0,dqsj='".$dq."' where id=".$rowad4[id]);
  441. }
  442. }
  443. }
  444. }
  445. }
  446. /*IP黑名单过滤B*/
  447. if(mysql_num_rows(mysql_query("SHOW TABLES LIKE 'yjcode_guolv'"))==1){
  448. $nip=preg_split("/\./",getuip());
  449. $sqlglip="select * from yjcode_guolv where admin=1 and ((ip1='".$nip[0]."' and ip2='*' and ip3='*' and ip4='*') or (ip1='".$nip[0]."' and ip2='".$nip[1]."' and ip3='*' and ip4='*') or (ip1='".$nip[0]."' and ip2='".$nip[1]."' and ip3='".$nip[2]."' and ip4='*') or (ip1='".$nip[0]."' and ip2='".$nip[1]."' and ip3='".$nip[2]."' and ip4='".$nip[3]."')) order by id asc";mysql_query("SET NAMES 'GBK'");$resglip=mysql_query($sqlglip);
  450. if($rowglip=mysql_fetch_array($resglip)){
  451. echo "ERROR88";exit;
  452. }
  453. }
  454. /*IP黑名单过滤E*/
  455. ?>