どこから来たのCGI

以前にNeoWORXというのがありましたが、有料なのであきらめました・・・
そんなんが、ないかなと探しておりましたがありました(^o^)
が・・・・サンプルプログラムは簡単なもので後は自分でやりなさいって事です。
スタッフの方にお願いしてサンプルをいただきましたので見て下さい。
環境に合わせて改造して下さい。
また本スクリプト著作権はSurfPointさん所有です。(公開して良いんでしょうか??聞いておこう!)

1、まずはOpenSurfPointでご利用登録して下さい(無料です)
2、メールでユーザID、認証IDが送られてきます。(自動返信ではなさそうですので1時間後位です)
3、取得できるデータは都道府県コード、回線コード、国内海外判定コード、国コードです。
4、cgiスクリプトでデータを取得し、MySQLに書き込み、呼び出し、tmplで吐き出し表示です。
5、まずは環境作りです。
6、Frontier::Client、HTML::TemplateモジュールをPerlにインストール

linux:/home/sunq # perl -MCPAN -e shell

cpan shell -- CPAN exploration and modules installation (v1.7602)
ReadLine support enabled

cpan> install Frontier::Client
CPAN: Storable loaded ok
Going to read /root/.cpan/Metadata
  Database was generated on Sat, 10 Feb 2007 00:09:54 GMT
CPAN: LWP::UserAgent loaded ok
Fetching with LWP:
  ftp://ftp.nara.wide.ad.jp/pub/CPAN/authors/01mailrc.txt.gz
Going to read /root/.cpan/sources/authors/01mailrc.txt.gz
CPAN: Compress::Zlib loaded ok
Fetching with LWP:
  ftp://ftp.nara.wide.ad.jp/pub/CPAN/modules/02packages.details.txt.gz
Going to read /root/.cpan/sources/modules/02packages.details.txt.gz
  Database was generated on Tue, 05 Jun 2007 06:08:36 GMT

There's a new CPAN.pm version (v1.9102) available!
  [Current version is v1.7602]
  You might want to try
    install Bundle::CPAN
    reload cpan
  without quitting the current session. It should be a seamless upgrade
  while we are running...

Fetching with LWP:
  ftp://ftp.nara.wide.ad.jp/pub/CPAN/modules/03modlist.data.gz
Going to read /root/.cpan/sources/modules/03modlist.data.gz
Going to write /root/.cpan/Metadata
Running install for module Frontier::Client
Running make for K/KM/KMACLEOD/Frontier-RPC-0.07b4.tar.gz
Fetching with LWP:
  ftp://ftp.nara.wide.ad.jp/pub/CPAN/authors/id/K/KM/KMACLEOD/Frontier-RPC-0.07b4.tar.gz
CPAN: Digest::MD5 loaded ok
Fetching with LWP:
  ftp://ftp.nara.wide.ad.jp/pub/CPAN/authors/id/K/KM/KMACLEOD/CHECKSUMS
Checksum for /root/.cpan/sources/authors/id/K/KM/KMACLEOD/Frontier-RPC-0.07b4.tar.gz ok
Scanning cache /root/.cpan/build for sizes
Frontier-RPC-0.07b4/
Frontier-RPC-0.07b4/README
Frontier-RPC-0.07b4/MANIFEST
Frontier-RPC-0.07b4/test.pl
Frontier-RPC-0.07b4/docs/
Frontier-RPC-0.07b4/docs/changes.xml
Frontier-RPC-0.07b4/docs/changes.xsl
Frontier-RPC-0.07b4/docs/make-rel
Frontier-RPC-0.07b4/lib/
Frontier-RPC-0.07b4/lib/Frontier/
Frontier-RPC-0.07b4/lib/Frontier/Daemon.pm
Frontier-RPC-0.07b4/lib/Frontier/Client.pm
Frontier-RPC-0.07b4/lib/Frontier/RPC2.pm
Frontier-RPC-0.07b4/lib/Frontier/Responder.pm
Frontier-RPC-0.07b4/lib/Apache/
Frontier-RPC-0.07b4/lib/Apache/XMLRPC.pm
Frontier-RPC-0.07b4/examples/
Frontier-RPC-0.07b4/examples/states-daemon.pl
Frontier-RPC-0.07b4/examples/validator1-daemon.pl
Frontier-RPC-0.07b4/examples/cli-xml-rpc.pl
Frontier-RPC-0.07b4/examples/rpc-client.pl
Frontier-RPC-0.07b4/examples/example-cli-input
Frontier-RPC-0.07b4/examples/states-client.pl
Frontier-RPC-0.07b4/Changes
Frontier-RPC-0.07b4/Makefile.PL
Frontier-RPC-0.07b4/Frontier-RPC.spec
Frontier-RPC-0.07b4/COPYING
Frontier-RPC-0.07b4/ChangeLog
Frontier-RPC-0.07b4/Frontier-RPC-0.07b4.spec

  CPAN.pm: Going to build K/KM/KMACLEOD/Frontier-RPC-0.07b4.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Frontier::RPC
cp lib/Apache/XMLRPC.pm blib/lib/Apache/XMLRPC.pm
cp lib/Frontier/Daemon.pm blib/lib/Frontier/Daemon.pm
cp lib/Frontier/Responder.pm blib/lib/Frontier/Responder.pm
cp lib/Frontier/Client.pm blib/lib/Frontier/Client.pm
cp lib/Frontier/RPC2.pm blib/lib/Frontier/RPC2.pm
Manifying blib/man3/Frontier::Daemon.3pm
Manifying blib/man3/Apache::XMLRPC.3pm
Manifying blib/man3/Frontier::Responder.3pm
Manifying blib/man3/Frontier::Client.3pm
Manifying blib/man3/Frontier::RPC2.3pm
  /usr/bin/make  -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl
1..1
ok 1
  /usr/bin/make test -- OK
Running make install
Manifying blib/man3/Frontier::Daemon.3pm
Manifying blib/man3/Apache::XMLRPC.3pm
Manifying blib/man3/Frontier::Responder.3pm
Manifying blib/man3/Frontier::Client.3pm
Manifying blib/man3/Frontier::RPC2.3pm
Installing /usr/lib/perl5/site_perl/5.8.8/Apache/XMLRPC.pm
Installing /usr/lib/perl5/site_perl/5.8.8/Frontier/Responder.pm
Installing /usr/lib/perl5/site_perl/5.8.8/Frontier/RPC2.pm
Installing /usr/lib/perl5/site_perl/5.8.8/Frontier/Client.pm
Installing /usr/lib/perl5/site_perl/5.8.8/Frontier/Daemon.pm
Installing /usr/share/man/man3/Frontier::RPC2.3pm
Installing /usr/share/man/man3/Frontier::Responder.3pm
Installing /usr/share/man/man3/Frontier::Client.3pm
Installing /usr/share/man/man3/Apache::XMLRPC.3pm
Installing /usr/share/man/man3/Frontier::Daemon.3pm
Writing /usr/lib/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/Frontier/RPC/.packlist
Appending installation info to /usr/lib/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod
  /usr/bin/make install UNINST=1 -- OK

cpan> quit

続いて HTML::Template

linux:/home/sunq # perl -MCPAN -e shell

cpan shell -- CPAN exploration and modules installation (v1.7602)
ReadLine support enabled

cpan> install HTML::Template
CPAN: Storable loaded ok
Going to read /root/.cpan/Metadata
  Database was generated on Tue, 05 Jun 2007 06:08:36 GMT
Running install for module HTML::Template
Running make for S/SA/SAMTREGAR/HTML-Template-2.9.tar.gz
CPAN: LWP::UserAgent loaded ok
Fetching with LWP:
 ftp://ftp.nara.wide.ad.jp/pub/CPAN/authors/id/S/SA/SAMTREGAR/HTML-Template-2.9.tar.gz
CPAN: Digest::MD5 loaded ok
Fetching with LWP:
 ftp://ftp.nara.wide.ad.jp/pub/CPAN/authors/id/S/SA/SAMTREGAR/CHECKSUMS
CPAN: Compress::Zlib loaded ok
Checksum for /root/.cpan/sources/authors/id/S/SA/SAMTREGAR/HTML-Template-2.9.tar.gz ok
Scanning cache /root/.cpan/build for sizes
HTML-Template-2.9/
HTML-Template-2.9/Makefile.PL
HTML-Template-2.9/FAQ
HTML-Template-2.9/META.yml
HTML-Template-2.9/GPL
HTML-Template-2.9/scripts/
HTML-Template-2.9/scripts/clean_shm.pl
HTML-Template-2.9/scripts/time_trial.pl
HTML-Template-2.9/ANNOUNCE
HTML-Template-2.9/Template.pm
HTML-Template-2.9/Changes
HTML-Template-2.9/t/
HTML-Template-2.9/t/06-file-cache-dir.t
HTML-Template-2.9/t/04default_escape.t
HTML-Template-2.9/t/09-caching-precluded.t
HTML-Template-2.9/t/testlib/
HTML-Template-2.9/t/testlib/_Auxiliary.pm
HTML-Template-2.9/t/testlib/IO/
HTML-Template-2.9/t/testlib/IO/Capture/
HTML-Template-2.9/t/testlib/IO/Capture/ErrorMessages.pm
HTML-Template-2.9/t/testlib/IO/Capture/Stderr.pm
HTML-Template-2.9/t/testlib/IO/Capture/Tie_STDx.pm
HTML-Template-2.9/t/testlib/IO/Capture/Stdout.pm
HTML-Template-2.9/t/testlib/IO/Capture.pm
HTML-Template-2.9/t/11-non-file-templates.t
HTML-Template-2.9/t/99-old-test-pl.t
HTML-Template-2.9/t/05nested_global.t
HTML-Template-2.9/t/05-blind-cache.t
HTML-Template-2.9/t/04no_taintmode.t
HTML-Template-2.9/t/01coderefs.t
HTML-Template-2.9/t/04default_with_escape.t
HTML-Template-2.9/t/02random.t
HTML-Template-2.9/t/10-param.t
HTML-Template-2.9/t/03else_else_bug.t
HTML-Template-2.9/t/07-double-file-cache.t
HTML-Template-2.9/t/01-bad-args.t
HTML-Template-2.9/t/05force_untaint.t
HTML-Template-2.9/t/04-type-source.t
HTML-Template-2.9/t/02-parse.t
HTML-Template-2.9/t/08-cache-debug.t
HTML-Template-2.9/t/03-associate.t
HTML-Template-2.9/README
HTML-Template-2.9/templates/
HTML-Template-2.9/templates/unless.tmpl
HTML-Template-2.9/templates/query-test2.tmpl
HTML-Template-2.9/templates/included2.tmpl
HTML-Template-2.9/templates/include.tmpl
HTML-Template-2.9/templates/vanguard1.tmpl
HTML-Template-2.9/templates/multiline_tags.tmpl
HTML-Template-2.9/templates/newline_test1.tmpl
HTML-Template-2.9/templates/medium.tmpl
HTML-Template-2.9/templates/outer.tmpl
HTML-Template-2.9/templates/globals.tmpl
HTML-Template-2.9/templates/ifelse.tmpl
HTML-Template-2.9/templates/searchpath/
HTML-Template-2.9/templates/searchpath/two.tmpl
HTML-Template-2.9/templates/searchpath/three.tmpl
HTML-Template-2.9/templates/searchpath/included.tmpl
HTML-Template-2.9/templates/simple-loop.tmpl
HTML-Template-2.9/templates/recursive.tmpl
HTML-Template-2.9/templates/vanguard2.tmpl
HTML-Template-2.9/templates/simplemod.tmpl
HTML-Template-2.9/templates/loop-context.tmpl
HTML-Template-2.9/templates/escape.tmpl
HTML-Template-2.9/templates/js.tmpl
HTML-Template-2.9/templates/counter.tmpl
HTML-Template-2.9/templates/simple-loop-nonames.tmpl
HTML-Template-2.9/templates/other-loop.tmpl
HTML-Template-2.9/templates/loop-if.tmpl
HTML-Template-2.9/templates/case_loop.tmpl
HTML-Template-2.9/templates/urlescape.tmpl
HTML-Template-2.9/templates/double_loop.tmpl
HTML-Template-2.9/templates/context.tmpl
HTML-Template-2.9/templates/long_loops.tmpl
HTML-Template-2.9/templates/include_path/
HTML-Template-2.9/templates/include_path/one.tmpl
HTML-Template-2.9/templates/include_path/b.tmpl
HTML-Template-2.9/templates/include_path/a.tmpl
HTML-Template-2.9/templates/include_path/inner.tmpl
HTML-Template-2.9/templates/default_escape.tmpl
HTML-Template-2.9/templates/simple.tmpl
HTML-Template-2.9/templates/if.tmpl
HTML-Template-2.9/templates/default.tmpl
HTML-Template-2.9/templates/include_path2/
HTML-Template-2.9/templates/include_path2/inner.tmpl
HTML-Template-2.9/templates/newline_test2.tmpl
HTML-Template-2.9/templates/default_escape_off.tmpl
HTML-Template-2.9/templates/query-test.tmpl
HTML-Template-2.9/templates/included.tmpl
HTML-Template-2.9/templates/global-loops.tmpl
HTML-Template-2.9/MANIFEST
HTML-Template-2.9/ARTISTIC

  CPAN.pm: Going to build S/SA/SAMTREGAR/HTML-Template-2.9.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for HTML::Template
cp Template.pm blib/lib/HTML/Template.pm
Manifying blib/man3/HTML::Template.3pm
  /usr/bin/make  -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/01-bad-args..............ok
t/01coderefs...............ok
t/02-parse.................ok
        2/7 skipped: doesn't do the check yet
t/02random.................ok
t/03-associate.............ok
t/03else_else_bug..........ok
t/04-type-source...........ok
t/04default_escape.........ok
t/04default_with_escape....ok
t/04no_taintmode...........ok
t/05-blind-cache...........ok
t/05force_untaint..........ok
t/05nested_global..........ok
t/06-file-cache-dir........ok
t/07-double-file-cache.....ok
t/08-cache-debug...........ok
t/09-caching-precluded.....ok
t/10-param.................ok
t/11-non-file-templates....ok
t/99-old-test-pl...........ok
        2/80 skipped: Skipping shared memory cache test.  See README to enable
All tests successful, 4 subtests skipped.
Files=20, Tests=457,  3 wallclock secs ( 1.52 cusr +  0.28 csys =  1.80 CPU)
  /usr/bin/make test -- OK
Running make install
Installing /usr/lib/perl5/site_perl/5.8.8/HTML/Template.pm
Installing /usr/share/man/man3/HTML::Template.3pm
Writing /usr/lib/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/HTML/Template/.packlist
Appending installation info to /usr/lib/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod
  /usr/bin/make install UNINST=1 -- OKRe

cpan> quit

お次はMySQLにdbとtable作成。
都道府県用にdbをopenSurfpoint作成
tableを作成。うちはutf-8環境なのでそれぞれの環境に合わせて下さい。
CREATE TABLE `access_pref` (
  `access_date` datetime NOT NULL,
  `pref_id` smallint(6) NOT NULL,
  `count` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

国別用にdbをWorldAccess

CREATE TABLE `access_country` (
  `access_date` datetime NOT NULL,
  `country_id` varchar(6) NOT NULL,
  `count` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
都道府県 cgi-bin\surfpoint\welcome.cgi
#!/usr/bin/perl -w

use DBI;
use HTML::Template;
use Frontier::Client;
#use CAR_TIME;

$user_id  = "opensurfpoint認証ID";
$passwd   = "opensurfpointパスワード";
$ipadr    = $ENV{'REMOTE_ADDR'};

# 都道府県コードの取得
$server_url = "http://open.surfpoint.jp/webapi/enterprise.api";
$server = Frontier::Client->new( url=>$server_url );
$result = $server->call( 'openSurfpoint.GetPref', $user_id, $passwd, $ipadr );
$pref = $result;

if( $pref eq "-" ) { $pref = -1 };
if( $pref < -1 )   { $pref = -1 };
if( $pref > 47 )   { $pref = -1 };

# アクセス数をカウント
&IncrementAccessPref( $pref );

# トータルアクセス数を取得
$total_count = &GetTotalCount();

%h_pref_id = (
 1=>0,
 2=>0,
 3=>0,
 4=>0,
 5=>0,
 6=>0,
 7=>0,
 8=>0,
 9=>0,
 10=>0,
);

%h_count = (
 1=>0,
 2=>0,
 3=>0,
 4=>0,
 5=>0,
 6=>0,
 7=>0,
 8=>0,
 9=>0,
 10=>0,
);

&GetPrefRank( \%h_pref_id, \%h_count );

# HTML出力
$tmpfile = "welcome.tmpl";
$tmphtml = HTML::Template->new( filename => $tmpfile );

$tmphtml->param(
 PREFNAME => &GetPrefectureName( $pref ),
 TOTALCOUNT => $total_count,
 NAME1 => &GetPrefectureName( $h_pref_id{1} ),
 NAME2 => &GetPrefectureName( $h_pref_id{2} ),
 NAME3 => &GetPrefectureName( $h_pref_id{3} ),
 NAME4 => &GetPrefectureName( $h_pref_id{4} ),
 NAME5 => &GetPrefectureName( $h_pref_id{5} ),
 NAME6 => &GetPrefectureName( $h_pref_id{6} ),
 NAME7 => &GetPrefectureName( $h_pref_id{7} ),
 NAME8 => &GetPrefectureName( $h_pref_id{8} ),
 NAME9 => &GetPrefectureName( $h_pref_id{9} ),
 NAME10 => &GetPrefectureName( $h_pref_id{10} ),
 ACCESS1 => $h_count{1},
 ACCESS2 => $h_count{2},
 ACCESS3 => $h_count{3},
 ACCESS4 => $h_count{4},
 ACCESS5 => $h_count{5},
 ACCESS6 => $h_count{6},
 ACCESS7 => $h_count{7},
 ACCESS8 => $h_count{8},
 ACCESS9 => $h_count{9},
 ACCESS10 => $h_count{10},
);

print "Content-Type: text/html; charset=utf-8\n\n";
print $tmphtml->output;

exit(0);

 


#==============================================================================
#機能:カウント数をインクリメントする。
#==============================================================================
sub IncrementAccessPref {

 my $pref_id  = $_[0];

 my $today    = "2007-04-10 00:00:00";
 my $hDb      = DBI->connect('DBI:mysql:openSurfpoint:localhost', "ユーザー", "パスワード");
 my $hSt      = undef;
 my $count    = 0;
 my $record_n = 0;

 $hSt = $hDb->prepare( "select count from access_pref where pref_id='$pref_id' and access_date='$today'" );
 $record_n = $hSt->execute;
 @record = $hSt->fetchrow;
    $count = $record[0];
 $hSt->finish;

 if( $record_n == 0 ) {

  # レコードがなかった場合、新規に作成する
  $hSt = $hDb->prepare( "insert into access_pref values( '$today', '$pref_id', 1 )" );
  $hSt->execute;
  $hSt->finish;

 } else {

  # レコードがある場合、カウントをインクリメントする
  $count++;
  $hSt = $hDb->prepare( "update access_pref set count=$count where access_date='$today' and pref_id='$pref_id'" );
  $hSt->execute;
  $hSt->finish;

 }

 $hDb->disconnect;
}


#==============================================================================
#機能:トータルカウント数を取得する。
#==============================================================================
sub GetTotalCount {

 #my $today    = &GetDateA( 0 );
 my $today    = "2007-04-10 00:00:00";
 my $hDb      = DBI->connect('DBI:mysql:openSurfpoint:localhost', "ユーザー", "パスワード");
 my $hSt      = undef;
 my $count    = undef;

 $hSt = $hDb->prepare( "select sum(count) from access_pref where access_date='$today'" );
 $hSt->execute;
 @record = $hSt->fetchrow;
    $count = $record[0];
 $hSt->finish;
 $hDb->disconnect;

 return $count;
}


#==============================================================================
#機能:
#==============================================================================
sub GetPrefRank {

 my $s_pref_id = $_[0];
 my $s_count   = $_[1];

 my $today    = "2007-04-10 00:00:00";
 my $hDb      = DBI->connect('DBI:mysql:openSurfpoint:localhost', "ユーザー", "パスワード");
 my $hSt      = undef;

 $hSt = $hDb->prepare( "select pref_id, count from access_pref where access_date='$today' order by count desc" );
 $hSt->execute;

 my $index = 1;
 while( @record = $hSt->fetchrow ) {
  $$s_pref_id0 = $record[0];
  $$s_count0   = $record[1];
  $index++;
 }

 $hSt->finish;
 $hDb->disconnect;
}

 

#==============================================================================
#機能:
#==============================================================================
sub GetPrefectureName {

 %prefecture_name = (
  -1 =>"該当無",
  0 =>"不明",
  1 =>"北海道",
  2 =>"青森",
  3 =>"岩手",
  4 =>"宮城",
  5 =>"秋田",
  6 =>"山形",
  7 =>"福島",
  8 =>"茨城",
  9 =>"栃木",
  10=>"群馬",
  11=>"埼玉",
  12=>"千葉",
  13=>"東京",
  14=>"神奈川",
  15=>"新潟",
  16=>"富山",
  17=>"石川",
  18=>"福井",
  19=>"山梨",
  20=>"長野",
  21=>"岐阜",
  22=>"静岡",
  23=>"愛知",
  24=>"三重",
  25=>"滋賀",
  26=>"京都",
  27=>"大阪",
  28=>"兵庫",
  29=>"奈良",
  30=>"和歌山",
  31=>"鳥取",
  32=>"島根",
  33=>"岡山",
  34=>"広島",
  35=>"山口",
  36=>"徳島",
  37=>"香川",
  38=>"愛媛",
  39=>"高知",
  40=>"福岡",
  41=>"佐賀",
  42=>"長崎",
  43=>"熊本",
  44=>"大分",
  45=>"宮崎",
  46=>"鹿児島",
  47=>"沖縄",
 );

 my $pref = $_[0];

 return $prefecture_name{ $pref };
}

 


#==============================================================================
#機能:時刻をYYYY-MM-DD 00:00:00形式で取得する。
#==============================================================================
sub GetDateA {

# my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = &CAR_TIME::GetTime( $_[0] );
 my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
 $sec  = 0;
 $min  = 0;
 $hour = 0;

    $sec  = sprintf("%02d",$sec );
    $min  = sprintf("%02d",$min );
    $hour = sprintf("%02d",$hour);
    $mday = sprintf("%02d",$mday);
    $mon  = sprintf("%02d",$mon );

  return $year."-".$mon."-".$mday." ".$hour.":".$min.":".$sec;
}

__END__

cgi-bin\surfpoint\welcome.tmpl

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ご訪問地区カウンター</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Movable Type 3.34" />
<meta name="" />
<link href="ospsample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!-- コンテナ中央揃え ここから -->
<div align="center">
<div class="welcome"><TMPL_VAR NAME=PREFNAME>からようこそ!</div>
<div class="cap01">あなたは<TMPL_VAR NAME=TOTALCOUNT>番目の訪問者です</div>

 

<table width="170" border="0" cellspacing="0" cellpadding="0">
<caption class="cap02">テスト中</caption>
<caption class="cap02">都道府県別アクセス数</caption>
<tr>
<th>順位</th>
<th>都道府県</th>
<th>Access</th>
</tr>
<tr>
<td class="box02">1位</td>
<td class="box02"><TMPL_VAR NAME=NAME1></td>
<td class="box02"><TMPL_VAR NAME=ACCESS1></td>
</tr>
<tr>
<td class="box01">2位</td>
<td class="box01"><TMPL_VAR NAME=NAME2></td>
<td class="box01"><TMPL_VAR NAME=ACCESS2></td>
</tr>
<tr>
<td class="box02">3位</td>
<td class="box02"><TMPL_VAR NAME=NAME3></td>
<td class="box02"><TMPL_VAR NAME=ACCESS3></td>
</tr>
<tr>
<td class="box01">4位</td>
<td class="box01"><TMPL_VAR NAME=NAME4></td>
<td class="box01"><TMPL_VAR NAME=ACCESS4></td>
</tr>
<tr>
<td class="box02">5位</td>
<td class="box02"><TMPL_VAR NAME=NAME5></td>
<td class="box02"><TMPL_VAR NAME=ACCESS5></td>
</tr>
<tr>
<td class="box01">6位</td>
<td class="box01"><TMPL_VAR NAME=NAME6></td>
<td class="box01"><TMPL_VAR NAME=ACCESS6></td>
</tr>
<tr>
<td class="box02">7位</td>
<td class="box02"><TMPL_VAR NAME=NAME7></td>
<td class="box02"><TMPL_VAR NAME=ACCESS7></td>
</tr>
<tr>
<td class="box01">8位</td>
<td class="box01"><TMPL_VAR NAME=NAME8></td>
<td class="box01"><TMPL_VAR NAME=ACCESS8></td>
</tr>
<tr>
<td class="box02">9位</td>
<td class="box02"><TMPL_VAR NAME=NAME9></td>
<td class="box02"><TMPL_VAR NAME=ACCESS9></td>
</tr>
<tr>
<td class="box01">10位</td>
<td class="box01"><TMPL_VAR NAME=NAME10></td>
<td class="box01"><TMPL_VAR NAME=ACCESS10></td>
</tr>
<td class="box01"> </td>
<td class="box01"> </td>
<td class="box01"> </td>
</tr>
</table>
</body>
</html>

cgi-bin\surfpoint\welcomeworld.cgi

#!/usr/bin/perl -w

use DBI;
use HTML::Template;
use Frontier::Client;
#use CAR_TIME;

$user_id  = "openSurfpoint認証ID";
$passwd   = "openSurfpointパスワード";
$ipadr    = $ENV{'REMOTE_ADDR'};

# 都道府県コードの取得
#$server_url = "http://open.surfpoint.jp/webapi/enterprise.api";
#$server = Frontier::Client->new( url=>$server_url );
#$result = $server->call( 'openSurfpoint.GetPref', $user_id, $passwd, $ipadr );
#$pref = $result;

# 国内判定の取得
$server_url = "http://open.surfpoint.jp/webapi/globe.api";
$server = Frontier::Client->new( url=>$server_url );
$result = $server->call( 'openSurfpoint.GetCountry', $user_id, $passwd, $ipadr );
$country = $result;


if( $country eq "-" ) { $country = -1 };
if( $country eq "--" ) { $country = -1 };

# アクセス数をカウント
&IncrementAccessCountry( $country );

# トータルアクセス数を取得
$total_count = &GetTotalCount();

%h_country_id = (
 1=>0,
 2=>0,
 3=>0,
 4=>0,
 5=>0,
 6=>0,
 7=>0,
 8=>0,
 9=>0,
 10=>0,
);

%h_count = (
 1=>0,
 2=>0,
 3=>0,
 4=>0,
 5=>0,
 6=>0,
 7=>0,
 8=>0,
 9=>0,
 10=>0,
);

&GetCountryRank( \%h_country_id, \%h_count );

# HTML出力
$tmpfile = "welcomeworld.tmpl";
$tmphtml = HTML::Template->new( filename => $tmpfile );

$tmphtml->param(
 COUNTRYNAME => &GetCountryName( $country ),
 TOTALCOUNT => $total_count,
 NAME1 => &GetCountryName( $h_country_id{1} ),
 NAME2 => &GetCountryName( $h_country_id{2} ),
 NAME3 => &GetCountryName( $h_country_id{3} ),
 NAME4 => &GetCountryName( $h_country_id{4} ),
 NAME5 => &GetCountryName( $h_country_id{5} ),
 NAME6 => &GetCountryName( $h_country_id{6} ),
 NAME7 => &GetCountryName( $h_country_id{7} ),
 NAME8 => &GetCountryName( $h_country_id{8} ),
 NAME9 => &GetCountryName( $h_country_id{9} ),
 NAME10 => &GetCountryName( $h_country_id{10} ),
 ACCESS1 => $h_count{1},
 ACCESS2 => $h_count{2},
 ACCESS3 => $h_count{3},
 ACCESS4 => $h_count{4},
 ACCESS5 => $h_count{5},
 ACCESS6 => $h_count{6},
 ACCESS7 => $h_count{7},
 ACCESS8 => $h_count{8},
 ACCESS9 => $h_count{9},
 ACCESS10 => $h_count{10},
);

print "Content-Type: text/html; charset=utf-8\n\n";
print $tmphtml->output;

exit(0);

 


#==============================================================================
#機能:カウント数をインクリメントする。
#==============================================================================
sub IncrementAccessCountry {

 my $country_id  = $_[0];

 my $today    = "2007-04-10 00:00:00";
 my $hDb      = DBI->connect('DBI:mysql:WorldAccess:localhost', "ユーザー", "パスワード");
 my $hSt      = undef;
 my $count    = 0;
 my $record_n = 0;

 $hSt = $hDb->prepare( "select count from access_country where country_id='$country_id' and access_date='$today'" );
 $record_n = $hSt->execute;
 @record = $hSt->fetchrow;
    $count = $record[0];
 $hSt->finish;

 if( $record_n == 0 ) {

  # レコードがなかった場合、新規に作成する
  $hSt = $hDb->prepare( "insert into access_country values( '$today', '$country_id', 1 )" );
  $hSt->execute;
  $hSt->finish;

 } else {

  # レコードがある場合、カウントをインクリメントする
  $count++;
  $hSt = $hDb->prepare( "update access_country set count=$count where access_date='$today' and country_id='$country_id'" );
  $hSt->execute;
  $hSt->finish;

 }

 $hDb->disconnect;
}


#==============================================================================
#機能:トータルカウント数を取得する。
#==============================================================================
sub GetTotalCount {

 #my $today    = &GetDateA( 0 );
 my $today    = "2007-04-10 00:00:00";
 my $hDb      = DBI->connect('DBI:mysql:WorldAccess:localhost', "ユーザー", "パスワード");
 my $hSt      = undef;
 my $count    = undef;

 $hSt = $hDb->prepare( "select sum(count) from access_country where access_date='$today'" );
 $hSt->execute;
 @record = $hSt->fetchrow;
    $count = $record[0];
 $hSt->finish;
 $hDb->disconnect;

 return $count;
}


#==============================================================================
#機能:
#==============================================================================
sub GetCountryRank {

 my $s_country_id = $_[0];
 my $s_count   = $_[1];

 my $today    = "2007-04-10 00:00:00";
 my $hDb      = DBI->connect('DBI:mysql:WorldAccess:localhost', "ユーザー", "パスワード");
 my $hSt      = undef;

 $hSt = $hDb->prepare( "select country_id, count from access_country where access_date='$today' order by count desc" );
 $hSt->execute;

 my $index = 1;
 while( @record = $hSt->fetchrow ) {
  $$s_country_id0 = $record[0];
  $$s_count0   = $record[1];
  $index++;
 }

 $hSt->finish;
 $hDb->disconnect;
}

 

#==============================================================================
#機能:
#==============================================================================
sub GetCountryName {

 %country_name = (
 -1 =>"不明",
 1 =>"該当無",
 AC =>"アセンション島",
 AD =>"アンドラ",
 AE =>"アラブ首長国連邦",
 AF =>"アフガニスタン",
 AG =>"アンティグア・バーブーダ",
 AI =>"アンギラ",
 AL =>"アルバニア",
 AM =>"アルメニア",
 AN =>"オランダ領アンティール",
 AO =>"アンゴラ",
 AP =>"アジア太平洋連合",
 AQ =>"南極大陸",
 AR =>"アルゼンチン",
 AS =>"アメリカ領サモア",
 AT =>"オーストリア",
 AU =>"オーストラリア",
 AW =>"アルバ",
 AX =>"クリスマス島",
 AZ =>"アゼルバイジャン",
 BA =>"ボスニア・ヘルツェゴビナ",
 BB =>"バルバドス",
 BD =>"バングラディシュ",
 BE =>"ベルギー",
 BF =>"ブルキナファソ",
 BG =>"ブルガリア",
 BH =>"バーレーン",
 BI =>"ブルンジ",
 BJ =>"ベナン",
 BM =>"バミューダ諸島",
 BN =>"ブルネイ王国",
 BO =>"ボリビア",
 BR =>"ブラジル",
 BS =>"バハマ",
 BT =>"ブータン",
 BV =>"ブーヴェ島",
 BW =>"ボツワナ",
 BY =>"ベラルーシ",
 BZ =>"ベリーズ",
 CA =>"カナダ",
 CC =>"ココス(キーリング)諸島",
 CD =>"ザイール共和国",
 CF =>"中央アフリカ共和国",
 CG =>"コンゴ",
 CH =>"スイス",
 CI =>"コートジボアール",
 CK =>"クック諸島",
 CL =>"チリ",
 CM =>"カメルーン",
 CN =>"中国",
 CO =>"コロンビア",
 CR =>"コスタリカ",
 CS =>"旧チェコスロバキア",
 CU =>"キューバ",
 CV =>"カーボベルデ",
 CX =>"クリスマス島",
 CY =>"キプロス",
 CZ =>"チェコ",
 DE =>"ドイツ",
 DJ =>"ジブチ共和国",
 DK =>"デンマーク",
 DM =>"ドミニカ",
 DO =>"ドミニカ共和国",
 DZ =>"アルジェリア",
 EC =>"エクアドル",
 EE =>"エストニア",
 EG =>"エジプト",
 EH =>"西サハラ",
 ER =>"エリトリア",
 ES =>"スペイン",
 ET =>"エチオピア",
 EU =>"欧州連合",
 FI =>"フィンランド",
 FJ =>"フィジー",
 FK =>"フォークランド諸島",
 FM =>"ミクロネシア連邦",
 FO =>"フェロー諸島",
 FR =>"フランス",
 FX =>"フランス大都市",
 GA =>"ガボン",
 GB =>"イギリス",
 GD =>"グレナダ",
 GE =>"グルジア",
 GF =>"フランス領ガイアナ",
 GG =>"ガーンジー島",
 GH =>"ガーナ",
 GI =>"ジブラルタル",
 GL =>"グリーンランド",
 GM =>"ガンビア",
 GN =>"ギニア",
 GP =>"グアドループ島",
 GQ =>"赤道ギニア",
 GR =>"ギリシャ",
 GS =>"南ジョージア・南サンドイッチ諸島",
 GT =>"グアテマラ共和国",
 GU =>"グアム島",
 GW =>"ギニアビサウ",
 GY =>"ガイアナ",
 HK =>"香港",
 HM =>"ハード・マクドナルド諸島",
 HN =>"ホンジュラス",
 HR =>"クロアチア",
 HT =>"ハイチ",
 HU =>"ハンガリー",
 ID =>"インドネシア",
 IE =>"アイルランド",
 IL =>"イスラエル",
 IM =>"マン島",
 IN =>"インド",
 IO =>"イギリス領インド洋地域",
 IQ =>"イラク",
 IR =>"イラン",
 IS =>"アイスランド",
 IT =>"イタリア",
 JE =>"ジャージー島",
 JM =>"ジャマイカ",
 JO =>"ヨルダン",
 JP =>"日本",
 KE =>"ケニア",
 KG =>"キルギスタン",
 KH =>"カンボジア",
 KI =>"キリバツ",
 KM =>"コモロ",
 KN =>"アンギラ",
 KP =>"北朝鮮",
 KR =>"韓国",
 KW =>"クウェート",
 KY =>"ケイマン諸島",
 KZ =>"カザフスタン",
 LA =>"ラオス",
 LB =>"レバノン",
 LC =>"セントルシア",
 LI =>"リヒテンシュタイン公国",
 LK =>"スリランカ",
 LR =>"リベリア",
 LS =>"レソト",
 LT =>"リトアニア",
 LU =>"ルクセンブルク",
 LV =>"ラトビア",
 LY =>"リビア",
 MA =>"モロッコ",
 MC =>"モナコ",
 MD =>"モルドバ",
 MG =>"マダガスカル",
 MH =>"マーシャル諸島",
 MK =>"マケドニア",
 ML =>"マリ",
 MM =>"ミャンマー",
 MN =>"モンゴル",
 MO =>"マカオ",
 MP =>"北マリアナ諸島",
 MQ =>"マルチニーク島",
 MR =>"モーリタニア",
 MS =>"モンセラット",
 MT =>"マルタ",
 MU =>"モーリシャス",
 MV =>"モルディヴ",
 MW =>"マラウイ",
 MX =>"メキシコ",
 MY =>"マレーシア",
 MZ =>"モザンビーク",
 NA =>"ナミビア",
 NC =>"ニューカレドニア",
 NE =>"ニジェール",
 NF =>"ノーフォーク島",
 NG =>"ナイジェリア",
 NI =>"ニカラグア",
 NL =>"オランダ",
 NO =>"ノルウェー",
 NP =>"ネパール",
 NR =>"ナウル",
 NT =>"中立地帯",
 NU =>"ニウエ",
 NZ =>"ニュージーランド",
 OM =>"オマーン",
 PA =>"パナマ",
 PE =>"ペルー",
 PF =>"フランス領ポリネシア",
 PG =>"パプアニューギニア",
 PH =>"フィリピン",
 PK =>"パキスタン",
 PL =>"ポーランド",
 PM =>"サンピエール島・ミクロン島",
 PN =>"ピットケルン島",
 PR =>"プエルトリコ",
 PS =>"パレスチナ王国",
 PT =>"ポルトガル",
 PW =>"パラオ",
 PY =>"パラグアイ",
 QA =>"カタール",
 RE =>"レユニオン",
 RO =>"ルーマニア",
 RS =>"セルビア共和国",
 RU =>"ロシア",
 RW =>"ルワンダ",
 SA =>"サウジアラビア",
 SB =>"ソロモン諸島",
 SC =>"セイシェル",
 SD =>"スーダン",
 SE =>"スウェーデン",
 SG =>"シンガポール",
 SH =>"セントヘレナ島",
 SI =>"スロベニア",
 SJ =>"スヴァルバルド・ヤンマイェン諸島",
 SK =>"スロバキア",
 SL =>"シエラレオネ",
 SM =>"サンマリノ",
 SN =>"セネガル",
 SO =>"ソマリア",
 SR =>"スリナム",
 ST =>"サントメ・プリンシペ",
 SU =>"ソビエト社会主義共和国連邦",
 SV =>"エルサルバドル",
 SY =>"シリア",
 SZ =>"スワジランド",
 TC =>"タークス諸島・カイコス諸島",
 TD =>"チャド",
 TF =>"フランス領南方諸島",
 TG =>"トーゴ",
 TH =>"タイ",
 TJ =>"タジキスタン",
 TK =>"トケラウ諸島",
 TM =>"トルクメニスタン",
 TN =>"チュニジア",
 TO =>"トンガ",
 TP =>"東ティモール",
 TR =>"トルコ",
 TT =>"トリニダード・トバゴ",
 TV =>"ツバル",
 TW =>"台湾",
 TZ =>"タンザニア",
 UA =>"ウクライナ",
 UG =>"ウガンダ",
 UK =>"イギリス",
 UM =>"アメリカ辺境諸島",
 US =>"アメリカ合衆国",
 UY =>"ウルグアイ",
 UZ =>"ウズベキスタン",
 VA =>"バチカン市国",
 VC =>"セントビンセントおよびグレナディーン諸島",
 VE =>"ベネズエラ",
 VG =>"イギリス領バージン諸島",
 VI =>"アメリカ領バージン諸島",
 VN =>"ベトナム",
 VU =>"バヌアツ",
 WF =>"ワリスおよびフツナ諸島",
 WG =>"西ヨルダン・ガザ地区",
 WS =>"サモア",
 YE =>"イエメン",
 YT =>"マヨテ島",
 YU =>"ユーゴスラビア",
 ZA =>"南アフリカ",
 ZM =>"ザンビア",
 ZR =>"ザイール",
 ZW =>"ジンバブエ",
 );

 my $country = $_[0];

 return $country_name{ $country };
}

 


#==============================================================================
#機能:時刻をYYYY-MM-DD 00:00:00形式で取得する。
#==============================================================================
sub GetDateA {

# my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = &CAR_TIME::GetTime( $_[0] );
 my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time);
 $sec  = 0;
 $min  = 0;
 $hour = 0;

    $sec  = sprintf("%02d",$sec );
    $min  = sprintf("%02d",$min );
    $hour = sprintf("%02d",$hour);
    $mday = sprintf("%02d",$mday);
    $mon  = sprintf("%02d",$mon );

  return $year."-".$mon."-".$mday." ".$hour.":".$min.":".$sec;
}

__END__

cgi-bin\surfpoint\ospsample.css

/* Base Weblog (base-weblog.css) */

 

/* basic elements */

html {
    margin: 0;
    /* setting border: 0 hoses ie6 win window inner well border */
    padding: 0;
}

body {
    margin: 0;
    /* setting border: 0 hoses ie5 win window inner well border */
    padding: 0;
    font-family: "MS ゴシック", "Osaka-等幅";
    font-size: 12px;
 line-height: 16px;
}

a:link {
 text-decoration: none;
 color: #0033FF;
}
a:visited {
 text-decoration: none;
 color: #003366;
}
a:hover {
 text-decoration: underline;
 color: #6633FF;
}
a:active {
 text-decoration: none;
 color: #FFFF00;
}


/* コンテンツ */

#header {
 width: 200px;
 height: 51px;
 /*background-image: url(http://www.surfpoint.jp/open/img/ttl_head-osp.gif);*/
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 0px;
 }

#headre_SpLink {
 font-size: 12px;
 margin: 0px 0px 0px 0px;
 padding: 32px 0px 0px 0px;
 text-align: right;
 }


#pankuzu {
 width: 760px;
 height: 20px;
 background-image: url(http://www.surfpoint.jp/open/img/bg_pankuzu.gif);
 margin: 0px 0px 0px 0px;
 padding: 6px 0px 0px 0px;
 text-align:left;
 }

 

#pankuzu a:link{
 color: #000000;
 }

#pankuzu a:hover {
 text-decoration: underline;
 }

#pankuzu a:visited {
 color: #000000;
 }

 

#ttl_cat {
 width: 760px;
 height: 37px;
 background-image: url(http://www.surfpoint.jp/open/img/bg_ttl-category.gif);
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 0px;
 }

#ttl_cat h1 {
 margin: 0px 0px 0px 0px;
 padding: 8px 0px 0px 20px;
 line-height: 18px;
 text-align: left;
 font-size: 18px;
 color: #99FFFF;
 }

 

#content_clm3 {
 width: 760px;
 background-image: url(http://www.surfpoint.jp/open/img/bg_3clm.gif);
 background-repeat: repeat-y;
 }

#content_clm2 {
 width: 760px;
 background-image: url(http://www.surfpoint.jp/open/img/bg_2clm.gif);
 }

#clm_left {
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 0px;
 width: 150px;
 float: left;
 text-align:left;
 }

.menu-l_t14b {
 width: 140px;
 height: 25px;
 border-bottom-color: #003366;
 border-bottom-style: solid;
 border-bottom-width: 2px;
 text-align: center;
 font-size: 14px;
 font-weight: bold;
 line-height: 14px;
 margin: 20px 0px 5px 0px;
 padding: 0px 0px 0px 0px;
 }

.menu-l_txt {
 width: 140px;
 margin: 10px 0px 5px 0px;
 padding: 0px 0px 0px 0px;
 }

.menu-l_txt ul {
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 0px;
 }
.menu-l_txt li {
 margin: 3px 0px 0px 0px;
 padding: 2px 2px 2px 2px;
 font-size: 12px;
 line-height: 12px;
 font-weight: normal;
 background-color: #E1EBF4;
 list-style-type: disc;
 list-style-position: inside;
 }

#clm3_main_bg {
 margin: 0px 0px 0px 0px;
 padding: 0px 20px 0px 20px;

 width: 420px;
 float: left;
 }

#clm3_main {
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 0px;
 width: 420px;
 }

.clm3_main_ttl {
 width: 420px;
 height: 25px;
 background-image: url(http://www.surfpoint.jp/open/img/ttl_bg_ent01.gif);
 background-position: bottom right;
 background-repeat: no-repeat;
 border-bottom-color: #003366;
 border-bottom-style: solid;
 border-bottom-width: 2px;
 margin: 20px 0px 5px 0px;
 padding: 0px 0px 0px 0px;
 text-align: left;
 }

.clm3_main_ttl h2 {
 background-image: url(http://www.surfpoint.jp/open/img/ttl_icon_ent01.gif);
 background-position: center left;
 background-repeat: no-repeat;
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 22px;
 font-size: 14px;
 font-weight:bold;
 line-height: 14px;
 }

.clm3_txt {
 text-align: left;
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 0px;
 }

.oshirase {
 width: 416px;
 height: 10px;
 background-image: url(http://www.surfpoint.jp/open/img/waku_oshirase_hd.gif);
 font-size: 10px;
 line-height: 10px;
 text-align: right;
 margin: 40px 0px 0px 0px;
 padding: 7px 4px 6px 0px;
 }

.oshirase a:link{
 color: #FFFFFF;
 }

.oshirase a:hover {
 text-decoration: underline;
 }

.oshirase a:visited {
 color: #FFFFFF;
 }

.oshirase_waku {
 width: 386px;
 border-color: #5992C6;
 border-style: solid;
 border-width: 2px;
 margin: 0px 0px 30px 0px;
 padding: 15px 15px 15px 15px;
 text-align: left;
 }

.ent_oshirase_date {
 font: "Times New Roman", Times, serif;
 font-size: 10px;
 font-weight:bold;
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 0px;
 }

.ent_oshirase {
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 0px;
 }

.ent_oshirase h3 {
 font-size: 12px;
 font-weight: bold;
 line-height: 16px;
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 0px;
 }

.ent_oshirase_body {
 margin: 0px 0px 10px 0px;
 padding: 0px 0px 0px 0px;
 }

.ent_oshirase_body p {
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 3px 0px;
 }

#clm2_main_bg {
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 20px;
 background-image: url(http://www.surfpoint.jp/open/img/bg_2clm_main.gif);
 width: 590px;
 float: left;
 }

#clm2_main {
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 0px;
 width: 590px;
 float: right;
 }

 

#clm_right {
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 0px;
 width: 150px;
 float: right;
 text-align: right;
 }

.menu-r_t12 {
 width: 140px;
 height: 25px;
 border-bottom-color: #003366;
 border-bottom-style: solid;
 border-bottom-width: 2px;
 text-align: center;
 font-size: 10px;
 font-weight: normal;
 line-height: 12px;
 margin: 20px 0px 5px 10px;
 padding: 0px 0px 0px 0px;
 }

.menu-r_txt-t12 {
 width: 140px;
 margin: 10px 0px 5px 10px;
 padding: 0px 0px 0px 0px;
 text-align: left;
 font-size: 12px;
 line-height: 15px;
 background-color: #E1EBF4;
 }

.menu-r_txt-t12 h3 {
 margin: 3px 0px 0px 0px;
 padding: 2px 2px 2px 2px;
 font-size: 12px;
 line-height: 16px;
 font-weight: bold;
 }
 


.cap03 {
 font-size: 12px;
 background-position: center;
margin:10px 0px 10px 0px;
}

/*******************************************/

 .welcome {
 font-size: 10px;
 font-weight:bold;
 color: #000066;
 background-color: #E9F9FE;
 width: 170px;
 background-position: center;
 margin: 5px;
 padding: 3px;
}

 .cap01 {
 font-size: 10px;
 font-weight:bold;
 color: #000066;
 background-position: center;
 margin: 5px;
}
.cap02 {
 font-size: 10px;
 font-weight:bold;
 color: #FF6600;
 background-position: center;
 margin: 5px;
}
.box01 {
 font-size: 12px;
 background-color: #FFCC99;
 padding: 3px;
 text-align: center;
}

.box02 {
 font-size: 12px;
 background-color: #FFFFDD;
 padding: 3px;
 margin: 1px;
 text-align: center;
}

th {
 font-size: 10px;
 background-color: #FFCC99;
 padding: 3px;
 width: 120px;
 text-align: center;
}
/*******************************************/

 

.kekka {
 font-size: 12px;
 background-color: #FFFFDD;
 padding: 10px;
 width: 670px;
 margin: 5px;
text-align: left;
}
.info{
background-color: #E9F9FE;
width:680px;
margin:20px 0px 10px 0px;
padding:0px 0px 0px 0px;
}
.info h2{ 
font-size:14px;
font-weight:bold;
padding:10px 0px 0px 20px;
color:#000066;
text-align:left;
}
.info h3{
 font-size:12px;
 line-height: 18px;
 font-weight: normal;
 padding:0px 0px 0px 20px;
 text-align:left;
}

/*フッター*/

#footer {
 clear: both;
 width: 758px;
 margin: 0px 0px 0px 0px;
 padding: 13px 0px 13px 0px;
 border-style: dashed;
 border-width: 1px;
 border-color: #003399;
 text-align:center;
 font-size: 12px;
 }
