Location: PHPKode > projects > Shift Log > shiftlog_stable_1.9.4/shiftlog/includes/display_data.php
<?PHP
#############################################################################
#  This file is part of Shiftlog.											#
#																			#
#    Shiftlog is free software; you can redistribute it and/or modify		#
#    it under the terms of the GNU General Public License as published by	#
#    the Free Software Foundation; either version 3 of the License, or		#
#    (at your option) any later version.									#
#																			#
#    Shiftlog is distributed in the hope that it will be useful,			#
#    but WITHOUT ANY WARRANTY; without even the implied warranty of			#
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the			#
#    GNU General Public License for more details.							#
#																			#
#    You should have received a copy of the GNU General Public License		#
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.	#
#############################################################################

	if(isset($_POST['dis_change']))
		{
		$last = $_POST['days'];
		}
	elseif(isset($_POST['3_review']))
		{
		$last = 259200;
		}
	elseif(isset($_POST['5_review']))
		{
		$last = 432000;
		}
	elseif(isset($_POST['7_review']))
		{
		$last = 604800;
		}
	elseif(isset($_POST['14_review']))
		{
		$last = 1209600;
		}
		else
		{
	$last = 86400;
		}
		
	$dateu = date("U");  //This lists the seconds that have psssed since 1 Jan, 1970. Basicly a unix time stamp.
	$track = $dateu - $last;
	$conn;		
	$query="SELECT * FROM data WHERE track BETWEEN '$track' AND '$dateu' ORDER BY log_id  DESC";
	$result=mysql_query($query);
	mysql_close();
	echo "<b><center>";
	// Change the table title depending on the selection
			if($last == 259200)
				{
				echo "Entries Over The Past 3 Days";
				}
			elseif($last == 432000)
				{
				echo "Entries Over The Past 5 Days";
				}
			elseif($last == 604800)
				{
				echo "Entries Over The Past Week";
				}
			elseif($last == 1209600)
				{
				echo "Entries Over The Past Two Weeks";
				}
				else
				{			
				echo "Entries Over The Past 24hrs";
				}
	echo "</center></b>";
 	if (mysql_num_rows($result) > 0) 
		{
   		echo'<table bgcolor="#000000" align="center" width="80%"  border="0" cellpadding="4" cellspacing="0" id="display">';
   		while ($row = mysql_fetch_assoc($result)) 
			{
    		    		print("</tr><tr>");
    		if($color == "#D8DBFE") 
				{
    			$color = "#A6ACFD";
    			} 
				else
				{
				$color = "#D8DBFE";
    			}
				echo "<tr>";
    			print("<td colspan=\"3\" align=\"left\" bgcolor=\"#FFFFFF\">&nbsp;</td>");
  				echo "</tr>";
				echo "<tr>";
				print("<td colspan=\"3\" align=\"center\" bgcolor=\"$color\"><strong>{$row['cat_name']} &nbsp;&nbsp;{$row['sub_name']}</strong></td>");
				echo "</tr>";
				echo "<tr>";
  				print("<td align=\"left\" bgcolor=\"$color\">Date:&nbsp;<strong>{$row['date']}</strong></td>");
				echo "<td bgcolor=\"$color\"></td>";
    			print("<td align=\"right\" bgcolor=\"$color\">Time:&nbsp;<strong>{$row['time']}</strong></td>");
  				echo "</tr><tr></tr>";
  				print("<td colspan=\"3\" align=\"left\" bgcolor=\"$color\"><br />{$row['data']}</td>");
  				echo "</tr>";
  				echo "<tr>";
				print("<td colspan=\"3\" align=\"right\" bgcolor=\"$color\"><br /><p>&nbsp;<strong>{$row['user']} </strong>&nbsp;</p>");
				echo "</td>";
				echo "</tr>";
				}
   			echo '</table>';
			echo '<br />';
		}else
		{
	   	echo 'There have been no new posts in the last 24hrs.';
		}
?>
Return current item: Shift Log