index.jsp
上传用户:mingda
上传日期:2017-06-20
资源大小:27691k
文件大小:6k
源码类别:

OA系统

开发平台:

Java

  1. <%@ page contentType="text/html; charset=gb2312"%>
  2. <%@ page import="com.gforce.currency.*,com.gforce.gfoa.*,java.util.*" %>
  3. <%
  4. OnlineUserManager.Instance();
  5. OnlineUserManager.AddNewSession(session);
  6. String strServerURL = request.getRequestURL().toString();
  7. if(strServerURL.indexOf("://")>-1)
  8. {
  9.   strServerURL = strServerURL.substring(strServerURL.indexOf("://")+3);
  10. }
  11. if(strServerURL.indexOf(":")>-1)
  12. {
  13.   strServerURL = strServerURL.substring(0,strServerURL.indexOf(":"));
  14. }
  15. if(strServerURL.indexOf("/")>-1)
  16. {
  17.   strServerURL = strServerURL.substring(0,strServerURL.indexOf("/"));
  18. }
  19. //out.print(strServerURL);
  20. Session m_session = new Session(session);
  21. int intUserID = m_session.GetInt("UserID");
  22. String strRightPages = m_session.GetString("RightPages");
  23. if(intUserID<1)
  24. {
  25.     Request m_request = new Request(request);
  26.     String strUserName = m_request.GetString("username");
  27.     String strPassword = m_request.GetString("password");
  28.     if(strUserName.trim().length()<1 || strPassword.trim().length()<1)
  29.     {
  30. %>
  31. <html>
  32. <head>
  33. <title><%=SystemParament.GetSystemName() + " --- 当前共有" + OnlineUserManager.getOnlineUsers().size() + "人在线"%></title>
  34. <link href="css/txt.jsp" rel="stylesheet" type="text/css">
  35. <meta http-equiv="Content-Type" content="text/html; charset=gb2312"><meta http-equiv="pragma" content="no-cache">
  36.   <script langage="javascript" src="/js/sethomepage.js"  type="text/javascript"></script>
  37.   <script langage="javascript" type="text/javascript">
  38.   function checklogin()
  39.   {
  40.     if(document.login.username.value=="")
  41.     {
  42.       alert("请输入用户名!");
  43.       document.login.username.focus();
  44.       return false;
  45.     }
  46.     if(document.login.password.value=="")
  47.     {
  48.       alert("请输入用户密码!");
  49.       document.login.password.focus();
  50.       return false;
  51.     }
  52.   }
  53.   </script>
  54.   <style type="text/css">
  55. <!--
  56. .style2 {color: #999999}
  57. .style3 {
  58.         color: #FFFFFF;
  59.         font-weight: bold;
  60. }
  61. -->
  62.   </style>
  63. </head>
  64. <body bgcolor="#CECBCE" leftmargin="0" topmargin="0" onload="document.login.username.focus();">
  65. <table width="100%" height="97%" border="0" align="center">
  66.   <tr>
  67.     <td align="center">
  68.       <table width="770" height="429" border="0" align="center" cellspacing="0">
  69.         <tr>
  70.           <td height="450" background="images/main.jpg" align="left" valign="bottom" width="770">
  71.            <!--<form name="login" method="post" action="https://<%=strServerURL%>/" onSubmit="javascript:return checklogin();">-->
  72.           <form name="login" method="post" action="" onSubmit="javascript:return checklogin();">
  73.             <table height="107" border="0" align="left" cellpadding="0" cellspacing="0" id="table1">
  74.               <tr>
  75.                 <td align="right" height="26">&nbsp;</td>
  76.                 <td>&nbsp;</td>
  77.                 <td align="left">                  &nbsp;
  78.                   <input name="username" tabindex="1" size="10" maxlength="10" style="border-width: 0px;height:15px;width:126px;">
  79.                 </td>
  80.                 <td align="center" rowspan="4">&nbsp;&nbsp;&nbsp;&nbsp;
  81.                 </td>
  82.               </tr>
  83.               <tr>
  84.                 <td align="right" height="26">&nbsp;</td>
  85.                 <td>&nbsp;</td>
  86.                 <td align="left">                  &nbsp;
  87.                   <input name="password" type="password" tabindex="2" size="10" maxlength="10" style="border-width: 0px;height:15px;width:126px;"/>
  88.                 </td>
  89.               </tr>
  90.               <tr>
  91.                 <td width="50" height="55" rowspan="3" align="right">&nbsp;</td>
  92.                 <td width="72" rowspan="2">&nbsp;</td>
  93.                 <td height="28" align="center" valign="bottom">
  94.                   <img alt="" src="images/white.gif" width="0" border="0"/>
  95.                   <input name="imageField" tabindex="2" type="image" src="images/white.gif" width="133" height="21" border="0">
  96.                 </td>
  97.               </tr>
  98.               <tr>
  99.                 <td height="27" align="left">&nbsp;</td>
  100.               </tr>
  101.             </table>
  102.           </form>
  103.           </td>
  104.         </tr>
  105.       </table>
  106.     </td>
  107.   </tr>
  108. </table>
  109. </body>
  110. </html>
  111. <%
  112.     }
  113.     else
  114.     {
  115.         boolean isLogined = false;
  116.         intUserID = UserManager.CheckLogin(strUserName,strPassword);
  117.         if(intUserID>0)
  118.           isLogined = true;
  119.         if(isLogined)
  120.         {
  121.             m_session.SetValue("UserID",intUserID + "");
  122.             int intRoleID = UserManager.GetUserRoleID(intUserID);
  123.             strRightPages = PageRight.getPageRight(intRoleID);
  124.             m_session.SetValue("RightPages",strRightPages);
  125.             response.sendRedirect("/");
  126.         }
  127.         else
  128.         {
  129.             %>
  130. <html>
  131. <head>
  132. <script language="javascript" type="text/javascript">
  133. alert("用户名或者密码错误,登陆失败!");
  134. history.back();
  135. </script>
  136. </head>
  137. </html>
  138.             <%
  139.             session.removeAttribute("UserID");
  140.             m_session.SetValue("UserID","0");
  141.             m_session.SetValue("RightPages","");
  142.         }
  143.     }
  144. }
  145. else if(strRightPages.trim().length()<1)
  146. {
  147.     %>
  148. <html>
  149. <head>
  150. <script language="javascript" type="text/javascript">
  151. alert("您在此系统中没有任何权限,登陆失败");
  152. history.back();
  153. </script>
  154. </head>
  155. </html>
  156. <%
  157.     session.removeAttribute("UserID");
  158.     m_session.SetValue("UserID","0");
  159.     m_session.SetValue("RightPages","");
  160. }
  161. else
  162. {
  163.     ///response.sendRedirect(SystemParament.getParament("systembaseurl") + "/main.jsp");
  164.     response.sendRedirect("/main.jsp");
  165. }
  166. %>