Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- */
- class conexion
- {
- private $conexion;
- private $server="localhost";
- private $usuario="root";
- private $pass="";
- private $bd="login";
- private $user;
- private $password;
- function __construct(){
- $this->conexion = new MySQli($this->server,$this->usuario,$this->pass,$this->bd);
- if($this->conexion->connect_errno){
- die("Algo a salido mal con MySQli (".$this->conexion->connect_errno.")");
- }
- }
- public function cerrar(){
- $this->conexion->close();
- }
- public function login($usuario,$pass){
- $this->user=$usuario;
- $this->password=$pass;
- $query=("select id,Usuario,Password from login where Usuario= '".$this->user."' and Password= '".$this->password."'");
- $consulta=$this->conexion->query($query);
- if(mysqli_num_rows($consulta)>0){
- if($row=mysqli_fech_array($consulta)){
- echo "Has iniciado sesión correctamente";
- }else{
- echo"Los datos son incorrectos";
- }
- }else{
- echo "eso esta mal";
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement