Advertisement
Guest User

Untitled

a guest
Sep 6th, 2012
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by deZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 1.1.5.0
  8. * @ Author : DeZender
  9. * @ Release on : 09.06.2012
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. class db_mysql {
  15. var $link = null;
  16. var $recent_link = null;
  17. var $sql = '';
  18. var $query_count = 0;
  19. var $error = '';
  20. var $errorPath = '';
  21. var $errorStr = '';
  22. var $errorQuery = array( );
  23. var $show_errors = false;
  24. var $debug = 1;
  25.  
  26. function db_mysql() {
  27. global $config_db_server;
  28. global $config_db_server_username;
  29. global $config_db_server_password;
  30. global $config_db_database;
  31.  
  32. $password = str_replace( ( '' . '$' ), '$', $config_db_server_password );
  33. $this->link = @mysql_connect( $config_db_server, $config_db_server_username, $password );
  34. $this->errorQuery = array( );
  35. $this->error = '';
  36. $this->limit = '';
  37. $this->offset = '';
  38. $this->errorPath = '';
  39.  
  40. if ($this->link) {
  41. if (@mysql_select_db( $config_db_database, $this->link )) {
  42. $this->recent_link = &$this->link;
  43. global $config_db_charset;
  44. global $config_db_collation;
  45. global $mysql_locale;
  46. global $mysql_names;
  47.  
  48. if ($mysql_locale != '') {
  49. mysql_query( 'SET lc_time_names = \'' . $mysql_locale . '\'' );
  50. }
  51.  
  52.  
  53. if ($mysql_names != '') {
  54. mysql_query( '' . 'SET NAMES ' . $mysql_names );
  55. }
  56.  
  57. return $this->link;
  58. }
  59.  
  60. $this->errorPath = $this->getErrorPath( );
  61. $this->error = '' . 'Could not select database: ' . $config_db_database;
  62. return null;
  63. }
  64.  
  65. $this->error = '' . 'Could not connect to server: ' . $config_db_server;
  66. $this->errorPath = $this->getErrorPath( );
  67. }
  68.  
  69. function test() {
  70. return 1;
  71. }
  72.  
  73. function geterror() {
  74. global $config_debug;
  75.  
  76. $str = '<span>Database query error. </span>';
  77.  
  78. if ($config_debug) {
  79. $str .= '<span>The error was: </span>' . $this->error;
  80. $str .= '<br><span>SQL query/queries : </span>' . $this->printErrorQuery( ) . '<span>Error path:</span> ' . $this->errorPath;
  81. }
  82.  
  83. return $str;
  84. }
  85.  
  86. function printerrorquery() {
  87. $result = '';
  88. foreach ($this->errorQuery as $str) {
  89. $result .= $str . '<br>';
  90. }
  91.  
  92. return $result;
  93. }
  94.  
  95. function setsql($sql) {
  96. $this->sql = $sql;
  97. }
  98.  
  99. function getsql() {
  100. return $this->sql;
  101. }
  102.  
  103. function query($sql = '') {
  104. if ($sql) {
  105. $this->sql = $sql;
  106. }
  107.  
  108.  
  109. if (!is_resource( $this->link )) {
  110. return false;
  111. }
  112.  
  113. $this->recent_link = &$this->link;
  114.  
  115. if (( 0 < $this->limit || 0 < $this->offset )) {
  116. $this->sql .= ' LIMIT ' . $this->offset . ', ' . $this->limit;
  117. }
  118.  
  119. $result = @mysql_query( $this->sql, $this->link );
  120. ++$this->query_count;
  121.  
  122. if (!$result) {
  123. $this->error( );
  124. $this->errorPath = $this->getErrorPath( );
  125. return false;
  126. }
  127.  
  128. return $result;
  129. }
  130. .............................................................
  131. .............................
  132. ...........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement