Advertisement
Guest User

Untitled

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