//account $account_id = $_SESSION['account_id']; $account_username = $_SESSION['account_username']; $account_name = $_SESSION['account_name']; $account_type = $_SESSION['account_type']; $account_timezone = $_SESSION['account_timezone']; $account_timezone_mysql = $_SESSION['account_timezone_mysql']; if($account_id=='') return; //database include('database.php'); $gpsmap = $_REQUEST['gpsmap']; $datetime = $_REQUEST['datetime']; //current picture $currentsql = "SELECT gpsid,gpstype,DATE_FORMAT(datetime,'%Y%m%d_%H%i%s') as datetimestr,DATE_FORMAT(datetime,'%Y%m') as datestr,DATE_FORMAT(datetime,'%Y-%m-%d %H:%i:%s') as datetimestr2 FROM alarm WHERE gpsmap={$gpsmap} AND channel=12 AND state=2 AND datetime='{$datetime}' "; $currentresult = mysqli_query($link, $currentsql); $currentrow = mysqli_fetch_assoc($currentresult); //previos picture $prevoissql = "SELECT gpsid,gpstype,DATE_FORMAT(datetime,'%Y%m%d_%H%i%s') as datetimestr,DATE_FORMAT(datetime,'%Y%m') as datestr,DATE_FORMAT(datetime,'%Y-%m-%d %H:%i:%s') as datetimestr2 FROM alarm WHERE gpsmap={$gpsmap} AND channel=12 AND state=2 AND datetime<'{$datetime}' ORDER BY datetime DESC LIMIT 1 "; $previosresult = mysqli_query($link, $prevoissql); $previosrow = mysqli_fetch_assoc($previosresult); //next picture $nextsql = "SELECT gpsid,gpstype,DATE_FORMAT(datetime,'%Y%m%d_%H%i%s') as datetimestr,DATE_FORMAT(datetime,'%Y%m') as datestr,DATE_FORMAT(datetime,'%Y-%m-%d %H:%i:%s') as datetimestr2 FROM alarm WHERE gpsmap={$gpsmap} AND channel=12 AND state=2 AND datetime>'{$datetime}' ORDER BY DATETIME ASC LIMIT 1 "; $nextresult = mysqli_query($link, $nextsql); $nextrow = mysqli_fetch_assoc($nextresult); mysqli_close($link); if($currentrow==null) return; $current_gpsid = $currentrow['gpsid']; $current_gpstype = strtoupper($currentrow['gpstype']); $current_datetimestr = $currentrow['datetimestr']; $current_datestr = $currentrow['datestr']; $current_datetimestr2 = $currentrow['datetimestr2']; $imagepath = "snapshot.php?gpstype={$current_gpstype}&gpsid={$current_gpsid}&datetimestr={$current_datetimestr}"; echo "
";
echo " | ";
if($previosrow!=null)
{
$previos_datetimestr2 = $previosrow['datetimestr2'];
echo " [prevois]"; } if($nextrow!=null) { $next_datetimestr2 = $nextrow['datetimestr2']; echo " [next]"; } echo " |