";
return;
}
if (empty($_GET["fDateName"]))
{
echo "Please give the date name. ";
return;
}
if (empty($_GET["fIdx"]))
{
echo "Please give the idx. ";
return;
}
if (empty($_GET["fDateValuePrev"]))
$_GET["fDateValuePrev"]="";
if (empty($_GET["fStatusDate"]))
$_GET["fStatusDate"]="";
include("db.php");
$db_id = mysql_pconnect($host, $user, $pw);
if ($db_id==FALSE)
{
printf("mysql_connect returned the following error: %s\n", mysql_error());
die("");
}
mysql_select_db($db);
if (strcmp("year",$_GET["fDateName"])==0)
{
$identifier1="";
$identifier2="Y";
$datename="YYYY";
$newdatename="month";
if (strcmp($_GET["fDateValue"],"empty")==0)
$_GET["fDateValue"]="all";
if (strcmp($_GET["fDateValuePrev"],"empty")==0)
$_GET["fDateValuePrev"]="all";
}
if (strcmp("month",$_GET["fDateName"])==0)
{
$identifier1="%Y";
$identifier2="m";
$datename="MM";
$newdatename="day";
}
if (strcmp("day",$_GET["fDateName"])==0)
{
$identifier1="%Y-%m";
$identifier2="d";
$datename="DD";
$newdatename="hour";
}
if (strcmp("hour",$_GET["fDateName"])==0)
{
$identifier1="%Y-%m-%d";
$identifier2="H";
$datename="hh";
$newdatename="min";
}
if (strcmp("min",$_GET["fDateName"])==0)
{
$identifier1="%Y-%m-%d %H";
$identifier2="i";
$datename="mm";
$newdatename="sec";
}
if (strcmp("sec",$_GET["fDateName"])==0)
{
$identifier1="%Y-%m-%d %H:%i";
$identifier2="s";
$datename="ss";
$newdatename="";
}
if (strcmp($_GET["fDateValuePrev"],"empty")!=0)
{
$query0 ="SELECT ";
$query0.=" Date_Format(fValidFrom, '%". $identifier2."') as valid ";
$query0.=" FROM History ";
if (empty($identifier1))
$query0.=" WHERE NOT fValidFrom='0000-00-00 00:00:00' ";
else
$query0.=" WHERE Date_Format(fValidFrom, '". $identifier1."')='".$_GET["fStatusDate"]."'";
//$query0.=" WHERE Date_Format(fValidFrom, '%". $identifier1."')=".$_GET["fDateValuePrev"];
$query0.=" GROUP BY valid";
$result0=mysql_query($query0, $db_id);
}
//echo $query0;
if (empty($newdatename))
printf("