<? require "header.php"?>
<?
/**
 * @version		1.0
 * @package		HonoWeb->HonoBBS
 * @copyright	Copyright (C) HonoWeb. All rights reserved.
 * @Website		www.honoweb.com.
 */
 ?>
<html>
<head>
<title><?=$bbs_config_row['bbs_name']?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="<?=$T_BBS_Style_CSS?>" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<?=$BBSFolder?>/js/check.js"></script>
</head>
<script language="javascript" src="<?=$BBSFolder?>/js/ajax.js"></script>
 <script language="javascript">
                function send_request_post_checkuser(url,querystring,func) {
                    create_request();
                    if(func=='login') http_request.onreadystatechange = processLogin;
                    if(func=='forgetPassword') http_request.onreadystatechange = processForgetPassword;
                    
                    http_request.open("POST", url, true);
                    http_request.setRequestHeader("Content-Type"," application/x-www-form-urlencoded"); 
                    http_request.send(querystring);
                }
                
            
                function processLogin() {
                        var form=document.getElementById("form1");
                        if (http_request.readyState == 4) { 
                            if (http_request.status == 200) { 
                        
                                if(http_request.responseText==1)
                                {
                                    
                                    location='<?=$BBSFolder?>/message.php?flag=login';
                                    
                                }
                                if(http_request.responseText==2)
                                {
                                    alert('Enter username or password error! ');
                                }
                                
                               
                            } else { //页面不正常
                                alert("error");
                            }
                        }
                    }
                
                function checkLogin() {
                    var form=document.getElementById("form1");
                   if(form.username.value=="")
                    {
                        alert("请输入您的用户名!");
                        form.username.focus();
                        return;
                    }
                    if(form.psw.value=="")
                    {
                        alert("请输入您的密码!");
                        form.psw.focus();
                        return;
                    }
                    querystring="username="+form.username.value+"&psw="+form.psw.value;
                     send_request_post_checkuser('<?=$BBSFolder?>/ajax/login.php',querystring,"login");
                }
                
            </script>
<body>

<form name="form1" id="form1"  method="post" >
  <table border="0" cellpadding="0"  cellspacing="0" class="firsttable">
    <tr>
      <td align="center" valign="top">
	  	<table  cellpadding="0" cellspacing="0"  class="centertable">
      		<tr> 
            	<td align="center"><? include "top.php"?> 
            	</td>
       		</tr>
        	<tr>
        	  <td align="center">&nbsp;</td>
      	  </tr>
        	<tr>
        	  <td align="center"><table width="100%"  border="0" cellpadding="0" cellspacing="0" class="bg2">
                <tr>
                  <td height="26" style="padding-left:10px; "><img src="<?=$BBSFolder?>/images/rightarrow.gif" width="11" height="10"> <font class="font1"><a href="<?=$BBSFolder?>/index.php" style="text-decoration:none ">首页</a> → 登陆</font></td>
                </tr>
              </table></td>
      	  </tr>
        	<tr>
        	  <td align="center">&nbsp;</td>
        	</tr>
            <tr>
              <td id="an" align="center"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="bg1" style="font-size:12px;">
                <tr align="center" class="bar" style="font-size:12px; font-weight:bold;color:#FFF2B1; ">
                  <td height="28" colspan="2" ><font class="bar1">请输入您的用户名和密码</font></td>
                </tr>
              
                <tr>
					<td width="290" height="30" class="lefttd" style="padding-left:10px; ">您的用户名</td>
                  <td class="righttd" style="padding-left:10px; "><input name="username" type="text" id="username" style="width:125px; ">
				  <?
			
					if(isLogin())
					{
						echo "欢迎 <font class='font1_b'>".$_SESSION['SessionUser']['username']."</font> 进入 <font class='font1_b'>".$bbs_config_Name."</font>";
					}
			
			?>
				  </td>
                </tr>
				<tr>
					<td height="30" class="lefttd" style="padding-left:10px; "> 您的密码</td>
                    <td class="righttd" style="padding-left:10px; padding-right:10px; "><input name="psw" type="password" id="psw" style="width:125px; "></td>
				</tr>
				<!--<tr>
					<td height="30" class="lefttd" style="padding-left:10px; "> 请输入验证码 </td>
                    <td class="righttd" style="padding-left:10px; ">                      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td width="60"><input name="identify" type="text" id="identify" style="width:45px; "></td>
                          <td><?  $_SESSION['identify'] = mt_rand(1000, 9999);?>
                            <img src="include/antispam/index.php" ></td>
                          <td>&nbsp;</td>
                        </tr>
                      </table></td>
				</tr>-->
				<tr>
                  <td align="center" valign="top" class="righttd" colspan="2"><input name="Submit2" type="button" class="button" value="登陆" onClick="checkLogin()">
                  </td>
                </tr>
               
              </table></td>
            </tr>
          <tr>
               <td align="center">&nbsp;</td>
          </tr>
		   <tr>
               <td align="center"><span class="link2">
                 <? include "bottom.php"?>
               </span></td>
          </tr>
        </table>
	  </td>
    </tr>
</table>
	<input type="hidden" name="loginstatus" >
</form>
</body>
</html>

<? $db->close_db();?>
