Advertisement
Guest User

Untitled

a guest
Jun 9th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.45 KB | None | 0 0
  1.  
  2. -> Membre.class.php
  3. <?php
  4. // reste de la class ...
  5.  
  6. require_once('DB.class.php');
  7.  
  8. $this->DB = new DB();
  9.  
  10. $this->DB->query("INSERT INTO membres (id, nom, prenom, pw, rank, rank_name, mail, location, actif, birthday, lastvisit, regts) VALUES ('', '".$r_arr['nom']."', '".$r_arr['prenom']."', '".$r_arr['pw']."', '".$r_arr['rank']."', '".$r_arr['rank_name']."', '".$r_arr['mail']."', '".$r_arr['location']."', '".$r_arr['actif']."', '".$r_arr['birthday']."', '".$r_arr['lastvisit']."', '".$r_arr['regts']."'");
  11. ?>
  12.  
  13. -> DB.class.php
  14. <?
  15.  
  16. public function __construct(){
  17.        
  18.         require_once('config.inc.php');
  19.        
  20.         $this->host = $cfg['db']['host'];
  21.         $this->user = $cfg['db']['user'];
  22.         $this->pass = $cfg['db']['pass'];
  23.         $this->name = $cfg['db']['name'];
  24.        
  25.         unset($cfg);
  26.        
  27.         $this->link = mysql_connect($this->host, $this->user, $this->pass);
  28.        
  29.         if(!$this->link && $this->debug){
  30.             throw new MySQLExeption('<strong>DB::connect :</strong> Une erreur est survenue lors de la connexion &agrave; la base de donn&ecute;es ...<br />');
  31.             return false;
  32.         }
  33.        
  34.         $msd = mysql_select_db($this->name,$this->link);
  35.        
  36.         if (!$msd && $this->debug){
  37.             throw new MySQLExeption('<strong>DB::db_select :</strong> Une erreur est survenue lors de la selection de la base ...<br />');
  38.             return false;
  39.         }
  40.        
  41.         unset($msd);
  42.        
  43.         return true;
  44.     }
  45.  
  46. public function query($req){
  47.         $res = mysql_query($req,$this->link);
  48.         $this->nreq++;
  49.         return $res;
  50.     }
  51. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement