<?php
//
// 各国市場の開始終了時間と日本との時差
//
// 夏時間   現地時間     時差 日本時間だと 夏時間の期間
// 日本     09:00-15:00  0    09:00-15:00
// 香港     10:00-16:00  1    11:00-17:00
// 上海     09:30-15:00  1    10:30-16:00
// インド   10:00-15:30  3.5  13:30-19:00
// ロシア   10:30-18:45  5    15:30-23:45  4/第1日曜-10/最終日曜
// トルコ   09:30-17:00  6    15:30-23:00  4/第1日曜-10/最終日曜
// ロンドン 08:00-16:30  8    16:00-24:30  4/第1日曜-10/最終日曜
// ブラジル 10:00-17:00  12   22:00-05:00  2/第3日曜-10/第3日曜
// アメリカ 09:30-16:00  13   22:30-05:00  3/第2日曜-11/第1日曜
//
// 冬時間   現地時間     時差 日本時間だと
// 日本     09:00-15:00  0    09:00-15:00
// 香港     10:00-16:00  1    11:00-17:00
// 上海     09:30-15:00  1    10:30-16:00
// インド   10:00-15:30  3.5  13:30-19:00
// ロシア   10:30-18:00  6    16:30-24:00
// トルコ   09:30-17:00  7    16:30-24:00
// ロンドン 08:00-16:30  9    17:00-01:30
// ブラジル 12:00-17:00  13   22:00-06:00
// アメリカ 09:30-16:00  14   23:30-06:00
//
// 初期値設定
//
$dbserver = "localhost";
$dbuser = "root";
$dbpassword = "hogehoge";
$dbname = "kabu";
$con=mysql_connect($dbserver,$dbuser,$dbpassword);
$selectdb=mysql_select_db($dbname);
$nowtime=date("Hi");
$youbi=date("w");
// 0--日曜 6--土曜
$masterdate = -1;
$datez=date(z);


//
// 市場開始時間以前だったら 2日前をセット
// 市場開始時間以降だったら前日をセット
// 土日月は金曜日と同じ数値をセット
//
if ($nowtime < 900) $dateoffset = $masterdate -1;
if ($nowtime >= 900) $dateoffset = $masterdate;
if ($youbi == 6) $dateoffset = -2;
if ($youbi == 0) $dateoffset = -3;
if ($youbi == 1)  $dateoffset = $dateoffset -2;
if (($youbi == 2) and ($nowtime <900)) $dateoffset = -4;


//
// 本日の最後の価額を取得
//
$sql="select * from toushin where name='N225' and kagaku>0 order by date desc,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$today="$col[kagaku]";

//
// $dateoffset変数の日付分日数をさかのぼったその日の最後の価額を取得
//
$sql="select * from toushin where date between date_add(current_date(),interval $dateoffset day) and current_date() and name='N225' order by date,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$yesterday="$col[kagaku]";
$yesterday=round($yesterday,0);

//
// 騰落の計算。小数点以下 1ケタ
//
$touraku = ($yesterday==0) ? 0 : sprintf("%01.1f",(($today/$yesterday)-1)*100);
$today=round($today,0);

//
// 上下の矢印を付ける
//
if ($touraku > 0){
$touraku = "<font color=red>↑+$touraku</font>";
}else{
$touraku = "<font color=green>↓$touraku</font>";
}

//
// html部分でページ部分となる $body変数へ、htmlのページ構成の通りに吐き出し
// 左右を合わせるには、ここでスペースを入れて調整する
// 指数のケタが変わるとずれちゃうのが難点
//
$body = "<pre>        昨日  本日   騰落
N225    $yesterday  $today $touraku%
";

//
// 以下 N225と同じ処理を繰り返す
//

$sql="select * from toushin where name='TOPIX' and kagaku>0 order by date desc,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$today="$col[kagaku]";
$sql="select * from toushin where date between date_add(current_date(),interval $dateoffset day) and current_date() and name='TOPIX' order by date,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$yesterday="$col[kagaku]";
$touraku = ($yesterday==0) ? 0 : sprintf("%01.1f",(($today/$yesterday)-1)*100);
$yesterday=round($yesterday,0);
$today=round($today,0);
if ($touraku > 0){
$touraku = "<font color=red>↑+$touraku</font>";
}else{
$touraku = "<font color=green>↓$touraku</font>";
}
$body .="TOPIX    $yesterday   $today $touraku%
";


//
// USD
//

$sql="select * from toushin where name='USD' and kagaku>0 order by date desc,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$today="$col[kagaku]";
$sql="select * from toushin where date between date_add(current_date(),interval $dateoffset day) and current_date() and name='USD' order by date,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$yesterday="$col[kagaku]";
$touraku = ($yesterday==0) ? 0 : sprintf("%01.1f",(($today/$yesterday)-1)*100);
$yesterday=sprintf("%01.1f",round($yesterday,1));
$today=sprintf("%01.1f",round($today,1));
if ($touraku > 0){
$touraku = "<font color=red>↑+$touraku</font>";
}else{
$touraku = "<font color=green>↓$touraku</font>";
}
$body .="USD     $yesterday  $today $touraku%
";

//
// 上海A
//

if ($nowtime < 1030) $dateoffset = $masterdate -1;
if ($nowtime >= 1030) $dateoffset = $masterdate;
if ($youbi == 6) $dateoffset = -2;
if ($youbi == 0) $dateoffset = -3;
if ($youbi == 1)  $dateoffset = $dateoffset -2;
if (($youbi == 2) and ($nowtime <1030)) $dateoffset = -4;

$sql="select * from toushin where name='000001.ss' and kagaku>0 order by date desc,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$today="$col[kagaku]";

$sql="select * from toushin where date between date_add(current_date(),interval $dateoffset day) and current_date() and name='000001.ss' order by date,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$yesterday="$col[kagaku]";
$touraku = ($yesterday==0) ? 0 : sprintf("%01.1f",(($today/$yesterday)-1)*100);
$yesterday=round($yesterday,0);
$today=round($today,0);
if ($touraku > 0){
$touraku = "<font color=red>↑+$touraku</font>";
}else{
$touraku = "<font color=green>↓$touraku</font>";
}
$body .="上海A   $yesterday  $today $touraku%
";

//
// 上海 SSE50
//

$sql="select * from toushin where name='000016.ss' and kagaku>0 order by date desc,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$today="$col[kagaku]";
$sql="select * from toushin where date between date_add(current_date(),interval $dateoffset day) and current_date() and name='000016.ss' order by date,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$yesterday="$col[kagaku]";
$touraku = ($yesterday==0) ? 0 : sprintf("%01.1f",(($today/$yesterday)-1)*100);
$yesterday=round($yesterday,0);
$today=round($today,0);
if ($touraku > 0){
$touraku = "<font color=red>↑+$touraku</font>";
}else{
$touraku = "<font color=green>↓$touraku</font>";
}
$body .="SSE50   $yesterday  $today $touraku%
";

//
// 香港 ハンセン
//

if ($nowtime < 1100) $dateoffset = $masterdate -1;
if ($nowtime >= 1100) $dateoffset = $masterdate;
if ($youbi == 6) $dateoffset = -2;
if ($youbi == 0) $dateoffset = -3;
if ($youbi == 1)  $dateoffset = $dateoffset -2;
if (($youbi == 2) and ($nowtime <1100)) $dateoffset = -4;


$sql="select * from toushin where name='HSI' and kagaku>0 order by date desc,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$today="$col[kagaku]";
$sql="select * from toushin where date between date_add(current_date(),interval $dateoffset day) and current_date() and name='HSI' order by date,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$yesterday="$col[kagaku]";
$touraku = ($yesterday==0) ? 0 : sprintf("%01.1f",(($today/$yesterday)-1)*100);
$yesterday=round($yesterday,0);
$today=round($today,0);
if ($touraku > 0){
$touraku = "<font color=red>↑+$touraku</font>";
}else{
$touraku = "<font color=green>↓$touraku</font>";
}
$body .="ハンセン   $yesterday $today $touraku%
";

//
// 香港 H株
//

$sql="select * from toushin where name='HSCE' and kagaku>0 order by date desc,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$today="$col[kagaku]";
$sql="select * from toushin where date between date_add(current_date(),interval $dateoffset day) and current_date() and name='HSCE' order by date,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$yesterday="$col[kagaku]";
$touraku = ($yesterday==0) ? 0 : sprintf("%01.1f",(($today/$yesterday)-1)*100);
$yesterday=round($yesterday,0);
$today=round($today,0);
if ($touraku > 0){
$touraku = "<font color=red>↑+$touraku</font>";
}else{
$touraku = "<font color=green>↓$touraku</font>";
}
$body .="H株     $yesterday  $today $touraku%
";

//
// インド SENSEX
//

if ($nowtime < 1330) $dateoffset = $masterdate -1;
if ($nowtime >= 1330) $dateoffset = $masterdate;
if ($youbi == 6) $dateoffset = -2;
if ($youbi == 0) $dateoffset = -3;
if ($youbi == 1)  $dateoffset = $dateoffset -2;
if (($youbi == 2) and ($nowtime <1330)) $dateoffset = -4;

$sql="select * from toushin where name='SENSEX' and kagaku>0 order by date desc,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$today="$col[kagaku]";
$sql="select * from toushin where date between date_add(current_date(),interval $dateoffset day) and current_date() and name='SENSEX' order by date,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$yesterday="$col[kagaku]";
$touraku = ($yesterday==0) ? 0 : sprintf("%01.1f",(($today/$yesterday)-1)*100);
$yesterday=round($yesterday,0);
$today=round($today,0);
if ($touraku > 0){
$touraku = "<font color=red>↑+$touraku</font>";
}else{
$touraku = "<font color=green>↓$touraku</font>";
}
$body .="SENSEX  $yesterday  $today $touraku%
";

//
// ロシア RTS
//

//
// 夏時間の判定

if (($datez > 94) and ($datez <=300)){
$stime = 1530;
$ftime = 234500;
}else{
$stime = 1630;
$ftime = 240000;
}

if ($nowtime < $stime) $dateoffset = $masterdate -1;
if ($nowtime >= $stime) $dateoffset = $masterdate;
if ($youbi == 6) $dateoffset = -2;
if ($youbi == 0) $dateoffset = -3;
if ($youbi == 1)  $dateoffset = $dateoffset -2;
if (($youbi == 2) and ($nowtime <$stime)) $dateoffset = -4;

$sql="select * from toushin where name='RTS' and kagaku>0 order by date desc,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$today="$col[kagaku]";
$sql="select * from toushin where date between date_add(current_date(),interval $dateoffset day) and current_date() and name='RTS' order by date,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$yesterday="$col[kagaku]";
$touraku = ($yesterday==0) ? 0 : sprintf("%01.1f",(($today/$yesterday)-1)*100);
$yesterday=round($yesterday,0);
$today=round($today,0);
if ($touraku > 0){
$touraku = "<font color=red>↑+$touraku</font>";
}else{
$touraku = "<font color=green>↓$touraku</font>";
}
$body .="RTS      $yesterday   $today $touraku%
";

//
// トルコ XU100
//

if (($datez > 94) and ($datez <=300)){
$stime = 1530;
$ftime = 230000;
}else{
$stime = 1630;
$ftime = 240000;
}

if ($nowtime < $stime) $dateoffset = $masterdate -1;
if ($nowtime >= $stime) $dateoffset = $masterdate;
if ($youbi == 6) $dateoffset = -2;
if ($youbi == 0) $dateoffset = -3;
if ($youbi == 1)  $dateoffset = $dateoffset -2;
if (($youbi == 2) and ($nowtime <$stime)) $dateoffset = -4;

$sql="select * from toushin where name='XU100' and kagaku>0 order by date desc,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$today="$col[kagaku]";
$sql="select * from toushin where date between date_add(current_date(),interval $dateoffset day) and current_date() and name='XU100' order by date,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$yesterday="$col[kagaku]";
$touraku = ($yesterday==0) ? 0 : sprintf("%01.1f",(($today/$yesterday)-1)*100);
$yesterday=round($yesterday,0);
$today=round($today,0);
if ($touraku > 0){
$touraku = "<font color=red>↑+$touraku</font>";
}else{
$touraku = "<font color=green>↓$touraku</font>";
} 
$body .="XU100  $yesterday $today $touraku%
";

//
// ロンドン FTSE
//

if (($datez > 94) and ($datez <=300)){
$stime = 1600;
$ftime = 10000;
}else{
$stime = 1700;
$ftime = 20000;
}

if ($nowtime < $stime) $dateoffset = $masterdate;
if ($nowtime >= $stime) $dateoffset = $masterdate + 1;
if ($youbi == 6) $dateoffset = -1;
if ($youbi == 0) $dateoffset = -2;
if ($youbi == 1)  $dateoffset = $dateoffset -1;
if (($youbi == 2) and ($nowtime <$stime)) $dateoffset = -3;

$sql="select * from toushin where name='FTSE' and kagaku>0 order by date desc,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$today="$col[kagaku]";
$sql="select * from toushin where date between date_add(current_date(),interval $dateoffset day) and current_date() and name='FTSE' and time between $ftime and ($ftime+3000) order by date,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$yesterday="$col[kagaku]";
$touraku = ($yesterday==0) ? 0 : sprintf("%01.1f",(($today/$yesterday)-1)*100);
$yesterday=round($yesterday,0);
$today=round($today,0);
if ($touraku > 0){
$touraku = "<font color=red>↑+$touraku</font>";
}else{
$touraku = "<font color=green>↓$touraku</font>";
}
$body .="FTSE    $yesterday  $today $touraku%
";

//
// ダウ
//

//
// 夏時間の判定

if (($datez > 69) and ($datez <= 308)){
//夏時間
$stime = 2230;
$ftime = 50000;
}else{
//冬時間
$stime = 2330;
$ftime = 60000;
}

if ($nowtime < $stime) $dateoffset = $masterdate;
if ($nowtime >= $stime) $dateoffset = $masterdate + 1;
if ($youbi == 6) $dateoffset = -1;
if ($youbi == 0) $dateoffset = -2;
if ($youbi == 1)  $dateoffset = $dateoffset -2;
if (($youbi == 1) and ($nowtime>=$stime)) $dateoffset = -2;
if (($youbi == 2) and ($nowtime <$stime)) $dateoffset = -3;

$sql="select * from toushin where name='DJI' and kagaku>0 order by date desc,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$today="$col[kagaku]";
$sql="select * from toushin where date between date_add(current_date(),interval $dateoffset day) and current_date() and name='DJI' and time between $ftime and ($ftime+3000) order by date,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$yesterday="$col[kagaku]";
$touraku = ($yesterday==0) ? 0 : sprintf("%01.1f",(($today/$yesterday)-1)*100);
$yesterday=round($yesterday,0);
$today=round($today,0);
if ($touraku > 0){
$touraku = "<font color=red>↑+$touraku</font>";
}else{
$touraku = "<font color=green>↓$touraku</font>";
}
$body .="DJI     $yesterday  $today $touraku%
";

$sql="select * from toushin where name='EWZ' and kagaku>0 order by date desc,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$today="$col[kagaku]";
$sql="select * from toushin where date between date_add(current_date(),interval $dateoffset day) and current_date() and name='EWZ' and time between $ftime and ($ftime+3000) order by date,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$yesterday="$col[kagaku]";
$touraku = ($yesterday==0) ? 0 : sprintf("%01.1f",(($today/$yesterday)-1)*100);
$yesterday=sprintf("%01.1f",round($yesterday,1));
$today=sprintf("%01.1f",round($today,1));
if ($touraku > 0){
$touraku = "<font color=red>↑+$touraku</font>";
}else{
$touraku = "<font color=green>↓$touraku</font>";
}
$body .="EWZ     $yesterday  $today $touraku%
";

//
// ブラジル BVSP
//

if (($datez > 49) and ($datez <= 291)){
//夏時間
$stime = 2200;
$ftime = 50000;
}else{
//冬時間
$stime = 2200;
$ftime = 60000;
}

if ($nowtime < $stime) $dateoffset = $masterdate;
if ($nowtime >= $stime) $dateoffset = $masterdate + 1;
if ($youbi == 6) $dateoffset = -1;
if ($youbi == 0) $dateoffset = -2;
if ($youbi == 1)  $dateoffset = $dateoffset -2;
if (($youbi == 1) and ($nowtime>=$stime)) $dateoffset = -2;
if (($youbi == 2) and ($nowtime <$stime)) $dateoffset = -3;

$sql="select * from toushin where name='BVSP' and kagaku>0 order by date desc,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$today="$col[kagaku]";
$sql="select * from toushin where date between date_add(current_date(),interval $dateoffset day) and current_date() and name='BVSP' and time between $ftime and ($ftime+10000) order by date,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$yesterday="$col[kagaku]";
$touraku = ($yesterday==0) ? 0 : sprintf("%01.1f",(($today/$yesterday)-1)*100);
$yesterday=round($yesterday,0);
$today=round($today,0);
if ($touraku > 0){
$touraku = "<font color=red>↑+$touraku</font>";
}else{
$touraku = "<font color=green>↓$touraku</font>";
}
$body .="BVSP   $yesterday $today $touraku%

";


if ($nowtime < 900) $dateoffset = $masterdate -1;
if ($nowtime >= 900) $dateoffset = $masterdate;
if ($youbi == 6) $dateoffset = -2;
if ($youbi == 0) $dateoffset = -3;
if ($youbi == 1)  $dateoffset = $dateoffset -2;
if (($youbi == 2) and ($nowtime <900)) $dateoffset = -4;

$sql="select * from toushin where name='9205' and kagaku>0 order by date desc,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$today="$col[kagaku]";
$sql="select * from toushin where date between date_add(current_date(),interval $dateoffset day) and current_date() and name='9205' order by date,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$yesterday="$col[kagaku]";
$touraku = ($yesterday==0) ? 0 : sprintf("%01.1f",(($today/$yesterday)-1)*100);
$yesterday=round($yesterday,0);
$today=round($today,0);
if ($touraku > 0){
$touraku = "<font color=red>↑+$touraku</font>";
}else{
$touraku = "<font color=green>↓$touraku</font>";
}
$body .="JAL      $yesterday   $today $touraku%
";


$sql="select * from toushin where name='9202' and kagaku>0 order by date desc,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$today="$col[kagaku]";
$sql="select * from toushin where date between date_add(current_date(),interval $dateoffset day) and current_date() and name='9202' order by date,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$yesterday="$col[kagaku]";
$touraku = ($yesterday==0) ? 0 : sprintf("%01.1f",(($today/$yesterday)-1)*100);
$yesterday=round($yesterday,0);
$today=round($today,0);
if ($touraku > 0){
$touraku = "<font color=red>↑+$touraku</font>";
}else{
$touraku = "<font color=green>↓$touraku</font>";
}
$body .="ANA      $yesterday   $today $touraku%
";


$sql="select * from toushin where name='7762' and kagaku>0 order by date desc,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$today="$col[kagaku]";
$sql="select * from toushin where date between date_add(current_date(),interval $dateoffset day) and current_date() and name='7762' order by date,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$yesterday="$col[kagaku]";
$touraku = ($yesterday==0) ? 0 : sprintf("%01.1f",(($today/$yesterday)-1)*100);
$yesterday=round($yesterday,0);
$today=round($today,0);
if ($touraku > 0){
$touraku = "<font color=red>↑+$touraku</font>";
}else{
$touraku = "<font color=green>↓$touraku</font>";
}
$body .="シチズン    $yesterday   $today $touraku%
";


$sql="select * from toushin where name='1309' and kagaku>0 order by date desc,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$today="$col[kagaku]";
$sql="select * from toushin where date between date_add(current_date(),interval $dateoffset day) and current_date() and name='1309' order by date,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$yesterday="$col[kagaku]";
$touraku = ($yesterday==0) ? 0 : sprintf("%01.1f",(($today/$yesterday)-1)*100);
$yesterday=round($yesterday,0);
$today=round($today,0);
if ($touraku > 0){
$touraku = "<font color=red>↑+$touraku</font>";
}else{
$touraku = "<font color=green>↓$touraku</font>";
}
$body .="1309   $yesterday $today $touraku%
";


$sql="select * from toushin where name='2805' and kagaku>0 order by date desc,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$today="$col[kagaku]";
$sql="select * from toushin where name='2805' and kagaku>0 and date < date_add(current_date(),interval $dateoffset day) order by date desc,time desc,id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$yesterday="$col[kagaku]";
$touraku = ($yesterday==0) ? 0 : sprintf("%01.1f",(($today/$yesterday)-1)*100);
$yesterday=round($yesterday,0);
$today=round($today,0);
if ($touraku > 0){
$touraku = "<font color=red>↑+$touraku</font>";
}else{
$touraku = "<font color=green>↓$touraku</font>";
}
$body .="SBショクヒン  $yesterday   $today $touraku%
";


//
// mysql最後の idの日付、時間を最終更新時間として吐き出し
//
$sql="select * from toushin order by id desc limit 1";
$rst = mysql_query($sql);
$col = mysql_fetch_array($rst);
$lastid="$col[id]";
$date2=substr($col[date],5,strlen($col[date])-5);
$time2=substr($col[time],0,strlen($col[time])-3);
$body2 ="
最終更新 $date2 $time2 $lastid";

//
// mysqlを閉じる
//
mysql_free_result($rst);
$con = mysql_close($con);

//
// PHPの処理終了。以下 htmlのページ作成部分
//
?>

<html><head><meta http-equiv=Cache-Control content=no-cache><meta name=CHTML http-equiv=Content-Type content="text/html; charset=EUC-JP"><title>携帯で指数ページ</title></head><body bgcolor=black text=white><?=$body?><?=$body2?><a href=index.html><? include "/home/localhost/c_count/counter.inc"; ?><? echo $counter ?></a></pre></body></html>