php object-oriented user login authentication

陈政宽~
Release: 2023-03-11 20:18:01
Original
1509 people have browsed it

This article mainly introduces php object-orientedUser loginidentity verification in detail. It has certain reference value. Interested friends can refer to it

The example in this article shares the specific code for PHP user login authentication for your reference. The specific content is as follows

1. Code

conn.php

open($connstr); 
?>
Copy after login

index.php

 
 
 
 
用户身份验证 
 
 

用户身份验证

用户名:

密码:

alert('请输入用户名或用户密码!');history.back();"; 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 ""; exit; } else { echo ""; exit; } } } $chk1=new chk($username,$userpwd); //对密码验证类进行实例化 $chk1->chkuser(); //调用chkuser()方法验证用户身份 } ?>
Copy after login

2. Running results

The above is all of this article The content, I hope it will be helpful to everyone's learning, and I also hope that everyone will support Script Home.

The above is the detailed content of php object-oriented user login authentication. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!