<?php
session_start();
if($_SESSION['apptype']=='qq'||$_SESSION['apptype']=='sina'){
	$appheaderimg='<img src="'.$_SESSION['headerimg'].'" alt="'.$_SESSION['nickname'].'" />';
}
$nickname=$_SESSION['nickname'];
$nickname=iconv('utf-8','gb2312',$nickname);
$apptype=$_SESSION['apptype'];
$openid=$_SESSION['openid'];
$tobind=$_GET[tobind];
require "../e/class/connect.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><?=$public_r[sitename]?> - 用户登录</title>
<link href="temp/css/base.css" type="text/css" rel="stylesheet" />
<script src="temp/css/jq171.js" type="text/javascript"></script>
<script src="temp/css/jqbase.js" type="text/javascript"></script>
<link href="temp/css/box.css" type="text/css" rel="stylesheet" />
<script src="temp/css/formValidator-4.0.1.js" type="text/javascript"></script>
<script src="temp/css/formValidatorRegex.js" type="text/javascript"></script>
<script language="javascript" src="temp/css/DateTimeMask.js" type="text/javascript"></script>
</head>
<body>
<div class="layout" id="sign-header">
  <div id="sign-logo"><a href="<?=$public_r[newsurl]?>"><img src="images/logo.png" alt="" /></a></div>
</div>
<!-- // sign-header end -->
<div class="layout" id="sign-content">
  <div class="ui-box ui-qire sign-focus" id="login-box">
    <div class="ui-title fn-clear"><span>还没有<?=$public_r[sitename]?>会员帐号？请<a href="register.php<?=$tobind?'?tobind=1':''?>">注册<?=$public_r[sitename]?>会员</a></span>
      <h2><?=$public_r[sitename]?>会员登录</h2>
    </div>
    <div class="ui-cnt fn-clear">
      <form id="loginform_web" action="/e/member/doaction.php" method="post" onsubmit="return false;">
        <input type="hidden" name="enews" value="login" />
        <input type="hidden" name="tobind" value="<?=$tobind?>"/>
        <input type="hidden" name="apptype" value="<?=$apptype?>"/>
        <input type="hidden" name="openid" value="<?=$openid?>"/>
        <div class="ui-form" id="sign-primary">
<?php
if($tobind){
?>
          <div class="sign-app-login">
            <div class="sign-app-block fn-clear"><a href="#"><?=$appheaderimg?></a>
              <p><span>亲爱的 <strong><?=$nickname?></strong></span><br />
                欢迎使用<em><?=$apptype?></em>登录<?=$public_r[sitename]?>。</p>
            </div>
            <ul class="sign-app-tips">
              <li>如果你已是<?=$public_r[sitename]?>的用户，请输入<?=$public_r[sitename]?>用户名和密码进行绑定；</li>
              <li>如果你尚未注册，请<a href="register.php<?=$tobind?'?tobind=1':''?>">立即注册</a>。</li>
            </ul> 
                       
          </div>
<?php
}
?>       
          
          <div class="ui-form-item fn-clear">
            <label for="username" class="ui-label w100">您的帐号：</label>
            <input type="text" id="username" name="username" class="ui-input w220" value="" />
            <p class="ui-message" id="usernameTip">请输入用户名</p>
          </div>
          <div class="ui-form-item fn-clear">
            <label for="password" class="ui-label w100">密码：</label>
            <input type="password" id="password" name="password" maxlength="20" class="ui-input w220" value="" />
            <p class="ui-message" id="passwordTip">6-16个字符</p>
          </div>
          <div class="ui-form-item ui-form-checkbox fn-clear">
            <label class="ui-label w100">&nbsp;</label>
            <div class="ui-form-block w220">
              <a href="getpass.php">忘记密码了？</a></div>
          </div>
          <div class="ui-form-item fn-clear">
            <label class="ui-label w100">&nbsp;</label>
            <input type="submit" id="loginbt" class="ui-button w220" value="登录<?=$public_r[sitename]?>" />
          </div>
        </div>
        <!-- // ui-form#sign-primary end -->
      </form>
      <div id="sign-app">
        <div class="sign-app-list">
          <h5>你还可以用以下方式直接登录：</h5>
          <a href="/e/memberconnect/?apptype=qq"><img src="images/qq_login.gif" alt="" /></a><a href="/e/memberconnect/?apptype=sina"><img src="images/sina_login.gif" alt="" /></a></div>
      </div>
      <!-- // sign-app end -->
    </div>
  </div>
  <!-- // sign-box#regbox end -->
  <script type="text/javascript">
		$.formValidator.initConfig({
			formID:"loginform_web",
			debug:false,
			submitOnce:false,
			onSuccess:function(){
				//alert('dddddddddddddd');
				$("#loginform_web").qiresub({
					curobj:$("#loginform_web #loginbt"),
					txt:'数据提交中,请稍后...',
					onsucc:function(result){
						$.hidediv(result);
					}
				}).post({url:'class/ajax.php?action=checkloginpost'});
				return false;
			},
			onError:function(msg,obj,errorlist){
				$("#errorlist").empty();
				$.map(errorlist,function(msg){
					$("#errorlist").append("<li>" + msg + "</li>")
				});
				//alert(msg);
			},
			submitAfterAjaxPrompt : '有数据正在异步验证，请稍等...'
		});
		$("#loginform_web #username").formValidator({
			onShow:"请输入正确的用户名",
			onFocus:"至少4个字符",
			onCorrect:"填写正确"
		})
		.inputValidator({
			min:4,
			onError:"你输入的用户名非法,请确认"
		});
		$("#loginform_web #password").formValidator({
			onShow:"请输入密码",
			onFocus:"至少6个长度",
			onCorrect:"密码合法"
		})
		.inputValidator({
			min:6,
			empty:{
				leftEmpty:false,
				rightEmpty:false,
				emptyError:"密码两边不能有空符号"
			},
			onError:"密码不能为空,请确认"
		});
	</script>
</div>
<!-- // sign-content end -->
<? include "temp/footer.php";?>
