Home > Backend Development > PHP Tutorial > Simple check login class implemented in php, check implemented in php_PHP tutorial

Simple check login class implemented in php, check implemented in php_PHP tutorial

WBOY
Release: 2016-07-13 09:49:44
Original
827 people have browsed it

Simple check login class implemented in php, check implemented in php

The example in this article describes the simple check login class implemented in php. Share it with everyone for your reference. The details are as follows:

<&#63;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;
   }
  }
}
&#63;>

Copy after login

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1019059.htmlTechArticleA simple test login class implemented by php, a simple test login class implemented by php. This article describes the simple test login class implemented by php. Share it with everyone for your reference. The details are as follows: phpclass checklogin{ v...
Related labels:
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