Guest User

Untitled

a guest
Jun 19th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. function __construct($host, $login, $password, $database, $prefix, $charset)
  2. {
  3. if(!$this->db_id = @mysql_connect($host, $login, $password))
  4. {
  5. if($this->db_error)
  6. {
  7. $this->display_error(mysql_error(), mysql_errno());
  8. } else
  9. {
  10. return false;
  11. }
  12. }
  13.  
  14. if(!@mysql_select_db($database, $this->db_id))
  15. {
  16. if($this->db_error)
  17. {
  18. $this->display_error(mysql_error(), mysql_errno());
  19. } else
  20. {
  21. return false;
  22. }
  23. }
  24.  
  25. $this->mysql_version = mysql_get_server_info();
  26. if(!$charset) $charset = "cp1251";
  27.  
  28. if(version_compare($this->mysql_version, '4.1', ">=")) mysql_query("/*!40101 SET NAMES '" . $charset . "' */");
  29.  
  30. $this->connected = true;
  31.  
  32. return true;
  33. }
Add Comment
Please, Sign In to add comment