php实现的简单检验登陆类
2015-06-18 00:00
761 查看
本文实例讲述了php实现的简单检验登陆类。分享给大家供大家参考。具体如下:
<?php class 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实现转换ubb代码的方法
- php判断两个日期之间相差多少个月份的方法
- php实现比较两个文件夹异同的方法
- PHP VLD扩展查看opcode
- Yii2-admin RBAC权限管理的实现
- php 什么是常量?
- PHPExcel IE导出乱码问题
- 基于MFC的FTP客户端
- PhpMyAdmin导入数据时提示文件大小超出PHP限制的解决方法
- PHP接收GET和POST请求
- PHP PDO select语句结果行数计算
- Zend framework2 - 在视图助手中设置元素样式,对所有元素,如multiCheckbox或错误信息加上自定义样式
- PHP:PDOStatement::rowCount()方法参数说明
- php的事件处理机制(回调函数)
- 基础学习总结(五)---baseAdapter、ContentProvider
- 中国大概可用NTPserver地址
- PHP PDO 连接数据库方法 记录下
- laravel, Composer和autoloading