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

Web服务器

开发平台:

PHP

  1. <?php
  2. session_start();
  3. set_time_limit(1800);
  4. $user=$_SESSION["all_agent"];
  5. $names=$_SESSION["user_name"];
  6. include("../inc/conn.php");
  7. include("checks.php");
  8. $menu=$_SESSION["menus"];
  9. mysql_query("update online set title='$menu' where user_account='$user' and user_type='3'",$conn);
  10. $sqlps=mysql_query("select * from online where user_account='$user' and user_type='3' and vmsg='1'",$conn);
  11. if(mysql_num_rows($sqlps)<>0)
  12. {
  13.   mysql_query("update online set vmsg='0' where user_account='$user'",$conn);
  14.   echo "<script language='javascript'>alert('".mysql_result($sqlps,0,"content")."')</script>";
  15. }
  16. $sql_count=mysql_query("select * from online ",$conn);
  17. $nowtimes=date("Y-m-d H:i:s");
  18. $h=date("YmdHis");
  19. while($rowct=mysql_fetch_array($sql_count))
  20. {
  21. $tcid=$rowct["ID"];
  22. $tctimes=$rowct["active_time"];
  23. $tctime=split(" ",$tctimes);
  24. $tcymd=split("-",$tctime[0]);
  25. $tchms=split(":",$tctime[1]);
  26. $tclimit_times=mktime($tchms[0],$tchms[1],$tchms[2],$tcymd[1],$tcymd[2],$tcymd[0]);
  27. $lowtime=time()-$tclimit_times."<br>";
  28. if($lowtime>1800) mysql_query("delete from online where ID='$tcid'",$conn);
  29. }
  30. $sqlhv=mysql_query("select * from online where user_account='$user'",$conn);
  31. $find_haves=mysql_num_rows($sqlhv);
  32. $ip=$_SERVER['REMOTE_ADDR'];
  33. if($find_haves==0) mysql_query("insert into online(user_type,user_name,user_account,ip,login_time,login_time,active_time)values('3','$names','$user','$ip','$h','$h')",$conn);
  34. $sqlps=mysql_query("select * from all_agent where user_account='$user'",$conn);
  35. mysql_query("update online set active_time='$nowtimes' where user_account='$user'",$conn);
  36. if(mysql_result($sqlps,0,"online")==1)
  37. {
  38.   echo "<script language='javascript'>alert('Parse error,please login again!');window.location.href='exit.php';</script>";
  39. }
  40. $sqlpt=mysql_query("select * from all_agent where user_account='$user'",$conn);//踢出
  41. if(mysql_result($sqlpt,0,"deleted")==1) echo "<script language='javascript'>alert('对不起,您的账号已被停用!');window.location.href='exit.php';</script>";
  42. $names=$_SESSION["user_name"];
  43. $sqlf=mysql_query("select * from online where user_account='$user'",$conn);
  44. $have=mysql_num_rows($sqlf);
  45. $ip=$_SERVER['REMOTE_ADDR'];
  46. $tm=date(YmdHis);
  47. if($have==0) mysql_query("insert into online(user_type,user_name,user_account,ip,login_time,active_time)values('3','$names','$user','$ip','$tm','$tm')",$conn);    
  48. $sqlon=mysql_query("select * from onuser where user_account='$user' and sign='3'",$conn); //登录T出
  49. if(mysql_num_rows($sqlon)>0&&!isset($_SESSION["onyes"]))
  50. {
  51.   echo "<script language='javascript'>alert('对不起,您的账号在别处登录,您被迫下线!');window.location.href='exit.php';</script>";
  52. }elseif(mysql_num_rows($sqlon)==0)
  53. {
  54.   unset($_SESSION["onyes"]);
  55. }
  56. ?>
  57. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  58. <meta http-equiv="refresh" content="20;URL=">