本文主要介绍了php实现的简单检验登陆类,可实现基本的php数据库查询及密码匹配的功能。希望对大家有所帮助。
具体如下:
<?phpclass checklogin{ var $name; var $pwd; function __construct($username,$password) { $this->name=$username; $this->pwd=$password; } function checkinput() { global $db; $sql="select * from tb_manager where name='$this->name' and pwd='$this->pwd'"; $res=$db->query($sql); $info=$db->fetch_array($res); if($info['name']==$this->name and $info['pwd']==$this->pwd) { $_SESSION[admin_name]=$info[name]; $_SESSION[pwd]=$info[pwd]; echo "<script>alert('登录成功!);window.location.href='index.php';</script>"; } else { echo "<script language='javascript'>alert('登录失败!');history.back();</script>"; exit; } }}?>
相关推荐:
PHP 登录记住密码实现思路_PHP教程
PHP 登录完成后如何跳转上一访问页面_PHP教程
php 登录访问有关问题
以上就是php简单的登陆检验类的详细内容,更多请关注搞代码g
!本文来源gaodai.ma#com搞##代!^码网(
搞gaodaima代码aodaima其它相关文章!