无为清净楼资源网 Design By www.qnjia.com
本文实例为大家分享了php用户登录身份验证的具体代码,供大家参考,具体内容如下
一、代码
conn.php
<"adodb.connection"); $connstr="driver={microsoft access driver (*.mdb)}; dbq=". realpath("data/db_database07_188.mdb"); $conn->open($connstr); "htmlcode"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>用户身份验证</title> <link rel="stylesheet" type="text/css" href="css/style.css" rel="external nofollow" > <style type="text/css"> <!-- .STYLE1 {color: #FFFFFF} --> </style> </head> <body> <table width="250" border="0" align="center" cellpadding="1" cellspacing="0"> <tr> <td height="75" bgcolor="#0099CC"><table width="250" height="75" border="0" cellpadding="0" cellspacing="1"> <form name="form1" method="post" action="index.php"> <tr> <td height="25" colspan="2" bgcolor="#0099CC"><div align="center" class="STYLE1">用户身份验证</div></td> </tr> <tr> <td width="60" height="25" bgcolor="#FFFFFF"><div align="center">用户名:</div></td> <td width="187" bgcolor="#FFFFFF"><div align="left"> <input type="text" name="username" size="22" class="inputcss"></div></td> </tr> <tr> <td height="25" bgcolor="#FFFFFF"><div align="center">密码:</div></td> <td height="25" bgcolor="#FFFFFF"><div align="left"> <input type="password" name="userpwd" size="22" class="inputcss"></div></td> </tr> <tr> <td height="25" colspan="2" bgcolor="#FFFFFF"><div align="center"><input name="submit" type="submit" value="登录" class="buttoncss"></div></td> </tr> </form> </table></td> </tr> </table> <"") { $username=$_POST[username]; //接收提交的用户名 $userpwd=$_POST[userpwd]; //接收提交的密码 if(trim($username)==""||trim($userpwd)=="") { echo "<script>alert('请输入用户名或用户密码!');history.back();</script>"; exit; } class chk //定义密码验证类 { private $name; //定义用户名属性 private $pwd; //定义密码属性 public function __construct($x,$y) //构造函数,对类的属性初始化 { $this->name=$x; $this->pwd=$y; } public function chkuser() //验证用户身份 { include_once("conn.php"); $rs=new com("adodb.recordset"); //创建记录集对象 $rs->open("select * from tb_user where username='".$this->name."' and userpwd='".$this->pwd."'",$conn,3,1); if($rs->eof || $rs->bof) { echo "<script>alert('对不起,密码或用户名错误!');history.back();</script>"; exit; } else { echo "<script>alert('恭喜您登录成功!');history.back();</script>"; exit; } } } $chk1=new chk($username,$userpwd); //对密码验证类进行实例化 $chk1->chkuser(); //调用chkuser()方法验证用户身份 } "text-align: center">以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
更新日志
2024年09月25日
2024年09月25日
- 纯音入心系列纯音乐《天籁古筝》1CD[MP3][331MB]
- 男女对唱典藏天碟《发烧对唱·那个季节里的歌DSD》10CD[WAV]
- 群星2010-歌林精选辑[歌林][WAV+CUE]
- TrioZimbalist-PianoTriosofWeinberg,Auerbach,Dvorak(2024)[24-44,1]wav
- 群星.1992-滚石第一流台湾歌·12王牌大车拼【滚石】【WAV+CUE】
- 林子祥.1984-创作歌集【华纳】【WAV+CUE】
- 周汤豪.2010-周汤豪【华纳】【FLAC分轨】
- Mozart-TheStringQuintets-AmadeusQuartet,CecilAronowitz(2017)[24-44,1][WAV+CUE]
- JamesWilliamsDennisIrwin-Focus(2024,Red)[24-48]FLAC
- 藤泽麻衣《空みあげて》[WAV]
- 纯音入心系列纯音乐《中国古筝经典名曲》1CD[MP3][1.3GB]
- 纯音入心系列纯音乐《古筝新奏:岁月静好与筝语,细水流年与筝同》1CD[MP3][846.9MB]
- 670《脆弱敏感小女生》[320K/MP3][27.53MB]
- 曾琳.2011-好好爱我【南方】【WAV+CUE】
- 范晓萱.1995-RAIN【福茂】【WAV+CUE】