sohotcall

PHP 4 to 7

Feb 6th, 2020
219
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $_GLOBALS['COMPNAME'] = "Perumda Tirta Amertha Buana";
  3. foreach ( $_POST as $k => $v )
  4.     $HTTP_POST_VARS[ $k ] = $v;
  5. foreach ( $_GET as $k => $v )
  6.     $HTTP_GET_VARS[ $k ] = $v;
  7.  
  8. function mysql_affected_rows( $link_identifier = NULL ){
  9.     // Get number of affected rows in previous MySQL operation
  10.     if ( ! $link_identifier )
  11.         $link_identifier = $GLOBALS['GSAMP_BC_MYSQLCON'];
  12.     return mysqli_affected_rows( $link_identifier );
  13. }
  14. function mysql_close( $link_identifier = NULL ){
  15.     // Close MySQL connection
  16.     if ( ! $link_identifier )
  17.         $link_identifier = $GLOBALS['GSAMP_BC_MYSQLCON'];
  18.     return mysqli_close( $link_identifier );
  19. }
  20. function mysql_connect( $server, $username, $password ){
  21.     // Open a connection to a MySQL Server
  22.     $mysqlCon = mysqli_connect( $server, $username, $password );
  23.     $GLOBALS['GSAMP_BC_MYSQLCON'] = $mysqlCon;
  24.     return $mysqlCon;
  25. }
  26. function mysql_error( $link_identifier ){
  27.     // Returns the text of the error message from previous MySQL operation
  28.     if ( ! $link_identifier )
  29.         $link_identifier = $GLOBALS['GSAMP_BC_MYSQLCON'];
  30.     return mysqli_error( $link_identifier );
  31. }
  32. const MYSQL_ASSOC = MYSQLI_ASSOC;
  33. const MYSQL_NUM = MYSQLI_NUM;
  34. const MYSQL_BOTH = MYSQLI_BOTH;
  35. function mysql_fetch_array( $result, $result_type = MYSQL_BOTH ){
  36.     // Fetch a result row as an associative array, a numeric array, or both
  37.     return mysqli_fetch_array( $result, $result_type );
  38. }
  39. function mysql_fetch_assoc( $result ){
  40.     // Fetch a result row as an associative array
  41.     return mysqli_fetch_assoc( $result );
  42. }
  43. function mysql_fetch_object( $result, $class_name = "stdClass", $params = array() ){
  44.     // Fetch a result row as an object
  45.     return mysqli_fetch_object( $result, $class_name, $params );
  46. }
  47. function mysql_fetch_row( $result ){
  48.     // Get a result row as an enumerated array
  49.     return mysqli_fetch_row( $result );
  50. }
  51. function mysql_free_result( $result ){
  52.     // Free result memory
  53.     mysqli_free_result( $result );
  54.     return TRUE;
  55. }
  56. function mysql_insert_id( $link_identifier = NULL ){
  57.     // Get the ID generated in the last query
  58.     if ( ! $link_identifier )
  59.         $link_identifier = $GLOBALS['GSAMP_BC_MYSQLCON'];
  60.     return mysqli_insert_id( $link_identifier );
  61. }
  62. function mysql_num_rows( $result ){
  63.     // Get number of rows in result
  64.     return mysqli_num_rows( $result );
  65. }
  66. function mysql_query( $query, $link_identifier = NULL ){
  67.     // Send a MySQL query
  68.     if ( ! $link_identifier )
  69.         $link_identifier = $GLOBALS['GSAMP_BC_MYSQLCON'];
  70.     return mysqli_query( $link_identifier, $query );
  71. }
  72. function mysql_real_escape_string( $unescaped_string, $link_identifier =NULL ){
  73.     // Escapes special characters in a string for use in an SQL statement
  74.     if ( ! $link_identifier )
  75.         $link_identifier = $GLOBALS['GSAMP_BC_MYSQLCON'];
  76.     return mysqli_real_escape_string( $link_identifier, $unescaped_string );
  77. }
  78. function mysql_result( $result, $row, $field = 0 ){
  79.     // Get result data
  80.     // Format "table.field" is not supported
  81.     try {
  82.         mysqli_data_seek( $result, $row );
  83.         if ( is_numeric( $field ) ){
  84.             $row = mysqli_fetch_row( $result );
  85.         } else {
  86.             $row = mysqli_fetch_assoc( $result );
  87.         }
  88.         return $row[ $field ];
  89.     } catch (Exception $e) {
  90.         return False;
  91.     }
  92. }
  93. function mysql_select_db( $database_name, $link_identifier = NULL ){
  94.     // Select a MySQL database
  95.     if ( ! $link_identifier )
  96.         $link_identifier = $GLOBALS['GSAMP_BC_MYSQLCON'];
  97.     return mysqli_select_db( $link_identifier, $database_name );
  98. }
  99. function split( $pattern, $string, $limit=-1 ){
  100.     return preg_split( "/" . str_replace( "/", "\\/", $pattern ) . "/", $string, $limit );
  101. }
RAW Paste Data