Advertisement
Guest User

Untitled

a guest
Jun 7th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.88 KB | None | 0 0
  1. <?php
  2.  
  3. class mysql {
  4.     public $local;
  5.     public $table;
  6.     public $user;
  7.     public $pass;
  8.     public $link;
  9.     public $db;
  10.    
  11.     private function mysql($local, $user, $pass, $link, $db) { 
  12.         $this->local = $local;
  13.         $this->user = $user;
  14.         $this->pass = $pass;
  15.         $this->link = $link;
  16.         $this->db = $db;
  17.         $this->link = mysql_connect($this->local, $this->user, $this->pass);
  18.    
  19.         if(!$link) {
  20.             die("error in the connect");
  21.             return false;
  22.         }
  23.         if(mysql_select_db($this->db,$this->link)) {
  24.             mysql_select_db($this->db,$this->link);
  25.         } else {
  26.             mysql_query("CREATE DATABASE ".$this->db, $this->link);
  27.         }
  28.         return true;
  29.     }
  30.     private function create_db($db_name) [
  31.         return mysql_query("CREATE DATABASE ".$db_name, $this->link);
  32.     }
  33.     private function query($query) {
  34.         return mysql_query($query, $this->link) or die(mysql_error());
  35.     }
  36.     private function nums($query) {
  37.         return mysql_num_rows($query);
  38.     }
  39.     private function fetch_assoc($query) {
  40.         return mysql_fetch_assoc($query);
  41.     }
  42.     private function fetch_array($query) {
  43.         return mysql_fetch_array($query);
  44.     }
  45.     private function drop_db($db_name) {
  46.         return mysql_query("DROP DATABASE ".$db_name, $this->link) or die(mysql_error());
  47.     }
  48.     private function close() {
  49.         return mysql_close();
  50.     }
  51. }
  52.  
  53. class template() {
  54.     public $file_src;
  55.     public $read_tpl;
  56.     public $open_tpl;
  57.    
  58.     private function template($tpl_src) {
  59.         $this->file_src = $tpl_src;
  60.         if(file_exists($this->file_src)) {
  61.             $this->open_tpl = fopen($tpl_src, "r+");
  62.             $this->read_tpl = fread($this->open_tpl, filesize($tpl_src));
  63.         } else {
  64.             $this->file_src = null;
  65.             die("the file tpl not exists");
  66.         }
  67.     }
  68.     private function set_text($search, $replace) {
  69.         $this->read_tpl = str_replace("[@".$search."]", $text, $this->read_tpl);
  70.     }
  71.     private function tpl() {
  72.         echo $read_tpl;
  73.     }
  74.     private function close() {
  75.         return fclose($this->open_tpl);
  76.     }
  77. }
  78.  
  79. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement