File: C:/xampp/htdocs/FograPC4/Rank.php
<?php
$company="ecolor";
echo "Welcome! ".$company;
error_reporting(0);
/*
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
?>
<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;">0%</td>
<td style="width:50px;">50%</td>
<td style="width:50px;">100%</td>
<td style="width:50px;">版</td>
<td style="width:50px;">cmmt</td>
</font>
</tr>
</tbody>
</table>
<?php
//error_reporting(0);
$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;
?>
<td><a href="Rank.php?order=id">By id::</a></td>
<td><a href="Rank.php?order=plate">By plate::</a></td>
<td><a href="trendchart.php?plate=C">C版趨勢圖::</a></td>
<td><a href="trendchart.php?plate=M">M版趨勢圖::</a></td>
<td><a href="trendchart.php?plate=Y">Y版趨勢圖::</a></td>
<td><a href="trendchart.php?plate=K">K版趨勢圖</a></td>
<?php
//date_default_timezone_set("Asis/Taipei");
$connection = mysql_connect("127.0.0.1", "root", "fredsql") or die ("Unable to connect!");
mysql_query("SET NAMES 'utf8'");
$db = "tvicheck-st";
mysql_select_db($db) or die ("Unable to select database!");
// generate and execute query
if ($order=='plate') {
$query = "SELECT * from plate where company='$company' order by plate, id desc";}
else {
$query = "SELECT * from plate where company='$company' 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;"><?php echo round($row->a0,2); ?> </td>
<td style="width:50px;"><font color='<?php if ($dva50>0.75) {echo "red";} else {echo "black";}?>'> <?php echo round($row->a50,2); ?> </td>
<td style="width:50px;"><?php echo round($row->a100,2); ?> </td>
<td style="width:50px;"><?php echo $row->plate; ?> </td>
<td style="width:80px;"><?php echo $row->cmmt; ?> </td>
<td style="width:50px;"><a href="delete.php?id=<?php echo $row->id;?>">delete</a> </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>