예제 #1
0
 /** Create a connection
  * (Ensure to change the password Database)
  * @throws PDOException Error of creation
  */
 private function __construct()
 {
     try {
         self::$DSN = "mysql:host=" . self::$HOST;
         self::$DSN = "mysql:host=localhost;dbname=marmiton";
         self::$USERNAME = '******';
         self::$USERPASSWORD = '******';
         self::$instance = new PDO(self::$DSN, self::$USERNAME, self::$USERPASSWORD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
     } catch (PDOException $event) {
         throw new LoginException();
     }
 }
예제 #2
0
 /** Create a connection
  * (Ensure to change the password Database)
  * @throws PDOException Error of creation
  */
 private function __construct()
 {
     try {
         self::$DSN = "mysql:host=" . self::$HOST;
         self::$DSN = "mysql:host=localhost";
         self::$USERNAME = $_SESSION['login'];
         self::$USERPASSWORD = $_SESSION['passwd'];
         self::$instance = new PDO(self::$DSN, self::$USERNAME, self::$USERPASSWORD, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
     } catch (PDOException $event) {
         throw new LoginException();
     }
 }