Guest User

Untitled

a guest
Jul 3rd, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.95 KB | None | 0 0
  1. <?php
  2.  
  3. class basededados
  4. {
  5.     var $servidor;
  6.     var $username;
  7.     var $password;
  8.     var $bd;
  9.     var $ligacao;
  10.    
  11.     function basededados()
  12.     {
  13.         $this->servidor = "localhost";
  14.         $this->username = "root";
  15.         $this->password = "";
  16.         $this->bd = "lvirtual";
  17.        
  18.     }
  19.      
  20.     function conectar()
  21.     {
  22.         $this->ligacao = mysql_connect($this->servidor,$this->username,$this->password);
  23.         mysql_select_db($this->bd);
  24.     }
  25.    
  26.     function query($query)
  27.     {
  28.         return(mysql_query($query, $this->ligacao));
  29.     }
  30.    
  31.     function fetch($fetch)
  32.     {
  33.         return mysql_fetch_array($request);
  34.     }
  35.    
  36.     function logado()
  37.     {
  38.       session_start();
  39.         if(isset($_SESSION['acesso'])){
  40.             $a = $_SESSION['acesso'];
  41.             if($a == 0){ header("location:index.php");}
  42.         }else{
  43.             header("location:login.php");
  44.         }
  45.     }
  46.  
  47. }
  48.  
  49. ?>
Add Comment
Please, Sign In to add comment