<!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>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<meta http-equiv="refresh" content="90;URL=" />
<title>Untitled Document</title>
<SCRIPT src="swfobject.js"  type=text/javascript></SCRIPT>

<style type="text/css">
<!--
.style1 {color: #FF0000}
.style3 {color: #FF0000; font-size: 12px; }
.style4 {font-weight: bold}
.style5 {
	font-weight: bold;
	font-size: 14px;
}
.style14 {font-size: 14px}
.style18 {color: #FF0000; font-size: 14px; font-weight: bold; }
.style19 {font-weight: bold}
.style23 {font-size: 14px; color: #663300; font-weight: bold; }
.style24 {color: #000000; font-family: "MS Sans Serif", Arial, Tahoma; font-size: 14px; font-weight: bold; }
.style25 {	font-family: "MS Sans Serif", Arial, Tahoma;
	font-size: 24px;
	color: #003399;
}
.style26 {
	color: #FF9900;
	font-size: 12px;
}
.style28 {color: #663300}
a:link {
	color: #FF9900;
}
a:visited {
	color: #CC3300;
}
a:hover {
	color: #FF6633;
}
a:active {
	color: #CC6633;
}
-->
</style>
</head>

<body>
<table width="220" cellpadding="0" cellspacing="0">
  <tr>
    <td align="left">
      <table cellpadding="0" cellspacing="0">
        <tr>
          <td align="left" valign="top"><img src="images/space.gif" width="5" height="10" /></td>
          <td  valign="top"><img src="images/space.gif" width="5" height="5" /></td>
          <td  valign="top"><img src="images/space.gif" width="5" height="5" /></td>
        </tr>
        <tr>
		          <td width="10" align="left" valign="top">&nbsp;</td>

          <td  valign="top">            <?php

$d=date("Y-m-d",strtotime("-1 week"));  		
$sd=date(" D, d/M/Y     H:i:s");


$user="cp037684_tbadm";
$password="siamnovaTho1220!";
$database="cp037684_tbadm";



mysql_connect('localhost',$user,$password);
@mysql_select_db($database) or die( "Unable to select database");


														
$query="SELECT * FROM goldprice   ORDER BY date  DESC, time DESC LIMIT 2"; //
$result=mysql_query($query);

//$num=mysql_numrows($result);
$num=1;

mysql_close();

$i=0;

$date2 =$date;

$id=mysql_result($result,$i,"id");
$date=mysql_result($result,$i,"date");
$time=mysql_result($result,$i,"time");
$b96sb=mysql_result($result,$i,"b96sb");
$b96bb =mysql_result($result,$i,"b96bb");
$o96bg =mysql_result($result,$i,"o96bg");
$o96sb=mysql_result($result,$i,"o96sb");
$o96bb=mysql_result($result,$i,"o96bb");
$g90bg=$o96bg*.9;
$g90sb=$g90bg*15.16;
$g40bg=round($o96bg*.35);
$g40sb=$g40bg*15.16;

$dateshow=date("d/m/Y",strtotime($date));
$dd=date("w",strtotime($date));

                  $p_old =mysql_result($result,($i+1),"b96bb");
				  $diff=$b96bb-$p_old ;
			      $err=0;

$nd=date("w ") ;
switch ($nd)
{
case 0 :
$bgc="images/bg_red";
$nday="อาทิตย์";
$fc="c00000";
break;  
case 1:
$bgc="images/bg_yel";
$nday="จันทร์";
$fc="#FF9900";
break;
case 2:
$bgc="images/bg_pink";
$nday="อังคาร";
$fc="f20be4";
break;
case 3:
$bgc="images/bg_gre";
$nday="พุธ";
$fc="008800";
break;
case 4:
$bgc="images/bg_ora";
$nday="พฤหัสบดี";
$fc="FF6600";
break;
case 5:
$bgc="images/bg_blue";
$nday="วันศุกร์";
$fc="000088";
break;
case 6:
$bgc="images/bg_vio";
$nday="เสาร์";
$fc="008888";
break;
default:
$bgc="images/bg_whi";
$fc="000000";

}

switch ($dd)
{
case 0;
$nday="อาทิตย์";
break;  
case 1:
$nday="จันทร์";
break;
case 2:
$nday="อังคาร";
break;
case 3:
$nday="พุธ";
break;
case 4:
$nday="พฤหัสบดี";
break;
case 5:
$nday="วันศุกร์";
break;
case 6:
$nday="เสาร์";
break;
default:
$bgc="images/bg_whi";
$fc="000000";

}


     $dbuf=date("d");
	 $d1=sprintf("%02d", $dbuf);
	 $d0=date("D");
	 $yb=date("y")+43;
	 $y1=sprintf("%02d", $yb);
	 $mb = date("m");
	 $m=sprintf("m%d", $mb);
	 
	 $d11=$d1[0]*10;
	 $d10=$d1[1];
	 
	  	 
	 $sBuf=round($b96bb ); 
	 $sB=sprintf("%05d", $sBuf);

	 $sBuf=round( $b96sb);
	 $bB=sprintf("%05d", $sBuf);
	 
	  if($y1[1] ==1) $y11="01";
	 

		  if($diff==0)
		         {
				       $arr="price_eq.swf";
				       $cp="#0000ff";
				 }
		  if($diff>0)
		         {
  		  				$arr="price_up.swf";
				       $cp="#00ff00";						
		          }
		  if($diff<0)
		         {
  		  				$arr="price_dw.swf";
				       $cp="#ff0000";
						
				}		
?>
		        <DIV align="center" id=flashContent2></DIV>

<span class="style19"><strong>
            <?php 
 echo "<font color=$fc  size=2>$nday $dateshow<br>เวลา$time</font ><br>" ; 
																												 ?>
          </strong></span>     
          <SCRIPT type=text/javascript>
			var so = new SWFObject("<?php echo $arr  ?>", "flash", "130", "25", "8", "#ffffff");
			so.addParam("allowscriptaccess", "always");
			so.addParam("wmode", "transparent");
			so.write("flashContent2");
			</SCRIPT></td>

          <td  valign="top"><?php echo "<font color=$cp  size=5><strong> $diff</strong></font>"  ?></td>
        </tr>
      </table>
       </span><span class="style3"><span class="style5">&nbsp;&nbsp;&nbsp;<span class="style28">ทองคำแท่ง 96.5%</span></span><br />
          </span>
      <table width="100%" border="0" cellspacing="2" cellpadding="0">
        <tr>
          <td width="5%">&nbsp;</td>
          <td width="39%" class="style14 style1 style19"><strong>ซื้อบาทละ</strong></td>
          <td width="36%" align="right" class="style18"><?php echo $b96bb ?></td>
          <td width="20%" class="style14 style1"><strong>&nbsp;บาท</strong></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td class="style14 style1"><strong>ขายบาทละ</strong></td>
          <td align="right"><strong><span class="style18"><?php echo $b96sb ?></span></strong></td>
          <td class="style14 style1"><strong>&nbsp;บาท</strong></td>
        </tr>
      </table>
       <span class="style23"><span class="style5">&nbsp;&nbsp;&nbsp;</span>ทองรูปพรรณ 96.5%</span><span class="style3"><br />
        </span>
      <table width="100%" border="0" cellspacing="2" cellpadding="0">
        <tr>
          <td width="5%">&nbsp;</td>
          <td width="39%" class="style18">ซื้อบาทละ</td>
          <td width="36%" align="right" class="style18"><?php echo $o96bb ?></td>
          <td width="20%" class="style18">&nbsp;บาท</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td class="style18">ซื้อกรัมละ</td>
          <td align="right" class="style18"><?php echo $o96bg ?></td>
          <td class="style18">&nbsp;บาท</td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td><div align="center"><span class="style26"><a href="http://thongbai.com" target="_blank">ห้างขายทองทองใบเยาวราช</a> </span></div></td>
  </tr>
</table>
</body>
</html>
