<?php
if (file_exists("embedded/functions/site_functions.php"))
	{
	include_once("embedded/functions/site_functions.php");
	}
else
	{
include_once("../../embedded/functions/site_functions.php");
	}
$device_id=$_SESSION['device_id'];
$language=$_SESSION['language'];
if ($language==1)
	{
	$title1="Τελευταία ενημέρωση μετρήσεων";
	$title2="θερμοκρασία";
	$title3="υγρασία";
	$title4="έδαφος";
	$title5="φωτισμός";
	$title6="αέρας";
	$title7="νερό";
	$title8="φως";
	}
else	
	{
	$title1="Last Measurements";
	$title2="temperature";
	$title3="humidity";
	$title4="soil moisture";
	$title5="indoor light";
	$title6="fan";
	$title7="water";
	$title8="light";
	}
//inputs
db_open();
$a=last_data($device_id);
db_close();
//inputs
$T= $a[0];
$H= $a[1];
$M= $a[2];
$IL= $a[3];
//outputs-actions
$F=$a[4];
$L=$a[5];
$V=$a[6];
$time = $a[7];

if ($F == '1') 
{
$F="ON";
}
else if ($F == '0')
{
$F="OFF";
}

if ($L == '1') 
{
$L="ON";
}
else if ($L == '0')
{
$L="OFF";
}

if ($V == '1') 
{
$V="ON";
}
else if ($V == '0')
{
$V="OFF";
}


echo <<<F
<table id='table_footer'>
<tr>
<td title='time' class="td1"><a class="sensor_footer" title="$title1">$time</a></td>
<td title="$title2" class="tdn">
<img src='css/images/temperature.png' alt='t' ></img>:<a class="sensor_footer">$T</a>C|</td>
<td title="$title3" class="tdn">
<img src='css/images/humidity.png' alt='h'></img>:<a class="sensor_footer">$H</a>%|</td>
<td title="$title4" class="tdn"> 
<img src='css/images/somo.png' alt='s' class="lefttt3"></img>:<a class="sensor_footer">$M</a>|</td>
<td title="$title5" class="tdn">
<img src='css/images/inli.png' alt='i' class="lefttt1"></img>:<a class="sensor_footer">$IL</a>|</td>
<td title="$title6" class="tdn">
<img src='css/images/fan.png' alt='fan' class="lefttt1"></img>:<i>$F</i>|</td>
<td title="$title7" class="tdn">
<img src='css/images/water.png' alt='water' class="lefttt2"></img>:<i>$V</i>|</td>
<td title="$title8" class="tdn">
<img src='css/images/light.png' alt='light' class="lefttt2"></img>:<i>$L</i></td>
</tr>
</table>
F;

?>