<commit_before><?php
/**
 * 
 * @author stush.cn
 *
 */
class login extends Action {
	/**
	 * 显示登录页面
	 * login.class.php没有继承common.class.php
	 * 需要单独创建function index
	 */
	public function index() {
		debug(0); //取消调试信息
		$this->display();
	}
	
	/**
	 * 验证用户登录信息
	 */
	public function dologin() {
		//接受登录表单传递的参数
		$uname = trim($_POST['username']);
		$passwd = <PASSWORD>(trim($_POST['password']));
		$captcha = strtoupper(trim($_POST['captcha']));

		//判断验证码输入是否正确
 		if ($captcha != $_SESSION['code']) {
 			$this->error('验证码输入错误，请重新输入！',3,'login/index');	//验证码不正确
 		}
 		
		//初始化用户模型
		$user = D('users');
		$result = $user->field('uid')->where(array('uname'=>$uname,'passwd'=>$passwd))->find();
		if (!empty($result)) {
			//设置用户session
			$_SESSION['uname']=$uname;
			$_SESSION['admin_login_flag']=true; //表示后台登录成功了
			
			//进行页面跳转
			$this->redirect('index/index');
		}
		
	}
	
}

//EDN OF login.class.php<commit_msg>更新文件头注释<commit_after><?php
/**
* PHPdoc...
* @File login.class.php
* @Encode UTF-8
* @Author <EMAIL>
* @Date 2013-11-11
*/
class login extends Action {
	/**
	 * 显示登录页面
	 * login.class.php没有继承common.class.php
	 * 需要单独创建function index
	 */
	public function index() {
		debug(0); //取消调试信息
		$this->display();
	}
	
	/**
	 * 验证用户登录信息
	 */
	public function dologin() {
		//接受登录表单传递的参数
		$uname = trim($_POST['username']);
		$passwd = <PASSWORD>(trim($_POST['password']));
		$captcha = strtoupper(trim($_POST['captcha']));

		//判断验证码输入是否正确
 		if ($captcha != $_SESSION['code']) {
 			$this->error('验证码输入错误，请重新输入！',3,'login/index');	//验证码不正确
 		}
 		
		//初始化用户模型
		$user = D('users');
		$result = $user->field('uid')->where(array('uname'=>$uname,'passwd'=>$passwd))->find();
		if (!empty($result)) {
			//设置用户session
			$_SESSION['uname']=$uname;
			$_SESSION['admin_login_flag']=true; //表示后台登录成功了
			
			//进行页面跳转
			$this->redirect('index/index');
		}
		
	}
	
}



//EDN OF login.class.php
{'fraction_non_alphanumeric': 0.22233875196643943, 'fraction_numerical': 0.0068169900367068695, 'mean_word_length': 3.4788732394366195, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '641817', 'n_tokens_mistral': 949, 'n_tokens_neox': 933, 'n_words': 106}