|
|
<?
# **************************************************************************
# ƒXƒNƒŠƒvƒg‹¤’Ê•Ï”
# **************************************************************************
$Common_dir = "\\localweb\\php\\require\\";
$Form_name = "frmMain";
# **************************************************************************
# ŠO•”ƒtƒ@ƒCƒ‹
# **************************************************************************
require_once( $Common_dir . "std.php" );
require_once( "value.php" );
require_once( "action.php" );
?>
<HTML>
<?
# **************************************************************************
# ƒXƒNƒŠƒvƒgŒÅ—L‚̉Šú‰»
# **************************************************************************
$VAL = new PgValue();
# **************************************************************************
# HEADEBODYEFORM
# **************************************************************************
LoadHead( "‚c‚aƒe[ƒuƒ‹ƒƒ“ƒeƒiƒ“ƒX", $Common_dir . "css.php" );
LoadBody( "" );
LoadForm( Dd( $Form_name ), "" );
# **************************************************************************
# DB ƒCƒ“ƒXƒ^ƒ“ƒX
# **************************************************************************
$SQL = new DB( "LAYLA", "LBOX", "sa", "" );
# **************************************************************************
# ˆ—ƒRƒ“ƒgƒ[ƒ‹
# **************************************************************************
if ( strtoupper( $HTTP_ENV_VARS["REQUEST_METHOD"] ) == "GET" ) {
F_LoadDataInit( $SQL, $VAL );
}
else {
switch( $cmd_send ) {
case "Previous":
F_LoadDataPrev( $SQL, $VAL );
break;
case "Next":
F_LoadDataNext( $SQL, $VAL );
break;
}
}
# **************************************************************************
# ƒrƒ…[
# **************************************************************************
require_once( "view.php" );
# **************************************************************************
# Ú‘±‰ðœ
# **************************************************************************
$SQL->Close();
?>
| |
|
|
|
|
<?
OutCr( "<!--value.php-->" );
# *****************************************************************************
# •Ï”ƒNƒ‰ƒX
# *****************************************************************************
class PgValue {
var $LineMax;
var $Cnt;
var $dtDen;
var $strTanto;
var $nKin;
var $nNai;
var $nGai;
var $dtSei;
var $strBiko;
var $StartKey;
var $EndKey;
# *********************************************************
# ƒRƒ“ƒXƒgƒ‰ƒNƒ^
# *********************************************************
function PgValue( ) {
global $start_key;
global $end_key;
$this->LineMax = 5;
$this->Cnt = 0;
if ( isset( $start_key ) ) {
$this->StartKey = $start_key;
$this->EndKey = $end_key;
}
else {
$this->StartKey = "";
$this->EndKey = "";
}
}
}
?>
| |
|
|
ƒT[ƒo[ƒTƒCƒhƒ‚ƒfƒ‹ (action.php) |
|
|
<?
OutCr( "<!--action.php-->" );
# *****************************************************************************
# ƒf[ƒ^ƒZƒbƒg
# *****************************************************************************
function F_SetData( &$SQL, &$VAL ) {
for ( $i = 0; $i < $VAL->LineMax; $i++ ) {
if ( FALSE == $SQL->Fetch() ) {
break;
}
if ( $i == 0 ) {
$VAL->StartKey = $SQL->Field[7];
}
$VAL->dtDen[$i] = $SQL->Field[0];
$VAL->strTanto[$i] = $SQL->Field[1];
$VAL->nKin[$i] = $SQL->Field[2];
$VAL->nNai[$i] = $SQL->Field[3];
$VAL->nGai[$i] = $SQL->Field[4];
$VAL->dtSei[$i] = $SQL->Field[5];
$VAL->strBiko[$i] = $SQL->Field[6];
$VAL->EndKey = $SQL->Field[7];
}
return $i;
}
# *****************************************************************************
# ‰Šúƒf[ƒ^EƒJƒŒƒ“ƒgƒf[ƒ^
# *****************************************************************************
function F_LoadDataInit( &$SQL, &$VAL ) {
$SqlQuery = "select *,convert(char(10),‰ÁH’À“`•[“ú•t,111)+’S“–ŽÒƒR[ƒh";
$SqlQuery .= " from T_SV‰ÁH’À“`•[";
$SqlQuery .= " where convert(char(10),‰ÁH’À“`•[“ú•t,111)+’S“–ŽÒƒR[ƒh >= '{$VAL->StartKey}'";
$SqlQuery .= " order by ‰ÁH’À“`•[“ú•t,’S“–ŽÒƒR[ƒh";
$SQL->Query( $SqlQuery );
F_SetData( $SQL, $VAL );
$SQL->Free();
}
# *****************************************************************************
# ŽŸƒf[ƒ^
# *****************************************************************************
function F_LoadDataNext( &$SQL, &$VAL ) {
$SqlQuery = "select *,convert(char(10),‰ÁH’À“`•[“ú•t,111)+’S“–ŽÒƒR[ƒh";
$SqlQuery .= " from T_SV‰ÁH’À“`•[";
$SqlQuery .= " where convert(char(10),‰ÁH’À“`•[“ú•t,111)+’S“–ŽÒƒR[ƒh > '{$VAL->EndKey}'";
$SqlQuery .= " order by ‰ÁH’À“`•[“ú•t,’S“–ŽÒƒR[ƒh";
$SQL->Query( $SqlQuery );
$i = F_SetData( $SQL, $VAL );
$SQL->Free();
if ( $i == 0 ) {
F_LoadDataInit( $SQL, $VAL );
}
}
# *****************************************************************************
# ‘Oƒf[ƒ^
# *****************************************************************************
function F_LoadDataPrev( &$SQL, &$VAL ) {
$SqlQuery = "select *,convert(char(10),‰ÁH’À“`•[“ú•t,111)+’S“–ŽÒƒR[ƒh";
$SqlQuery .= " from T_SV‰ÁH’À“`•[";
$SqlQuery .= " where convert(char(10),‰ÁH’À“`•[“ú•t,111)+’S“–ŽÒƒR[ƒh < '{$VAL->StartKey}'";
$SqlQuery .= " order by ‰ÁH’À“`•[“ú•t desc,’S“–ŽÒƒR[ƒh desc";
$SQL->Query( $SqlQuery );
// “Ç‚Ý”ò‚΂µ
for ( $i = 0; $i < $VAL->LineMax; $i++ ) {
if ( FALSE == $SQL->Fetch() ) {
break;
}
if ( $i == 0 ) {
$VAL->EndKey = $SQL->Field[7];
}
$VAL->StartKey = $SQL->Field[7];
}
$SQL->Free();
F_LoadDataInit( $SQL, $VAL );
}
?>
| |
|
|
ƒf[ƒ^ƒx[ƒXƒNƒ‰ƒX (db.php) |
|
|
<?
OutCr( "<!--db.php-->" );
# *****************************************************************************
# ƒf[ƒ^ƒx[ƒXƒNƒ‰ƒX
# *****************************************************************************
class DB {
var $Connect;
var $Result;
var $Field;
var $Cols;
var $Rows;
# *********************************************************
# ƒRƒ“ƒXƒgƒ‰ƒNƒ^
# *********************************************************
function DB( $Server, $DbName, $User, $Password ) {
$this->Connect = mssql_connect( $Server, $User, $Password );
mssql_select_db( $DbName, $this->Connect );
$this->Cols = 0;
$this->Rows = 0;
}
# *********************************************************
# ƒNƒGƒŠ[
# *********************************************************
function Query( $SqlQuery ) {
$this->Result = mssql_query( $SqlQuery, $this->Connect );
if ( $this->Result == FALSE ) {
$this->Cols = 0;
$this->Rows = 0;
}
else {
$this->Cols = mssql_num_fields( $this->Result );
$this->Rows = mssql_num_rows( $this->Result );
}
return $this->Result;
}
# *********************************************************
# SQLŽÀs
# *********************************************************
function Execute( $Sql ) {
mssql_query( $Sql, $this->Connect );
}
# *********************************************************
# ƒtƒFƒbƒ`
# *********************************************************
function Fetch( ) {
$this->Field = mssql_fetch_array( $this->Result );
return $this->Field;
}
# *********************************************************
# ƒtƒB[ƒ‹ƒh–¼
# *********************************************************
function FieldName( $i ) {
return mssql_field_name( $this->Result, $i );
}
# *********************************************************
# ŠJ•ú
# *********************************************************
function Free( ) {
mssql_free_result( $this->Result );
}
# *********************************************************
# Ú‘±‰ðœ
# *********************************************************
function Close( ) {
mssql_close( $this->Connect );
}
}
?>
| |
|
|
|
|
<?
OutCr( "<!--loadblk.php-->" );
# ****************************************************************************************
# HEAD ’è‹`‚̃[ƒh
# ****************************************************************************************
function LoadHead( $Title, $Css ) {
OutCr( "<HEAD>" );
OutCr( "<TITLE>{$Title}</TITLE>" );
if ( $Css != "" ) {
OutCr( "<style type=\"text/css\">" );
require_once( $Css );
OutCr( "</style>" );
}
OutCr( "</HEAD>" );
}
# ****************************************************************************************
# BODY ’è‹`‚̃[ƒh
# ****************************************************************************************
function LoadBody( $Option ) {
if ( $Option == "" ) {
OutCr( "<BODY>" );
}
else {
OutCr( "<BODY $Option>" );
}
}
# ****************************************************************************************
# FORM ’è‹`‚̃[ƒh
# ****************************************************************************************
function LoadForm( $FormName, $Option ) {
global $HTTP_ENV_VARS;
OutCr( "<FORM method=post action=\"{$HTTP_ENV_VARS["SCRIPT_NAME"]}\" name=$FormName $Option>" );
}
?>
| |
|
|
|
|
<?
echo <<<CSS
body { background-color:#c0c0c0 }
h1 {color:#0000ff;font-size:26;font-family:Verdana,"‚l‚r ‚oƒSƒVƒbƒN";}
th {color:#ffffff;font-size:14;font-family:Verdana,"‚l‚r ‚oƒSƒVƒbƒN";
background-color:#0077cc;text-align:center;}
td {color:#000000;font-size:12;font-family:Verdana,"‚l‚r ‚oƒSƒVƒbƒN";
background-color:#ffffff;}
CSS;
?>
| |
|
|
|
|
<?
#$Common_dir = "\\localweb\\php\\require\\";
#$Form_name = "frmMain";
#require( $Common_dir . "std.php" );
#LoadHead( "", $Common_dir . "css.php" );
#LoadBody( "" );
#LoadForm( Dd( $Form_name ), "" );
echo <<<MAIN
<center>
<h1>‰ÁH’À“`•[</h1>
<table border=1 cellpadding=5>
<tr>
<th>“`•[“ú•t</th>
<th>’S“–ŽÒ</th>
<th>‹àŠzŒv</th>
<th>“àÅŒv</th>
<th>ŠOÅŒv</th>
<th>¿‹“ú</th>
<th>“E—v</th>
</tr>
<!-- row:1 -->
<tr>
<td>{$VAL->dtDen[0]} </td>
<td>{$VAL->strTanto[0]} </td>
<td align=right> {$VAL->nKin[0]}</td>
<td align=right> {$VAL->nNai[0]}</td>
<td align=right> {$VAL->nGai[0]}</td>
<td>{$VAL->dtSei[0]} </td>
<td>{$VAL->strBiko[0]} </td>
</tr>
<!-- row:2 -->
<tr>
<td>{$VAL->dtDen[1]} </td>
<td>{$VAL->strTanto[1]} </td>
<td align=right> {$VAL->nKin[1]}</td>
<td align=right> {$VAL->nNai[1]}</td>
<td align=right> {$VAL->nGai[1]}</td>
<td>{$VAL->dtSei[1]} </td>
<td>{$VAL->strBiko[1]} </td>
</tr>
<!-- row:3 -->
<tr>
<td>{$VAL->dtDen[2]} </td>
<td>{$VAL->strTanto[2]} </td>
<td align=right> {$VAL->nKin[2]}</td>
<td align=right> {$VAL->nNai[2]}</td>
<td align=right> {$VAL->nGai[2]}</td>
<td>{$VAL->dtSei[2]} </td>
<td>{$VAL->strBiko[2]} </td>
</tr>
<!-- row:4 -->
<tr>
<td>{$VAL->dtDen[3]} </td>
<td>{$VAL->strTanto[3]} </td>
<td align=right> {$VAL->nKin[3]}</td>
<td align=right> {$VAL->nNai[3]}</td>
<td align=right> {$VAL->nGai[3]}</td>
<td>{$VAL->dtSei[3]} </td>
<td>{$VAL->strBiko[3]} </td>
</tr>
<!-- row:5 -->
<tr>
<td>{$VAL->dtDen[4]} </td>
<td>{$VAL->strTanto[4]} </td>
<td align=right> {$VAL->nKin[4]}</td>
<td align=right> {$VAL->nNai[4]}</td>
<td align=right> {$VAL->nGai[4]}</td>
<td>{$VAL->dtSei[4]} </td>
<td>{$VAL->strBiko[4]} </td>
</tr>
</table>
<br>
<table border=0>
<tr>
<td>
<input type="submit" name="cmd_send" value="Previous" style="width:80px">
</td>
<td>
<input type="submit" name="cmd_send" value="Next" style="width:80px">
</td>
</tr>
</table>
<br>
StartKey <input type="text" name="start_key" value="$VAL->StartKey"><br>
EndKey <input type="text" name="end_key" value="$VAL->EndKey">
</FORM>
</BODY>
</HTML>
MAIN;
?>
| |
|
|
|