|
<?
header( "Content-Type: text/javascript; Charset=euc-jp" );
header( "Expires: Wed, 31 May 2000 14:59:58 GMT" );
# **************************************
# 埋め込みを許可したページ以外はエラー
# **************************************
$trust = false;
$file = file( "trust.lst" ); // 許可対象 URL の先頭文字列リスト
for( $i = 0; $i < count( $file ); $i++ ) {
# 改行削除
$target = rtrim( $file[$i] );
# 空行は無視
if ( $target == "" ) {
continue;
}
# コメント文字
if ( substr( $target, 0, 1 ) == ";" ) {
continue;
}
$len = strlen( $target );
$ref = substr( $_SERVER['HTTP_REFERER'], 0, $len );
if ( $target == $ref ) {
$trust = true;
break;
}
}
# **************************************
# 使用不可
# **************************************
if ( !$trust ) {
?>
document.write( "<?= $_SERVER['HTTP_REFERER'] ?> からは利用できません" );
<?
exit();
}
$domin = $_GET['domain'];
$title = $_GET['title'];
if ( $domin == '' ) {
$domin = 'winofsql.jp';
}
if ( $title == '' ) {
$title = 'SQLの窓';
$test = 'サイト内検索';
}
?>
var cset;
if (window.navigator.userAgent.toLowerCase().indexOf("msie") > -1) {
cset = document.charset;
}
else if (window.navigator.userAgent.toLowerCase().indexOf("firefox") > -1) {
cset = document.characterSet;
}
else if (window.navigator.userAgent.toLowerCase().indexOf("opera") > -1) {
cset = document.charset;
}
else if (window.navigator.userAgent.toLowerCase().indexOf("netscape") > -1) {
cset = document.characterSet;
}
str='';
str+="<form target=\"_blank\" method=get action=\"http://www.google.co.jp/search\"> ";
str+="\n<table bgcolor=\"#FFFFFF\"><tr valign=top><td> ";
str+="\n<a href=\"http://www.google.co.jp/\"> ";
str+="\n<img src=\"http://www.google.com/logos/Logo_40wht.gif\" ";
str+=" \nborder=\"0\" alt=\"Google\" align=\"absmiddle\"></a> ";
str+="\n</td> \n<td> \n<input type=text ";
str+="name=q size=31 maxlength=255 value=\"<?= $test ?>\"> \n<input ";
str+="type=hidden name=ie value=" + cset + "> \n<input ";
str+="type=hidden name=oe value=" + cset + "> \n<input ";
str+="type=hidden name=hl value=\"ja\"> \n<input ";
str+="type=submit name=btnG value=\"Google 検索\"> ";
str+="\n<font size=-1> \n<input type=hidden ";
str+="name=domains value=\"<?= $domin ?>\"><br> ";
str+="\n<input type=radio name=sitesearch value=\"\"> ";
str+="WWW を検索 \n<input type=radio name=sitesearch ";
str+="value=\"<?= $domin ?>\" checked><?= $title ?> ";
str+="を検索 \n</font> \n</td></tr></table> ";
str+="\n</form> \n ";
document.write( str );
| |