File: C:/xampp/htdocs/FograPlate/Rank.php
<?php
//session_start();
?>
<?php
/*
All source code copyright and proprietary Melonfire, 2002. All content, brand names and trademarks copyright and proprietary Melonfire, 2002. All rights reserved. Copyright infringement is a violation of law.
This source code is provided with NO WARRANTY WHATSOEVER. It is produced and meant for illustrative purposes only, and is NOT recommended for use in production environments.
Read more articles like this one at http://www.melonfire.com/community/columns/trog/ and http://www.melonfire.com/
*/
// add.php - add a new press release
if ($_POST['date_s']<>'') {
$date_s= $_POST['date_s'];
$date_e= date ("Y-m-d",strtotime($_POST['date_e'])+86400);
echo $date_s."-".$date_e;}
else {
$date_s=$_GET['date_s'];
$date_e=$_GET['date_e'];
echo $date_s."-".$date_e;}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>CTP report</title>
<style type="text/css">
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
</style>
<script src="../../SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="../../SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css">
<style type="text/css">
body,td,th {
font-size: 12px;
}
</style>
<basefont face="Verdana">
</head>
<body vlink="#0000FF">
<!-- standard page header begins -->
<a name="DETAILS"></a>
<table width="100%" cellspacing="0" cellpadding="5">
<tr>
<td></td>
</tr>
<tr>
<td bgcolor="Navy"><font size="-1" color="White"><b> CTP report : List</b></font></td>
</tr>
</table>
<!-- standard page header ends -->
<p>
<table style="width=:100%; text-align:left;" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<font size="-1">
<td style="width:50px;">id</td>
<td style="width:150px;">日期</td>
<td style="width:50px;">50%</td>
<td style="width:50px;">25%</td>
<td style="width:50px;">版</td>
</font>
</tr>
</tbody>
</table>
<?php
error_reporting(0);
$host="127.0.0.1";
$user="root";
$pass="fredsql";
$db = "tvicheck-st";
$order= $_GET['order'];
$C50=45.85;
$C25=21;
$M50=43.65;
$M25=19.4;
$Y50=41.8;
$Y25=17.4;
$K50=47;
$K25=20.35;
?>
<table>
<tr>
<td><a href="RankF.php?order=id&date_s=<?php echo $date_s."&date_e=".$date_e;?>">By id::</a></td>
<td><a href="RankF.php?order=plate&date_s=<?php echo $date_s."&date_e=".$date_e;?>">By plate::</a></td>
<td><a href="trendchartF.php?plate=C&date_s=<?php echo $date_s."&date_e=".$date_e;?>">C版趨勢圖::</a></td>
<td><a href="trendchartF.php?plate=M&date_s=<?php echo $date_s."&date_e=".$date_e;?>">M版趨勢圖::</a></td>
<td><a href="trendchartF.php?plate=Y&date_s=<?php echo $date_s."&date_e=".$date_e;?>">Y版趨勢圖::</a></td>
<td><a href="trendchartF.php?plate=K&date_s=<?php echo $date_s."&date_e=".$date_e;?>">K版趨勢圖</a></td>
</tr>
<tr>
<td bgcolor="#56FFFF"><?php echo "C50=".$C50."::";?></td>
<td bgcolor="#56FFFF"><?php echo "C25=".$C25."::";?></td>
<td bgcolor="#FFA0FF"><?php echo "M50=".$M50."::";?></td>
<td bgcolor="#FFA0FF"><?php echo "M25=".$M25."::";?></td>
<td bgcolor="#FFFF9E"><?php echo "Y50=".$Y50."::";?></td>
<td bgcolor="#FFFF9E"><?php echo "Y25=".$Y25."::";?></td>
<td bgcolor="#CCCCCC"><?php echo "K50=".$K50."::";?></td>
<td bgcolor="#CCCCCC"><?php echo "K25=".$K25."::";?></td>
</tr>
</table>
<?php
date_default_timezone_set("Asis/Taipei");
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
mysql_query("SET NAMES 'utf8'");
//$link = mssql_connect("MACBOOK7", "sa", "fred5697");
mysql_select_db($db) or die ("Unable to select database!");
// generate and execute query
if ($order=='plate') {
$query = "SELECT * from plate where ddate between '$date_s' and '$date_e' order by plate, id desc";}
else {
$query = "SELECT * from plate where ddate between '$date_s' and '$date_e' order by id desc ";}
//echo $query;
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
// if records present
// iterate iii through resultset
// print title with links to edit and delete scripts
while($row = mysql_fetch_object($result))
{
if ($row->plate=='C') {
$dva50=abs($row->a50-$C50);
$dva25=abs($row->a25-$C25);
$dvb50=abs($row->b50-$C50);
$dvb25=abs($row->b25-$C25);}
elseif ($row->plate=='M') {
$dva50=abs($row->a50-$M50);
$dva25=abs($row->a25-$M25);
$dvb50=abs($row->b50-$M50);
$dvb25=abs($row->b25-$M25);}
elseif ($row->plate=='Y') {
$dva50=abs($row->a50-$Y50);
$dva25=abs($row->a25-$Y25);
$dvb50=abs($row->b50-$Y50);
$dvb25=abs($row->b25-$Y25);}
elseif ($row->plate=='K') {
$dva50=abs($row->a50-$K50);
$dva25=abs($row->a25-$K25);
$dvb50=abs($row->b50-$K50);
$dvb25=abs($row->b25-$K25);}
$cFont=$row->plate;
//echo "cfont:".$cFont;
if ($cFont=='C') {
$colorF="#56FFFF";}
elseif ($cFont=='M') {
$colorF="#FFA0FF";}
elseif ($cFont=='Y') {
$colorF="#FFFF9E";}
elseif ($cFont=='K') {
$colorF="#CCCCCC";}
?>
<table style="width=:100%; text-align:left;" cellspacing="0" cellpadding="5">
<tbody>
<tr bgcolor="<?php echo $colorF;?>">
<td style="width:50px;"><?php echo $row->id; ?> </td>
<td style="width:150px;"><?php echo $row->dDate; ?> </td>
<td style="width:50px;"><font color='<?php if ($dva50>0.75) {echo "red";} else {echo "black";}?>'> <?php echo $row->a50; ?> </td>
<td style="width:50px;"><font color='<?php if ($dva25>0.75) {echo "red";} else {echo "black";}?>'> <?php echo $row->a25; ?> </td>
<td style="width:50px;"><font color='<?php if ($dvb50>0.75) {echo "red";} else {echo "black";}?>'><?php echo $row->b50; ?> </td>
<td style="width:50px;"><font color='<?php if ($dvb25>0.75) {echo "red";} else {echo "black";}?>'><?php echo $row->b25; ?> </td>
<td style="width:50px;"><?php echo $row->plate; ?> </td>
</tr>
</tbody>
</table>
<p>
<?php
}
mysql_close($connection);
?>
<!-- standard page footer begins -->
<p>
<table width="100%" cellspacing="0" cellpadding="5">
<tr>
<td align="center"><font size="-2">Everything here is copyright © <a href="http://www.fredkuo.idv.tw/wordpress/">Fred Kuo</a>, 2016. All rights reserved.<br> <a href="http://www.fredkuo.idv.tw/wordpress/?tag=fogra">Read more.</a></td>
</tr>
</table>
<!-- standard page footer ends -->
<script type="text/javascript">
var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgDown:"../../SpryAssets/SpryMenuBarDownHover.gif", imgRight:"../../SpryAssets/SpryMenuBarRightHover.gif"});
</script>
</body>
</html>