<html>
<head>
<title>ÈÖ¸®¸®°¡°èºÎ</title>
</head>
<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<?
// ÆÄÀÏ ¸í: ga.php
// °¡°èºÎ ¸µÅ© http://selfserver/ga.php?mode=write
function box($message) {
echo ( " <script> window.alert('$message'); history.go(-1)</script>");
exit;
}
function gbox() {
echo ("<meta http-equiv='Refresh' content='0; URL=$PHP_SELF?mode=write'>");
exit;
}
$USER="stone; // mysql user¼¼ÆÃ
$PASS="stone"; // mysql password¼¼ÆÃ
$DB="stone"; // mysql db ¼¼ÆÃ
$connect=mysql_connect( "localhost", "$USER", "$PASS") or die( " SQL server¿¡
¿¬°áÇÒ ¼ö ¾ø½À´Ï´Ù.");
mysql_select_db("$DB",$connect);
if(!$mode) {
$query="select num,pum,won,daytime from ga order by num desc";
$result=mysql_query($query,$connect);
$row=mysql_fetch_array($result);
$total = mysql_affected_rows();
$tot=0;
for($i=0;$i<$total;$i++) {
mysql_data_seek($result,$i);
$row=mysql_fetch_array($result);
$tot=$tot+$row[won];
echo "
<table border='2' width='475' bordercolor='silver'>
<tr>
<td><font size=2 color=blue>$row[pum]</font></td>
<td><font size=2 color=red>$row[won]</font></td>
<td><font size=2 color=black>$row[daytime]</font></td>
<td><font size=2 color=red>$tot</font></td>
</tr>
</table> ";
}
}
if($mode=='write') {
$year=date("Y");
$mon=date("m");
$day=date("d");
$hour=date("H");
$min=date("i");
$a=$year."³â ".$mon."¿ù ".$day."ÀÏ ".$hour."½Ã ".$min."ºÐ";
echo "
<form method=post action=$PHP_SELF>
<input type=hidden name=mode value=write_ok>
<input type=hidden name=daytime value='$a'>
<table border='20' width='475' bordercolor='teal'>
<tr>
<td align=center><input type=text name='pum' ></td>
<td align=center><input type=text name='won' ></td>
</tr>
<tr>
<td align=center>$a</td>
<td align=center><input type='submit' value='µ·³Ö¾î'>
</td>
</tr>
</table>
</form>
";
$query="select num,pum,won,daytime from ga order by num desc";
$result=mysql_query($query,$connect);
$row=mysql_fetch_array($result);
$total = mysql_affected_rows();
$tot=0;
for($i=0;$i<$total;$i++) {
mysql_data_seek($result,$i);
$row=mysql_fetch_array($result);
$tot=$tot+$row[won];
echo "
<table border='2' width='475' bordercolor='silver'>
<tr>
<td><font size=2 color=blue>$row[pum]</font></td>
<td><font size=2 color=red>$row[won]</font></td>
<td><font size=2 color=black>$row[daytime]</font></td>
<td><font size=2 color=red>$tot</font></td>
</tr>
</table> ";
}
}
if($mode=='write_ok') {
$query="insert into ga values('','$pum','$won',now())";
$result= mysql_query($query, $connect);
if($result>0) {
gbox();
}
else {
$message="DB ERROR";
box($message);
}
}
?>
</body>
</html>
|