// Connect to the mySQL server
function ConnectToMySqlServer() {
global $dbhost, $dbusername, $dbuserpass, $dbname, $mysql_link, $mysql_err, $mysql_charset, $admin_address;
if ( !$mysql_link ) { $mysql_link = @mysql_connect ( $dbhost, $dbusername, $dbuserpass, $dbname ); }
if ( !$mysql_link ) {
$mysql_err = @mysql_errno( $mysql_link ) . ": " . @mysql_error( $mysql_link );
@mail( $admin_err_addr, "[ConnectToMySqlServer] Impossible to connect to server", $mysql_err, $headers, "-f$admin_address" );
return false;
} else {
$version = GetmySQLFullVersion();
//if ( $version[0] >= 5 && $version[1] >= 2 && $version[2] >= 3 ) { @mysql_set_charset( "utf8", $mysql_link ); }
if ( function_exists( "mysql_set_charset" ) ) { @mysql_set_charset( "utf8", $mysql_link ); }
$mysql_charset = @mysql_client_encoding( $mysql_link ); // Success?
return true;
}
}