Advertisement
Guest User

Untitled

a guest
Apr 21st, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.66 KB | None | 0 0
  1. <?php
  2. function da_sql_limit($limit,$point,$config)
  3. {
  4. switch($point){
  5. case 0:
  6. return '';
  7. case 1:
  8. return '';
  9. //modif by MG for Alcasar
  10. case 2:
  11. return "LIMIT $limit";
  12. case 3:
  13. return "LIMIT $limit";
  14. }
  15. }
  16.  
  17. function da_sql_host_connect($server,$config)
  18. {
  19. if ($config[sql_use_http_credentials] == 'yes'){
  20. global $HTTP_SERVER_VARS;
  21. $SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"];
  22. $SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"];
  23. }
  24. else{
  25. $SQL_user = $config[sql_username];
  26. $SQL_passwd = $config[sql_password];
  27. }
  28.  
  29. if ($config[sql_connect_timeout] != 0)
  30. @ini_set('mysql.connect_timeout',$config[sql_connect_timeout]);
  31. if ($config[sql_debug] == 'true')
  32. print "<b>DEBUG(SQL,MYSQL DRIVER): Connect: User=$SQL_user,Password=$SQL_passwd </b><br>\n";
  33. return @mysql_connect("$server:$config[sql_port]",$SQL_user,$SQL_passwd);
  34. }
  35.  
  36. function da_sql_connect($config)
  37. {
  38. if ($config[sql_use_http_credentials] == 'yes'){
  39. global $HTTP_SERVER_VARS;
  40. $SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"];
  41. $SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"];
  42. }
  43. else{
  44. $SQL_user = $config[sql_username];
  45. $SQL_passwd = $config[sql_password];
  46. }
  47.  
  48. if ($config[sql_connect_timeout] != 0)
  49. @ini_set('mysql.connect_timeout',$config[sql_connect_timeout]);
  50. if ($config[sql_debug] == 'true')
  51. print "<b>DEBUG(SQL,MYSQL DRIVER): Connect: User=$SQL_user,Password=$SQL_passwd </b><br>\n";
  52. return @mysql_connect("$config[sql_server]:$config[sql_port]",$SQL_user,$SQL_passwd);
  53. }
  54.  
  55. function da_sql_pconnect($config)
  56. {
  57. if ($config[sql_use_http_credentials] == 'yes'){
  58. global $HTTP_SERVER_VARS;
  59. $SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"];
  60. $SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"];
  61. }
  62. else{
  63. $SQL_user = $config[sql_username];
  64. $SQL_passwd = $config[sql_password];
  65. }
  66.  
  67. if ($config[sql_connect_timeout] != 0)
  68. @ini_set('mysql.connect_timeout',$config[sql_connect_timeout]);
  69. if ($config[sql_debug] == 'true')
  70. print "<b>DEBUG(SQL,MYSQL DRIVER): Connect: User=$SQL_user,Password=$SQL_passwd </b><br>\n";
  71. return @mysql_pconnect("$config[sql_server]:$config[sql_port]",$SQL_user,$SQL_passwd);
  72. }
  73.  
  74. function da_sql_close($link,$config)
  75. {
  76. return @mysql_close($link);
  77. }
  78.  
  79. function da_sql_escape_string($string)
  80. {
  81. return @mysql_real_escape_string($string);
  82. }
  83.  
  84. function da_sql_query($link,$config,$query)
  85. {
  86. if ($config[sql_debug] == 'true')
  87. print "<b>DEBUG(SQL,MYSQL DRIVER): Query: <i>$query</i></b><br>\n";
  88. return @mysql_db_query($config[sql_database],$query,$link);
  89. }
  90.  
  91. function da_sql_num_rows($result,$config)
  92. {
  93. if ($config[sql_debug] == 'true')
  94. print "<b>DEBUG(SQL,MYSQL DRIVER): Query Result: Num rows:: " . @mysql_num_rows($result) . "</b><br>\n";
  95. return @mysql_num_rows($result);
  96. }
  97.  
  98. function da_sql_fetch_array($result,$config)
  99. {
  100. $row = array_change_key_case(@mysql_fetch_array($result,
  101. MYSQL_ASSOC),CASE_LOWER);
  102. if ($config[sql_debug] == 'true'){
  103. print "<b>DEBUG(SQL,MYSQL DRIVER): Query Result: <pre>";
  104. print_r($row);
  105. print "</b></pre>\n";
  106. }
  107. return $row;
  108. }
  109.  
  110. function da_sql_affected_rows($link,$result,$config)
  111. {
  112. if ($config[sql_debug] == 'true')
  113. print "<b>DEBUG(SQL,MYSQL DRIVER): Query Result: Affected rows:: " . @mysql_affected_rows($result) . "</b><br>\n";
  114. return @mysql_affected_rows($link);
  115. }
  116.  
  117. function da_sql_list_fields($table,$link,$config)
  118. {
  119. return @mysql_list_fields($config[sql_database],$table);
  120. }
  121.  
  122. function da_sql_num_fields($fields,$config)
  123. {
  124. return @mysql_num_fields($fields);
  125. }
  126.  
  127. function da_sql_field_name($fields,$num,$config)
  128. {
  129. return @mysql_field_name($fields,$num);
  130. }
  131.  
  132. function da_sql_error($link,$config)
  133. {
  134. return @mysql_error($link);
  135. }
  136. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement