yiibaicom 2013-04-26 07:41:26 3912次浏览 0条回复 1 0 0

view表单

<div id="login-modal-form" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
			×
		</button>
		<h3 style="font-size:16px;" id="sd">用户登陆</h3>
	</div>
	<div class="modal-body">
		<form class="bs-docs-example form-horizontal" id="login-form">
            <div class="control-group">
              <label class="control-label" for="inputEmail">用户名:</label>
              <div class="controls">
                <input type="text" id="login-username" name="username" placeholder="email">
                <span id="username-tips" style="color:#F62929;font-size: 12px;"></span>
              </div>
            </div>
            <div class="control-group">
              <label class="control-label" for="inputPassword">密&nbsp;&nbsp;码:</label>
              <div class="controls">
                <input type="password" id="login-password" name="password" placeholder="password">
                <span id="password-tips" style="color:#F62929;font-size: 12px;"></span>
              </div>
            </div>
            <div class="control-group">
              <div class="controls">
                <label class="checkbox">
                  <input type="checkbox" name="remeberme" id="login-remeber-me" value="1"> 记住我
                </label>
                <button type="submit" class="btn" id="submit-login-form">登陆</button>
                <a href="<!--{$base_url}-->/index.php?r=register" style="margin-left: 12px;text-decoration: underline;">注册</a>
              </div>
            </div>
          </form>
	</div>
</div>

controller

$attr = array();
$attr['username'] = $username;
$user = User::model() -> findByAttributes($attr);
    if ($user == null) {
	$msg = '用户名或密码错误!';
    } else {
}
    没有找到数据。
您需要登录后才可以回复。登录 | 立即注册