This article mainly introduces PHP database query and password matching function, interested in the friend's reference, I hope to help you.
This paper introduces a simple test landing class for PHP implementation, as follows:
<?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 (' Login successful! ); window.location.href= ' index.php ';</script> "; } else { echo "<script language= ' JavaScript ' >alert (' Login failed! '); History.back ();</script> "; Exit;}}} ? >
Summary: The above is the entire content of this article, I hope to be able to help you learn.
Related recommendations:
PHP Digital and digital Operation verification Code
How to implement JSON code conversion in PHP
Implementation of multi-dimensional array traversal and unset deletion method in PHP