.clm3_txt form{
 text-align:center;
 }

cgi-bin\surfpoint\ospsampleworld.css

/* Base Weblog (base-weblog.css) */

 

/* basic elements */

html {
    margin: 0;
    /* setting border: 0 hoses ie6 win window inner well border */
    padding: 0;
}

body {
    margin: 0;
    /* setting border: 0 hoses ie5 win window inner well border */
    padding: 0;
    font-family: "MS ゴシック", "Osaka-等幅";
    font-size: 12px;
 line-height: 16px;
}

a:link {
 text-decoration: none;
 color: #0033FF;
}
a:visited {
 text-decoration: none;
 color: #003366;
}
a:hover {
 text-decoration: underline;
 color: #6633FF;
}
a:active {
 text-decoration: none;
 color: #FFFF00;
}


/* コンテンツ */

#header {
 width: 200px;
 height: 51px;
 /*background-image: url(http://www.surfpoint.jp/open/img/ttl_head-osp.gif);*/
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 0px;
 }

#headre_SpLink {
 font-size: 12px;
 margin: 0px 0px 0px 0px;
 padding: 32px 0px 0px 0px;
 text-align: right;
 }


#pankuzu {
 width: 760px;
 height: 20px;
 background-image: url(http://www.surfpoint.jp/open/img/bg_pankuzu.gif);
 margin: 0px 0px 0px 0px;
 padding: 6px 0px 0px 0px;
 text-align:left;
 }

 

