Yii注册功能实例 [ 技术分享 ]
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">密 码:</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 {
}
共 0 条回复
没有找到数据。
yiibaicom www
注册时间:2012-10-09
最后登录:2013-04-26
在线时长:0小时0分
最后登录:2013-04-26
在线时长:0小时0分
- 粉丝0
- 金钱30
- 威望0
- 积分30