// Always call session start before anything else
session_start();
$sessionid = session_id();
require_once("alpaca_functions.php");
$BreederID = $HTTP_GET_VARS["BreederID"];
if (isset($HTTP_GET_VARS["Direct"]))
{
$Direct = $HTTP_GET_VARS["Direct"];
if ($Direct)
{
// If direct there will be no ASCountry session
// So we need to create one
GetASCountry($BreederID,$ASCountry);
session_register("ASCountry");
$HTTP_SESSION_VARS["ASCountry"] = $ASCountry;
if (isset($HTTP_GET_VARS["Language"]))
SetLanguageDirect($HTTP_GET_VARS["Language"]);
else
SetLanguage($ASCountry);
}
}
else
{
$Direct = 0;
}
// Make sure we have a connection
if (alpaca_db_connection($connection))
{
$query = "SELECT UserID FROM Breeder"
." WHERE BreederID=$BreederID";
$result = mysql_query($query,$connection);
if ($result)
{
$num_breeder_results = mysql_num_rows($result);
if ($num_breeder_results > 0)
{
$row = mysql_fetch_array($result);
$UserID = $row["UserID"];
}
}
if (NorthAmerica())
{
$DateFormat = "%m/%d/%y";
}
else
{
$DateFormat = "%d/%m/%y";
}
$CurrentTime = mktime();
$query = "SELECT DiaryID, Venue, Type, DATE_FORMAT(DiaryDate,'$DateFormat') AS FormatedDiaryDate, Description FROM Diary "
."WHERE UserID='$UserID' AND UNIX_TIMESTAMP(DiaryDate) >= $CurrentTime"
." ORDER BY DiaryDate";
// Find the user in the database
$result = mysql_query($query,$connection);
$num_results = mysql_num_rows($result);
if ($num_results > 0)
{
$breeder_diary_list_array = array();
$num_breeder_diary_list_results = $num_results;
for ($count=0;$count<$num_results;$count++)
{
$row = mysql_fetch_array($result);
$breeder_diary_list_array [$count] = $row;
}
session_register("breeder_diary_list_array");
session_register("num_breeder_diary_list_results");
$HTTP_SESSION_VARS["breeder_diary_list_array"] = $breeder_diary_list_array;
$HTTP_SESSION_VARS["num_breeder_diary_list_results"] = $num_breeder_diary_list_results;
header("Location: DisplayBreederDiaryList.php?Direct=$Direct&BreederID=$BreederID&PHPSESSID=$sessionid");
}
else
{
LanuageKeywords();
if ($Direct)
{
do_html_header("Diary Dates");
echo $langKw["nocurrentdiarydates"]; echo"
";
}
else
{
include ('header.php');
htmlheader($langKw["saleanimals"]);
echo "
"; echo $langKw["nocurrentdiarydates"]; echo "
"; do_html_footer(); echo "