#pankuzu a:link{
 color: #000000;
 }

#pankuzu a:hover {
 text-decoration: underline;
 }

#pankuzu a:visited {
 color: #000000;
 }

 

#ttl_cat {
 width: 760px;
 height: 37px;
 background-image: url(http://www.surfpoint.jp/open/img/bg_ttl-category.gif);
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 0px;
 }

#ttl_cat h1 {
 margin: 0px 0px 0px 0px;
 padding: 8px 0px 0px 20px;
 line-height: 18px;
 text-align: left;
 font-size: 18px;
 color: #99FFFF;
 }

 

#content_clm3 {
 width: 760px;
 background-image: url(http://www.surfpoint.jp/open/img/bg_3clm.gif);
 background-repeat: repeat-y;
 }

#content_clm2 {
 width: 760px;
 background-image: url(http://www.surfpoint.jp/open/img/bg_2clm.gif);
 }

#clm_left {
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 0px;
 width: 150px;
 float: left;
 text-align:left;
 }

.menu-l_t14b {
 width: 140px;
 height: 25px;
 border-bottom-color: #003366;
 border-bottom-style: solid;
 border-bottom-width: 2px;
 text-align: center;
 font-size: 14px;
 font-weight: bold;
 line-height: 14px;
 margin: 20px 0px 5px 0px;
 padding: 0px 0px 0px 0px;
 }

