require ('config.inc.php');
session_start();
require ('static.php');
require ('whatsnew.php');
$Debug = new Debug;
$Debug->startTimer();
echo $maintitle;
//exit();
//echo "Should not get here...";
if (isset($_GET['page']))
$page_id = $_GET['page'];
/* Find out how to proceed */
switch ($page_id)
{
/* Show album index page
case "index":
echo $panediv;
require_once ('album.php');
$album = new Album();
$album->createIndexHeader();
$album->createThumbTable();
break;
*/
/* Show full whatsnew page */
case "whatsnew":
echo "";
//echo $panediv;
whatsnew();
break;
/* Show full whatsnew page */
case "comments":
echo "";
//echo $panediv;
echo "
";
echo "";
echo "";
echo "";
echo "";
///// Info
getRandomPic(); // kludge, use this function just to select db...
echo "\n";
echo " Info";
echo "Samuel L. Jackson Filmography
\n";
echo " \n";
echo "Totaal : ".getNumPics()." Foto's in ".getNumAlbums()." Albums.
";
echo "Email de Webmaster: \n";
echo " \n";
echo " | ";
echo "";
// Calender
// weg met de kalender, it sucks !
echo "";
//include ('cal_mini.inc.php');
//echo "Voeg evenement toe \n";
echo "Klik hier om een reactie toe te voegen,";
echo "en hier om alle gastenboek berichten te zien.";
showLastGuestbookEntries(5,true,false);
echo "Klik hier om een reactie toe te voegen,";
echo "en hier om alle gastenboek berichten te zien.";
echo " | ";
echo " ";
// echo " Laatste Forum Posts";
// showLastForumPosts();
// echo " | ";
echo " ";
echo " | ";
echo "| ";
whatsnew(4);
echo " | ";
// comment rows
echo " Laatste Reacties op Foto's";
showLastComments(5,true);
echo " \n";
echo " | ";
echo " ";
echo " | ";
echo "";
$picid=getRandomPic();
if ($picid != -1)
{
echo "";
echo "Random Foto";
echo "";
echo " ";
echo "";
echo " ".getNumHitsMonth($picid)." Hits deze maand ".getNumHitsTotal($picid)." Hits totaal";
getNumComments($picid);
echo " | ";
echo "";
}
echo " ";
echo "Foto v/d Maand";
$picid=getPicOfMonth();
if ($picid == -1)
{
echo "Geen foto's bekeken deze maand !";
} else
{
echo "";
echo " ";
echo "";
echo " ".getNumHitsMonth($picid)." Hits deze maand ".getNumHitsTotal($picid)." Hits totaal";
getNumComments($picid);
}
echo " | ";
echo " ";
echo "";
echo "Foto Aller Tijden";
$picid=getPicOfAllTimes();
echo "";
echo " ";
echo "";
echo " ".getNumHitsMonth($picid)." Hits deze maand ".getNumHitsTotal($picid)." Hits totaal";
getNumComments($picid);
echo " | ";
echo " ";
echo " ";
echo " | ";
echo " ";
}
function getPicOfMonth($rankId=1)
{
global $db,$dbname;
/* Connect to the database */
mysql_select_db($dbname,$db) or die("Can't select database1");
$rankId-=1;// sql wants zero indexed
$cmd="select * from hist_hits where month(date) = month(curdate()) AND year( date ) = year( curdate( ) ) order by hits DESC limit ".$rankId.",1";
$result = mysql_query ($cmd,$db);
$pic_obj =mysql_fetch_object($result);
if ($pic_obj)
return $pic_obj->pic_id;
else
return -1;
}
function getPicOfAllTimes($rankId=1)
{
global $db,$dbname;
/* Connect to the database */
mysql_select_db($dbname,$db) or die("Can't select database2");
$rankId-=1;// sql wants zero indexed
$cmd="select * from pics order by hits DESC limit ".$rankId.",1";
$result = mysql_query ($cmd,$db);
$pic_obj =mysql_fetch_object($result);
if ($pic_obj)
return $pic_obj->id;
else
return -1;
}
function getRandomPic()
{
global $db,$dbname;
/* Connect to the database */
mysql_select_db($dbname,$db) or die("Can't select database3");
$cmd="select * from pics order by rand() limit 1";
$result = mysql_query ($cmd,$db);
$pic_obj =mysql_fetch_object($result);
if ($pic_obj)
return $pic_obj->id;
else
return -1;
}
function getNumHitsTotal($id)
{
global $db,$dbname;
/* Connect to the database */
mysql_select_db($dbname,$db) or die("Can't select database4");
$cmd="select * from pics where id=".$id;
$result = mysql_query ($cmd,$db);
$pic_obj =mysql_fetch_object($result);
return $pic_obj->hits;
}
function getNumHitsMonth($id)
{
global $db,$dbname;
/* Connect to the database */
mysql_select_db($dbname,$db) or die("Can't select database5");
$cmd="SELECT * FROM hist_hits WHERE month(date) = month(curdate()) AND year( date ) = year( curdate( ) ) AND pic_id = '$id'";
$result = mysql_query ($cmd,$db);
$hist_object =mysql_fetch_object($result);
if ($hist_object)
return $hist_object->hits;
else
return 0;
}
?>
|