public function editok() { $form = D('user'); $form->field['password'] = key_hash($_POST['password']); $form->where("username='******'username'] . "'")->save(); setcookie('username', ''); $this->error('修改成功!', __APP__ . '/public'); }
public function logincheck() { $user = D('user'); if (!$_POST) { $this->error('请您认真填写!', ''); return; } $userarr = $user->where("username='******'")->order("id desc")->limit('0,10')->select(); $userarr1 = $user->where("username='******'username'] . "'")->find(); if ($_POST['password'] == '' || $_POST['username'] == '' || $_POST['ver'] == '') { $this->error('请您认真填写!', ''); } if ($_COOKIE['ver'] != $_POST['ver']) { $this->error('验证码输入错误!', ''); } if (key_hash($_POST['password']) == $userarr1['password']) { setcookie('username', $_POST['username']); $this->error('登陆成功!', __APP__ . '/index'); } else { $this->error('密码错误!'); } }