config.php
上传用户:m68239277
上传日期:2014-10-12
资源大小:824k
文件大小:17k
源码类别:

Web服务器

开发平台:

PHP

  1. <?php
  2. session_start();
  3. include("checks.php");
  4. include("../inc/conn.php");
  5. $_SESSION["menus"]="开封盘";
  6. if(isset($_GET["ap"]))
  7. {
  8.   $ap=$_GET["ap"];
  9.   if($ap=="open") mysql_query("update ptime set hand='0' where sign='4'",$conn);
  10.   if($ap=="close") mysql_query("update ptime set hand='1' where sign='4'",$conn);
  11. }
  12. if(isset($_GET["nows"]))
  13.   $as=$_GET["nows"];
  14.   if($as=="open") mysql_query("update ptime set now_bill='0' where sign='4'",$conn);
  15.   if($as=="close") mysql_query("update ptime set now_bill='1' where sign='4'",$conn);
  16. }
  17. $sqlf=mysql_query("select * from ptime where sign='4'",$conn);
  18. $handf=mysql_result($sqlf,0,"hand");
  19. $now_billf=mysql_result($sqlf,0,"now_bill");
  20. $sqld=mysql_query("select * from results order by dates desc",$conn);
  21. $rowr=mysql_fetch_array($sqld);
  22. $dates=$rowr["dates"];
  23. $sql=mysql_query("select * from ptime where sign<>'4' order by dates asc",$conn);
  24. include("../inc/char.inc.php");
  25. if(isset($_GET["op"]))
  26. {  
  27.  $op=$_GET["op"];
  28.  $auto=@$_GET["auto"];
  29.   if($op=="open")
  30.   {
  31.    mysql_query("update ptime set opstate='0',tnum='0',other='0',hand='0' where sign='4'",$conn);
  32.   }elseif($op=="other_close")
  33.   {
  34.    mysql_query("update ptime set other='1' where sign='4'",$conn);
  35.   }elseif($op=="other_open")
  36.   {
  37.    mysql_query("update ptime set other='0' where sign='4'",$conn);
  38.   }elseif($op=="all")
  39.   {
  40.    if(isset($auto)) mysql_query("update ptime set now_state='1' where dates='$dates'",$conn);
  41.    mysql_query("update ptime set opstate='1',tnum='1',other='1',hand='1' where sign='4'",$conn);
  42.   }
  43. }
  44. $sqlcs=mysql_query("select * from ptime where sign='4'",$conn);
  45. $all_close=mysql_result($sqlcs,0,"opstate");
  46. $tnum_close=mysql_result($sqlcs,0,"tnum");
  47. $other_close=mysql_result($sqlcs,0,"other");
  48. $now_state=mysql_result($sqlcs,0,"now_state");
  49. if(isset($_GET["act"]))
  50. {
  51.  $id=$_POST["id"];
  52.  $pdate=$_POST["pdate"];
  53.   if(strlen($pdate)==1)
  54.    {
  55.      $pb="00".$pdate;
  56.    }elseif(strlen($pdate)==2)
  57.    {
  58.      $pb="0".$pdate; 
  59.    }else $pb=$pdate;
  60.  $signs=$_POST["signs"];
  61.  $open_year=$_POST["open_year"]; 
  62.  $open_month=$_POST["open_month"];
  63.  $open_date=$_POST["open_date"];
  64.  $open_hour=$_POST["open_hour"];
  65.  $open_minute=$_POST["open_minute"];
  66.  $open_second=$_POST["open_second"]; 
  67.  if(strlen($open_month)==1) $open_month="0".$open_month;
  68.  if(strlen($open_date)==1) $open_date="0".$open_date;
  69.  if(strlen($open_hour)==1) $open_hour="0".$open_hour;
  70.  if(strlen($open_minute)==1) $open_minute="0".$open_minute;
  71.  if(strlen($open_second)==1) $open_second="0".$open_second; 
  72.  $open_time=$open_year.$open_month.$open_date.$open_hour.$open_minute.$open_second;
  73.  
  74.  $tnum_year=$_POST["tnum_year"];
  75.  $tnum_month=$_POST["tnum_month"];
  76.  $tnum_date=$_POST["tnum_date"];
  77.  $tnum_hour=$_POST["tnum_hour"];
  78.  $tnum_minute=$_POST["tnum_minute"];
  79.  $tnum_second=$_POST["tnum_second"];
  80.  if(strlen($tnum_month)==1) $tnum_month="0".$tnum_month;
  81.  if(strlen($tnum_date)==1) $tnum_date="0".$tnum_date;
  82.  if(strlen($tnum_hour)==1) $tnum_hour="0".$tnum_hour;
  83.  if(strlen($tnum_minute)==1) $tnum_minute="0".$tnum_minute;
  84.  if(strlen($tnum_second)==1) $tnum_second="0".$tnum_second; 
  85.  $tnum_time=$tnum_year.$tnum_month.$tnum_date.$tnum_hour.$tnum_minute.$tnum_second;
  86.  
  87.  $other_year=$_POST["other_year"]; 
  88.  $other_month=$_POST["other_month"];
  89.  $other_date=$_POST["other_date"];
  90.  $other_hour=$_POST["other_hour"];
  91.  $other_minute=$_POST["other_minute"];
  92.  $other_second=$_POST["other_second"];
  93.  if(strlen($other_month)==1) $other_month="0".$other_month;
  94.  if(strlen($other_date)==1) $other_date="0".$other_date;
  95.  if(strlen($other_hour)==1) $other_hour="0".$other_hour;
  96.  if(strlen($other_minute)==1) $other_minute="0".$other_minute;
  97.  if(strlen($other_second)==1) $other_second="0".$other_second; 
  98.  $other_time=$other_year.$other_month.$other_date.$other_hour.$other_minute.$other_second;
  99.  $ok=mysql_query("update ptime set dates='$pb',open_time='$open_time',tnum_close_time='$tnum_time',other_close_time='$other_time' where ID='$id'",$conn);
  100.  if($ok)
  101.  { if($signs==1)
  102.    {  
  103.       if(strlen($pdate)==1)
  104.    { $pos=$pdate-1;
  105.      $pbs="00".$pos;
  106.    }elseif(strlen($pdate)==2)
  107.    {
  108.      $pos=$pdate-1;
  109.      $pbs="0".$pos; 
  110.    }else $pbs=$pdate-1;
  111.      mysql_query("update now_open set dates='$pbs' where ID='1'",$conn);
  112.      mysql_query("update results set dates='$pb' where sign='1'",$conn);
  113.  $sqpl=mysql_query("select * from ptime where now_sign<>'1' and sign<>'4' order by ID asc",$conn);
  114.  while($rs=mysql_fetch_array($sqpl))
  115.  { $pdate++;
  116.     $id=$rs["ID"];
  117.    if(strlen($pdate)==1)
  118.    {
  119.      $pb="00".$pdate;
  120.    }elseif(strlen($pdate)==2)
  121.    {
  122.      $pb="0".$pdate; 
  123.    }else $pb=$pdate;
  124.    mysql_query("update ptime set dates='$pb' where ID='$id'",$conn);
  125.  }
  126.    }
  127.   echo "<script language='javascript'>window.location.href='config.php';</script>";
  128.  }
  129. }
  130. ?>
  131. <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
  132. function time(vtime){
  133. var s='';
  134. var d=vtime!=null?new Date(vtime):new Date();
  135. with(d){
  136. s=fixNum(getHours())+':'+fixNum(getMinutes())+':'+fixNum(getSeconds())
  137. }
  138. return(s);
  139. }
  140. <?php $nowdate = date("Y")."/".date("m")."/".date("d")." ".date("H:i:s")?>
  141. function fixNum(num){
  142. return num<10?'0'+num:num;
  143. }
  144. var dd=new Date("<?=$nowdate?>");
  145. //创建一个数组,用于存放每个月的天数
  146. function montharr(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11) 
  147. {
  148. this[0] = m0;
  149. this[1] = m1;
  150. this[2] = m2;
  151. this[3] = m3;
  152. this[4] = m4;
  153. this[5] = m5;
  154. this[6] = m6;
  155. this[7] = m7;
  156. this[8] = m8;
  157. this[9] = m9;
  158. this[10] = m10;
  159. this[11] = m11;
  160. }
  161. //实现月历
  162. function calendar() {
  163. var monthNames = "JanFebMarAprMayJunJulAugSepOctNovDec";
  164. var today = new Date();
  165. var thisDay;
  166. var monthDays = new montharr(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
  167. year = today.getYear() +1900;
  168. thisDay = today.getDate();
  169. if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) monthDays[1] = 29;
  170. nDays = monthDays[today.getMonth()];
  171. firstDay = today;
  172. firstDay.setDate(1);
  173. testMe = firstDay.getDate();
  174. if (testMe == 2) firstDay.setDate(0);
  175. startDay = firstDay.getDay();
  176. document.write("<div id='rili' style='position:absolute;width:140px;left:10px;top:220px;'>") 
  177. document.write("<TABLE width='217' BORDER='0' CELLSPACING='0' CELLPADDING='2' BGCOLOR='#0080FF'>")
  178. document.write("<TR><TD><table border='0' cellspacing='1' cellpadding='2' bgcolor='Silver'>");
  179. document.write("<TR><th colspan='7' bgcolor='#C8E3FF'>");
  180. var dayNames = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
  181. var monthNames = new Array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");
  182. var now = new Date();
  183. document.writeln("<FONT STYLE='font-size:9pt;Color:#330099'>" + "公元 " + now.getYear() + "年" + monthNames[now.getMonth()] + " " + now.getDate() + "日 " + dayNames[now.getDay()] + "</FONT>");
  184. document.writeln("</TH></TR><TR><TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>日</FONT></TH>");
  185. document.writeln("<th bgcolor='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>一</FONT></TH>");
  186. document.writeln("<TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>二</FONT></TH>");
  187. document.writeln("<TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>三</FONT></TH>");
  188. document.writeln("<TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>四</FONT></TH>");
  189. document.writeln("<TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>五</FONT></TH>");
  190. document.writeln("<TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>六</FONT></TH>");
  191. document.writeln("</TR><TR>");
  192. column = 0;
  193. for (i=0; i<startDay; i++) {
  194. document.writeln("n<TD><FONT STYLE='font-size:9pt'> </FONT></TD>");
  195. column++;
  196. }
  197. for (i=1; i<=nDays; i++) {
  198. if (i == thisDay) {
  199. document.writeln("</TD><TD ALIGN='CENTER' BGCOLOR='#FF8040'><FONT STYLE='font-size:9pt;Color:#ffffff'><B>")
  200. }
  201. else {
  202. document.writeln("</TD><TD BGCOLOR='#FFFFFF' ALIGN='CENTER'><FONT STYLE='font-size:9pt;font-family:Arial;font-weight:bold;Color:#330066'>");
  203. }
  204. document.writeln(i);
  205. if (i == thisDay) document.writeln("</FONT></TD>")
  206. column++;
  207. if (column == 7) {
  208. document.writeln("<TR>"); 
  209. column = 0;
  210. }
  211. }
  212. document.writeln("<TR><TD COLSPAN='7' ALIGN='CENTER' VALIGN='TOP' BGCOLOR='#0080FF'>")
  213. document.writeln("<FORM NAME='clock' onSubmit='0'><FONT STYLE='font-size:9pt;Color:#ffffff'>")
  214. document.writeln("服务器时间:<INPUT TYPE='Text' NAME='face' ALIGN='TOP'size='18' ></FONT></FORM></TD></TR></TABLE>")
  215. document.writeln("</TD></TR></TABLE></div>");
  216. }
  217. </SCRIPT>
  218. <SCRIPT LANGUAGE="JavaScript">
  219. var timerID = null;
  220. var timerRunning = false;
  221. function stopclock (){
  222. if(timerRunning)
  223. clearTimeout(timerID);
  224. timerRunning = false;}
  225. //显示当前时间
  226. function showtime () {
  227. var now = new Date();
  228. var hours = now.getHours();
  229. var minutes = now.getMinutes();
  230. var seconds = now.getSeconds();
  231. var timeValue =time(dd);
  232. //timeValue += ((minutes < 10) ? ":0" : ":") + minutes
  233. //timeValue += ((seconds < 10) ? ":0" : ":") + seconds
  234. timeValue += (hours >= 12) ? " 下午 " : " 上午 "
  235. //document.clock.face.value = timeValue;
  236. //setInterval("dd.setSeconds(dd.getSeconds()+1);document.clock.face.value=time(dd)",1000)
  237. //timerID = setTimeout("showtime()",1000);//设置超时,使时间动态显示
  238. timerRunning = true;}
  239. function startclock () {
  240. stopclock();
  241. showtime();}
  242. </SCRIPT>
  243. <SCRIPT language="javascript">
  244. function Isnum(){
  245.   return ((event.keyCode >= 48) && (event.keyCode <= 57));
  246. }
  247. </SCRIPT>
  248. <script language=javascript>
  249. function time(liveclock){
  250. var s='';
  251. var d=liveclock!=null?new Date(liveclock):new Date();
  252. with(d){
  253. s=show5(getHours())+':'+show5(getMinutes())+':'+show5(getSeconds())
  254. }
  255. return(s);
  256. }
  257. <?php $nowdate = date("Y")."/".date("m")."/".date("d")." ".date("H:i:s")?>
  258. function show5(num){
  259. return num<10?'0'+num:num;
  260. }
  261. var dd=new Date("<?=$nowdate?>");
  262. var ss=setInterval("dd.setSeconds(dd.getSeconds()+1);document.clock.face.value=time(dd)",1000)
  263. </script>
  264. <head>
  265. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  266. <link href="../css/css.CSS" rel="stylesheet" type="text/css">
  267. <title></title>
  268. <style type="text/css">
  269. <!--
  270. body {
  271. margin-left:0px;
  272. }
  273. .STYLE1 {color: #FFFFFF}
  274. -->
  275. </style></head>
  276. <body onLoad="startclock();show5(); timerONE=window.setTimeout" topmargin="0" leftmargin="0">
  277. <table width="100%"  border="0" cellpadding="5" cellspacing="0">
  278.   <tr>
  279.     <td><span class="fbback">当前状态:</span>
  280. <?php if($all_close==0)
  281. { ?><span class="fbred">开盘</span>
  282.  <?
  283.   if($other_close==0) 
  284.   { ?><input name="Submit2" type="button" class="buttonrmin" onClick="javascript:window.location.href='config.php?op=other_close';" value=" 正码封盘 " >
  285.   <? }else
  286.   { ?>
  287.   <input name="Submit2" type="button" class="buttongmin" onClick="javascript:window.location.href='config.php?op=other_open'" value=" 正码开盘 ">
  288.   <? }?>
  289.     <input name="Submit22" type="button" class="buttonrmin" onClick="javascript:window.location.href='config.php?op=all'" value=" 全部封盘 ">
  290.     <? }else
  291. { ?><span class="fblue12"><strong>已封盘</strong></span>  
  292.     <input name="Submit222" type="button" class="buttongmin" onClick="javascript:window.location.href='config.php?op=open'" value="  点击开盘  ">
  293. <? }?></td>
  294.     <td><?php include("times_close.inc.php"); ?></td>
  295.     <td><span class="fbred">自动开盘状态:</span> <? if($handf==1) {?>
  296.   <a href="config.php?ap=open" class="ared" title="点击开启自动开盘状态">关闭</a> <? }else{?>
  297.   <a href="config.php?ap=close" title="点击关闭自动开盘状态">开启</a> <? }?></td>
  298.   </tr>
  299. </table>
  300. <table width="100%" height="58" border="0" cellpadding="3" cellspacing="1" class="t12">
  301.   <tr class="t11">
  302.     <td align="center" class="tblue STYLE1">期数</td>
  303.     <td align="center" class="tblue STYLE1">星期</td>
  304.     <td height="22" class="tblue"><div align="center" class="fw12">开盘时间</div></td>
  305.     <td class="tblue"><div align="center" class="fw12">正码封盘时间</div></td>
  306.     <td class="tblue"><div align="center" class="fw12">特码封盘时间</div></td>
  307.     <td class="tblue"><div align="center" class="fw12">功能</div></td>
  308.     <td class="tblue STYLE1">即时注单</td>
  309.   </tr>
  310.   <?php while($rs=mysql_fetch_array($sql))
  311.   { 
  312.   if($rs["now_sign"]==1):
  313.   $cs="bgcolor=#EAEA00";
  314.   else:
  315.   $cs="class='t17'";
  316.   endif;
  317.   ?>
  318.   <form name="form2" method="post" action="config.php?act=yes" onSubmit="return check(this)">
  319.     <tr  <?=$cs?>>
  320.       <td align="center">
  321.         <input name="pdate" type="text" class="input" id="pdate" value="<?=$rs["dates"]?>" size="3" maxlength="20">期</td>
  322.       <td align="center" class="fred12"><?=week(substr($rs["open_time"],0,10))?></td>
  323.   <? $optime=$rs["open_time"]?>
  324.       <td height="33"><div align="center">
  325.           <input name="open_year" type="text" class="input" id="open_year" value="<?=substr($optime,0,4)?>" size="4" maxlength="4" ONKEYPRESS="event.returnValue=Isnum();">年
  326.           <input name="open_month" type="text" class="input" id="open_month" value="<?=substr($optime,5,2)?>" size="2" maxlength="2" ONKEYPRESS="event.returnValue=Isnum();">月
  327.       <input name="open_date" type="text" class="input" id="open_date" value="<?=substr($optime,8,2)?>" size="2" maxlength="2" ONKEYPRESS="event.returnValue=Isnum();">日
  328.       <input name="open_hour" type="text" class="input" id="open_hour" value="<?=substr($optime,11,2)?>" size="2" maxlength="2" ONKEYPRESS="event.returnValue=Isnum();">
  329.       <span class="fred12">时</span>      
  330.       <input name="open_minute" type="text" class="input" id="open_minute" value="<?=substr($optime,14,2)?>" size="2" maxlength="2" ONKEYPRESS="event.returnValue=Isnum();">分
  331.       <input name="open_second" type="text" class="input" id="open_second" value="<?=substr($optime,17,2)?>" size="2" maxlength="2" ONKEYPRESS="event.returnValue=Isnum();">
  332.       秒</div></td><?php $ottime=$rs["other_close_time"]?>
  333.       <td><div align="center">
  334.         <input name="other_year" type="text" class="input" id="other_year" value="<?=substr($ottime,0,4)?>" size="4" maxlength="4" onKeyPress="event.returnValue=Isnum();">年
  335.         <input name="other_month" type="text" class="input" id="other_month" value="<?=substr($ottime,5,2)?>" size="2" maxlength="2" onKeyPress="event.returnValue=Isnum();">月
  336.         <input name="other_date" type="text" class="input" id="other_date" value="<?=substr($ottime,8,2)?>" size="2" maxlength="2" onKeyPress="event.returnValue=Isnum();">日
  337.         <input name="other_hour" type="text" class="input" id="other_hour" value="<?=substr($ottime,11,2)?>" size="2" maxlength="2" onKeyPress="event.returnValue=Isnum();">
  338.         <span class="fred12">时</span>
  339.         <input name="other_minute" type="text" class="input" id="other_minute" value="<?=substr($ottime,14,2)?>" size="2" maxlength="2" onKeyPress="event.returnValue=Isnum();">分
  340.         <input name="other_second" type="text" class="input" id="other_second" value="<?=substr($ottime,17,2)?>" size="2" maxlength="2" onKeyPress="event.returnValue=Isnum();">秒 
  341.         </div></td>
  342. <?php $ctime=$rs["tnum_close_time"]?>
  343.       <td><div align="center">
  344.         <input name="tnum_year" type="text" class="input" id="tnum_year" value="<?=substr($ctime,0,4)?>" size="4" maxlength="4" ONKEYPRESS="event.returnValue=Isnum();">年
  345. <input name="tnum_month" type="text" class="input" id="tnum_month" value="<?=substr($ctime,5,2)?>" size="2" maxlength="2" ONKEYPRESS="event.returnValue=Isnum();">月
  346. <input name="tnum_date" type="text" class="input" id="tnum_date" value="<?=substr($ctime,8,2)?>" size="2" maxlength="2" ONKEYPRESS="event.returnValue=Isnum();">日
  347. <input name="tnum_hour" type="text" class="input" id="tnum_hour" value="<?=substr($ctime,11,2)?>" size="2" maxlength="2" ONKEYPRESS="event.returnValue=Isnum();">
  348. <span class="fred12">时</span>
  349. <input name="tnum_minute" type="text" class="input" id="tnum_minute" value="<?=substr($ctime,14,2)?>" size="2" maxlength="2" ONKEYPRESS="event.returnValue=Isnum();">分
  350. <input name="tnum_second" type="text" class="input" id="tnum_second" value="<?=substr($ctime,17,2)?>" size="2" maxlength="2" ONKEYPRESS="event.returnValue=Isnum();">秒
  351.         </div></td>
  352.       <td align="center"><input name="Submit" type="submit" class="buttongmin" value="设定"><input name="id" type="hidden" id="id" value="<?=$rs["ID"]?>"><input name="signs" type="hidden" id="signs" value="<?=$rs["now_sign"]?>">&nbsp;      </td>
  353.       <td><div align="center">
  354.   <?  
  355.    if($rs["now_sign"]==1)
  356.   {?>
  357.   <? if($now_billf=="0")
  358.   { ?>
  359.   <a href="config.php?nows=close" title="点击开启当期即时注单状态"><strong>当期</strong></a>
  360.   <? }else
  361.   {?>
  362.   <a href="config.php?nows=open" class="fbred" title="点击关闭当期即时注单状态">上期</a>
  363.   <? }?>
  364.   <? }?></div></td>
  365.     </tr>
  366.   </form>
  367.   <? 
  368.    }?>
  369.   <form name="form3" method="post" action="config.php?act=add&menu=4">
  370.   </form>
  371. </table>
  372. <br>
  373. <span class="fred12">备注:当出现用户前台没有自动开盘时,请点击右上角的自动开盘状态处于开启状态!当在被迫人工封盘时,请手动点击自动开盘状态为开启状态,否则用户前台不会自动开盘!<br>
  374. </span> <span class="fred12">关于即时注单:当即时注单状态为开启时,则显示当期的下注状况,若即时注单为关闭状态则显示上一期的下注状况!
  375. </span>
  376. <script language="JavaScript" type="text/javascript">
  377. calendar();
  378. </script>
  379. </body>
  380. </html>