Exemplo n.º 1
0
/**
 * This function provides connection to remote mysql server
 *
 * @param String $user - mysql username
 * @param String $password - password for the user
 * @param String $host - mysql server's hostname or IP
 * @param int $port - mysql remote port
 * @param String $socket - path to unix socket
 * 
 * @return mixed $link mysql link on success
 */
function PMA_replication_connect_to_master($user, $password, $host = null, $port = null, $socket = null)
{
    $server = array();
    $server["host"] = $host;
    $server["port"] = $port;
    $server["socket"] = $socket;
    // 5th parameter set to true means that it's an auxiliary connection
    // and we must not go back to login page if it fails
    return PMA_DBI_connect($user, $password, false, $server, true);
}
Exemplo n.º 2
0
     }
 }
 // end if
 $bkp_track_err = @ini_set('track_errors', 1);
 // Try to connect MySQL with the control user profile (will be used to
 // get the privileges list for the current user but the true user link
 // must be open after this one so it would be default one for all the
 // scripts)
 if ($cfg['Server']['controluser'] != '') {
     $dbh = PMA_DBI_connect($cfg['Server']['controluser'], $cfg['Server']['controlpass']);
 }
 // end if ... else
 // Pass #1 of DB-Config to read in master level DB-Config will go here
 // Robbat2 - May 11, 2002
 // Connects to the server (validates user's login)
 $userlink = PMA_DBI_connect($cfg['Server']['user'], $cfg['Server']['password']);
 if (empty($dbh)) {
     $dbh = $userlink;
 }
 // Pass #2 of DB-Config to read in user level DB-Config will go here
 // Robbat2 - May 11, 2002
 @ini_set('track_errors', $bkp_track_err);
 unset($bkp_track_err);
 /**
  * SQL Parser code
  */
 require_once './libraries/sqlparser.lib.php';
 /**
  * SQL Validator interface code
  */
 require_once './libraries/sqlvalidator.lib.php';
     echo '</tr>';
 }
 echo '</table> </div>';
 /**
  * connecting the source and target servers
  */
 if ('rmt' == $_SESSION['src_type']) {
     $src_link = PMA_DBI_connect($src_username, $src_password, $is_controluser = false, $_SESSION['src_server']);
 } else {
     $src_link = $GLOBALS['userlink'];
     // working on current server, so initialize this for tracking
     // (does not work if user defined current server as a remote one)
     $GLOBALS['db'] = $_SESSION['src_db'];
 }
 if ('rmt' == $_SESSION['trg_type']) {
     $trg_link = PMA_DBI_connect($trg_username, $trg_password, $is_controluser = false, $_SESSION['trg_server']);
 } else {
     $trg_link = $GLOBALS['userlink'];
     // working on current server, so initialize this for tracking
     $GLOBALS['db'] = $_SESSION['trg_db'];
 }
 /**
  * Displaying the queries.
  */
 echo '<h5>' . $GLOBALS['strQueriesExecuted'] . '</h5>';
 echo '<div id="serverstatus" style = "overflow: auto; width: 1050px; height: 180px; 
      border-left: 1px gray solid; border-bottom: 1px gray solid; padding: 0px; margin: 0px"> ';
 /**
  * Applying all sorts of differences for each matching table       
  */
 for ($p = 0; $p < sizeof($matching_tables); $p++) {