MySQL の窓 ( ソース : euc-jp, クライアント : euc-jp, DB : shift_jis )


  mwin.php



  
<?
$debug = FALSE;

mb_language( "ja" );
mb_internal_encoding("EUC-JP");

$euc = "EUC-JP";
$sjis = "SJIS";
$utf8 = "UTF-8";

$jclient = $euc;		// クライアントのキャラクタセット
$jdb = $sjis;		// データベースのキャラクタセット
$host = "localhost";	// データベースのあるサーバー
$db = "lightbox";		// データベース名
$user = "root";		// ユーザー名
$pass = "";		// パスワード

if ( $jclient == $euc ) {
	header( "Content-Type: text/html; Charset=euc-jp" );
}
if ( $jclient == $sjis ) {
	header( "Content-Type: text/html; Charset=shift_jis" );
}
if ( $jclient == $utf8 ) {
	header( "Content-Type: text/html; Charset=utf-8" );
}
header( "Expires: Wed, 31 May 2000 14:59:58 GMT" );

foreach( $_GET as $Key => $Value ) {
	if ( $jclient == $sjis ) {
		$_GET[$Key] = str_replace("\\\\", "\\", $Value );
	}
	$_GET[$Key] = str_replace("\\'", "'", $_GET[$Key] );
	$_GET[$Key] = str_replace("\\\"", "\"", $_GET[$Key] );
}

if ( $debug ) {
	print "<PRE>\n";
	print_r( $_GET );
	print "</PRE>\n";
}

function mystr( $eucstr ) {

	global $jclient,$euc;

	if ( $jclient != $euc ) {
		return mb_convert_encoding( $eucstr, $jclient, $euc );
	}
	else {
		return $eucstr;
	}

}
function dbstr( $str ) {

	global $jclient,$jdb;

	if ( $jclient != $jdb ) {
		return mb_convert_encoding( $str, $jclient, $jdb );
	}
	else {
		return $str;
	}

}
function todbstr( $str ) {

	global $jclient,$jdb;

	if ( $jclient != $jdb ) {
		return mb_convert_encoding( $str, $jdb, $jclient );
	}
	else {
		return $str;
	}

}
?>
  










  infoboard   管理者用   
このエントリーをはてなブックマークに追加





フリーフォントWEBサービス
SQLの窓WEBサービス

SQLの窓フリーソフト

素材

一般WEBツールリンク

SQLの窓

フリーソフト

JSライブラリ