Example #1
0
 public function connect($host = null, $port = null, $user = null, $pass = null)
 {
     $this->error = '';
     $this->try = true;
     if (!empty($user) && isset($pass)) {
         $this->CFG['my_host'] = $host;
         $this->CFG['my_port'] = $port;
         $this->CFG['my_user'] = $user;
         $this->CFG['my_pass'] = $pass;
     }
     if ($GLOBALS['mysqlilink'] = mysqli_connect($this->CFG['my_host'] . ($this->CFG['my_host'][0] != ':' ? ":{$this->CFG['my_port']}" : ''), $this->CFG['my_user'], $this->CFG['my_pass'])) {
         if (V_PHP > 50202) {
             mysqli_set_charset($GLOBALS['mysqlilink'], 'utf8') or sxd_my_error();
         } else {
             mysqli_query($GLOBALS['mysqlilink'], 'SET NAMES utf8') or sxd_my_error();
         }
         define('V_MYSQL', sxd_ver2int(mysqli_get_server_info($GLOBALS['mysqlilink'])));
     } else {
         define('V_MYSQL', 0);
         $this->error = 'sxd.actions.tab_connects();alert(' . sxd_esc(mysqli_error()) . ');';
     }
     $this->try = false;
     return V_MYSQL ? true : false;
 }
Example #2
0
 function connect($host = null, $port = null, $user = null, $pass = null)
 {
     $this->error = '';
     $this->try = true;
     if (!empty($user) && isset($pass)) {
         $this->CFG['my_host'] = $host;
         $this->CFG['my_port'] = $port;
         $this->CFG['my_user'] = $user;
         $this->CFG['my_pass'] = $pass;
     }
     if (mysql_connect($this->CFG['my_host'] . ($this->CFG['my_host'][0] != ':' ? ":{$this->CFG['my_port']}" : ''), $this->CFG['my_user'], $this->CFG['my_pass'])) {
         mysql_query('SET NAMES utf8') or sxd_my_error();
         define('V_MYSQL', sxd_ver2int(mysql_get_server_info()));
     } else {
         define('V_MYSQL', 0);
         $this->error = "sxd.actions.tab_connects();alert('{" . mysql_escape_string(mysql_error()) . "');";
     }
     $this->try = false;
     return V_MYSQL ? true : false;
 }
Example #3
0
 function connect($host = null, $port = null, $user = null, $pass = null)
 {
     $this->error = "";
     $this->try = true;
     if (!empty($user) && isset($pass)) {
         $this->CFG["my_host"] = $host;
         $this->CFG["my_port"] = $port;
         $this->CFG["my_user"] = $user;
         $this->CFG["my_pass"] = $pass;
     }
     if (mysql_connect($this->CFG["my_host"] . ($this->CFG["my_host"][0] != ":" ? ":{$this->CFG['my_port']}" : ""), $this->CFG["my_user"], $this->CFG["my_pass"])) {
         if (V_PHP > 50202) {
             mysql_set_charset("utf8") or sxd_my_error();
         } else {
             mysql_query("SET NAMES utf8") or sxd_my_error();
         }
         define("V_MYSQL", sxd_ver2int(mysql_get_server_info()));
     } else {
         define("V_MYSQL", 0);
         $this->error = "sxd.actions.tab_connects();alert(" . sxd_esc(mysql_error()) . ");";
     }
     $this->try = false;
     return V_MYSQL ? true : false;
 }