.menu-l_txt {
 width: 140px;
 margin: 10px 0px 5px 0px;
 padding: 0px 0px 0px 0px;
 }

.menu-l_txt ul {
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 0px;
 }
.menu-l_txt li {
 margin: 3px 0px 0px 0px;
 padding: 2px 2px 2px 2px;
 font-size: 12px;
 line-height: 12px;
 font-weight: normal;
 background-color: #E1EBF4;
 list-style-type: disc;
 list-style-position: inside;
 }

#clm3_main_bg {
 margin: 0px 0px 0px 0px;
 padding: 0px 20px 0px 20px;

 width: 420px;
 float: left;
 }

#clm3_main {
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 0px;
 width: 420px;
 }

.clm3_main_ttl {
 width: 420px;
 height: 25px;
 background-image: url(http://www.surfpoint.jp/open/img/ttl_bg_ent01.gif);
 background-position: bottom right;
 background-repeat: no-repeat;
 border-bottom-color: #003366;
 border-bottom-style: solid;
 border-bottom-width: 2px;
 margin: 20px 0px 5px 0px;
 padding: 0px 0px 0px 0px;
 text-align: left;
 }

.clm3_main_ttl h2 {
 background-image: url(http://www.surfpoint.jp/open/img/ttl_icon_ent01.gif);
 background-position: center left;
 background-repeat: no-repeat;
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 22px;
 font-size: 14px;
 font-weight:bold;
 line-height: 14px;
 }

.clm3_txt {
 text-align: left;
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 0px;
 }

.oshirase {
 width: 416px;
 height: 10px;
 background-image: url(http://www.surfpoint.jp/open/img/waku_oshirase_hd.gif);
 font-size: 10px;
 line-height: 10px;
 text-align: right;
 margin: 40px 0px 0px 0px;
 padding: 7px 4px 6px 0px;
 }

.oshirase a:link{
 color: #FFFFFF;
 }

.oshirase a:hover {
 text-decoration: underline;
 }

.oshirase a:visited {
 color: #FFFFFF;
 }

.oshirase_waku {
 width: 386px;
 border-color: #5992C6;
 border-style: solid;
 border-width: 2px;
 margin: 0px 0px 30px 0px;
 padding: 15px 15px 15px 15px;
 text-align: left;
 }

.ent_oshirase_date {
 font: "Times New Roman", Times, serif;
 font-size: 10px;
 font-weight:bold;
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 0px;
 }

.ent_oshirase {
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 0px;
 }

.ent_oshirase h3 {
 font-size: 12px;
 font-weight: bold;
 line-height: 16px;
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 0px;
 }

.ent_oshirase_body {
 margin: 0px 0px 10px 0px;
 padding: 0px 0px 0px 0px;
 }

.ent_oshirase_body p {
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 3px 0px;
 }

#clm2_main_bg {
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 20px;
 background-image: url(http://www.surfpoint.jp/open/img/bg_2clm_main.gif);
 width: 590px;
 float: left;
 }

#clm2_main {
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 0px;
 width: 590px;
 float: right;
 }

 

#clm_right {
 margin: 0px 0px 0px 0px;
 padding: 0px 0px 0px 0px;
 width: 150px;
 float: right;
 text-align: right;
 }

.menu-r_t12 {
 width: 140px;
 height: 25px;
 border-bottom-color: #003366;
 border-bottom-style: solid;
 border-bottom-width: 2px;
 text-align: center;
 font-size: 10px;
 font-weight: normal;
 line-height: 12px;
 margin: 20px 0px 5px 10px;
 padding: 0px 0px 0px 0px;
 }

.menu-r_txt-t12 {
 width: 140px;
 margin: 10px 0px 5px 10px;
 padding: 0px 0px 0px 0px;
 text-align: left;
 font-size: 12px;
 line-height: 15px;
 background-color: #E1EBF4;
 }

.menu-r_txt-t12 h3 {
 margin: 3px 0px 0px 0px;
 padding: 2px 2px 2px 2px;
 font-size: 12px;
 line-height: 16px;
 font-weight: bold;
 }
 


.cap03 {
 font-size: 12px;
 background-position: center;
margin:10px 0px 10px 0px;
}

/*******************************************/

 .welcome {
 font-size: 10px;
 font-weight:bold;
 color: #000066;
 background-color: #E9F9FE;
 width: 450px;
 background-position: center;
 margin: 5px;
 padding: 3px;
}

 .cap01 {
 font-size: 10px;
 font-weight:bold;
 color: #000066;
 background-position: center;
 margin: 5px;
}
.cap02 {
 font-size: 10px;
 font-weight:bold;
 color: #FF6600;
 background-position: center;
 margin: 5px;
}
.box01 {
 font-size: 12px;
 background-color: #FFCC99;
 padding: 3px;
 text-align: center;
}

.box02 {
 font-size: 12px;
 background-color: #FFFFDD;
 padding: 3px;
 margin: 1px;
 text-align: center;
}

th {
 font-size: 10px;
 background-color: #FFCC99;
 padding: 3px;
 width: 120px;
 text-align: center;
}
/*******************************************/

 

.kekka {
 font-size: 12px;
 background-color: #FFFFDD;
 padding: 10px;
 width: 670px;
 margin: 5px;
text-align: left;
}
.info{
background-color: #E9F9FE;
width:680px;
margin:20px 0px 10px 0px;
padding:0px 0px 0px 0px;
}
.info h2{ 
font-size:14px;
font-weight:bold;
padding:10px 0px 0px 20px;
color:#000066;
text-align:left;
}
.info h3{
 font-size:12px;
 line-height: 18px;
 font-weight: normal;
 padding:0px 0px 0px 20px;
 text-align:left;
}

/* フッター */

#footer {
 clear: both;
 width: 758px;
 margin: 0px 0px 0px 0px;
 padding: 13px 0px 13px 0px;
 border-style: dashed;
 border-width: 1px;
 border-color: #003399;
 text-align:center;
 font-size: 12px;
 }
.clm3_txt form{
 text-align:center;
 }


 これで一応TOP10まで表示されると思います。
あくまでも素人作成に付き暴走しても責任は持てませんので・・・(^^ゞ