Location: PHPKode > projects > ZitPG (Zoom It! Photo Gallery) > zitpg_v0.04/index.php
<?php

	/*---------------------------------------------------------*\
	 | ZitPG v0.04                                             |
	 | http://zoomit.vertigoproject.net                        |
	 +---------------------------------------------------------+
	 | Copyright©2004|2005 Aldemar Bernal                      |
	 | hide@address.com                              |
	 +---------------------------------------------------------+
	 | License                                                 |
	 |                                                         |
	 | This program is an open source project and you can use  |
	 | or distribute it in your website but always keeping its |
	 | original copyright information and license.             |
	 |                                                         |
	 | If you want to know more about this license, please     |
	 | refer to the license.txt file or go to the official     |
	 | LGPL Website http://www.gnu.org/licenses/lgpl.txt       |
	 +---------------------------------------------------------+
	 | File: /index.php                                        |
	 | Description: Site's Homepage.                           |
	\*---------------------------------------------------------*/


	include_once('classes/db_wrapper.php');
	include_once('configuration.php');
	include_once('classes/db_based_class.php');
	include_once('classes/db_based_interface.php');
	include_once('classes/album_comment.php');
	include_once('classes/album.php');
    include_once('classes/news.php');
    include_once('classes/news_comment.php');
	include_once('classes/photo_comment.php');
	include_once('classes/photo_rating.php');
	include_once('classes/photo.php');
	include_once('classes/user.php');
	include_once('misc.php');
	include_once('validate_forms.php');


	$i_count = 0;
	$i_user_online = "";
	$i_user_birthday_today = "";
	$i_users_birthday_today = array();

	if(!isset($_GET["page"]))
	{
		header("location: index.php?page=home");
		exit();
	}

	check_database();
	register_user_session();
	get_sessions_info();

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
		<title>:: ZitPG v0.04 ::</title>
		<style type="text/css">
		<!--
			body {
				margin-left: 0px;
				margin-top: 4px;
				margin-right: 0px;
				margin-bottom: 4px;
				background-color: #EEEEEE;
				font-family: Verdana, Arial, Helvetica, sans-serif;
				font-size: small;
				background-image: url(<?php echo $GLOBALS["zoom_it_background_url"]; ?>);
			}
			.small_font {
				font-size: x-small;
			}
			.error_font {
				color: #EE0000;
			}
			.copyright_font {
				font-size: 10px;
				color: #F0F0F0;
			}
			.title_font {
				font-size: x-large;
				font-weight: bold;
			}
			.hierachy_font {
				font-size: x-small;
				font-weight: bold;
			}
			.subtitle_font {
				font-size: small;
				font-weight: bold;
			}
			.code_font {
				font-size: 10;
				color: #000099;
				font-family: 'Courier New';
			}
			a {
				font-weight: bold;
			}
			a:link {
				color: #000099;
				text-decoration: none;
			}
			a:visited {
				text-decoration: none;
				color: #000099;
			}
			a:hover {
				text-decoration: none;
				color: #990000;
			}
			a:active {
				text-decoration: none;
			}
			b {
				color:#330000;
			}
			table {
				border: 1px solid #FFFFFF;
			}
			th {
				background-image: url(<?php echo $GLOBALS["zoom_it_bar_background_url"]; ?>);
				background-repeat: repeat-y;
				background-position: right top;
				background-color: #F8F8EE;
				border: 1px solid #AAAAAA;
				text-align: left;
				padding: 5px;
			}
			.info_td {
				background-color: #F8F8EE;
				border: 1px solid #AAAAAA;
				padding: 5px;
			}
			.logo_bg {
				background-image: url(<?php echo $GLOBALS["zoom_it_main_background_url"]; ?>);
				background-repeat: no-repeat;
				background-position: left top;
			}
			.status_bg {
				background-image: url(<?php echo $GLOBALS["zoom_it_status_background_url"]; ?>);
				background-color: #B1D8F2;
				font-size: x-small;
			}
			.status_bg_bold {
				font-size: x-small;
				font-weight: bold;
			}
		-->
		</style>
	</head>
	<script language="JavaScript" type="text/JavaScript">
		<!--
			function popup_photo(prm_photo_url, prm_size)
			{
		  		window.open(prm_photo_url, 'photo', 'status=yes, scrollbars=yes, resizable=yes, ' + prm_size);
			}

			function MM_openBrWindow(theURL,winName,features) { //v2.0
			  window.open(theURL,winName,features);
			}

			function MM_preloadImages() { //v3.0
			  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
				var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
				if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
			}
			
			function MM_swapImgRestore() { //v3.0
			  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
			}
			
			function MM_findObj(n, d) { //v4.01
			  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
				d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
			  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
			  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
			  if(!x && d.getElementById) x=d.getElementById(n); return x;
			}
			
			function MM_swapImage() { //v3.0
			  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
			   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
			}
		//-->
	</script>
	<body onLoad="MM_preloadImages('media/site/menu/menu_home_over.jpg','media/site/menu/menu_news_over.jpg','media/site/menu/menu_albums_over.jpg','media/site/menu/menu_users_over.jpg','media/site/menu/menu_login_over.jpg','media/site/menu/menu_logout_over.jpg')">
		<table width="705" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#333333">
			<tr>
				<td bgcolor="#000000"><div align="center"><a href="index.php?page=home"><img src="<?php echo $GLOBALS["zoom_it_banner_url"]; ?>" border="0"></a></div></td>
			</tr>
			<tr>
				<td bgcolor="#FFFFFF">
					<table width="100%" border="0" cellpadding="0" cellspacing="0" class="logo_bg">
						<tr>
							<td>
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td>&nbsp;</td>
                                        <td>
											<div align="right">
												<img src="media/site/menu/menu_left.jpg" width="25" height="25"><a href="index.php?page=home"><img src="media/site/menu/menu_home.jpg" name="menu_home" width="80" height="25" border="0" id="menu_home" onMouseOver="MM_swapImage('menu_home','','media/site/menu/menu_home_over.jpg',1)" onMouseOut="MM_swapImgRestore()"></a><a href="index.php?page=news"><img src="media/site/menu/menu_news.jpg" name="menu_news" width="80" height="25" border="0" id="menu_news" onMouseOver="MM_swapImage('menu_news','','media/site/menu/menu_news_over.jpg',1)" onMouseOut="MM_swapImgRestore()"></a><a href="index.php?page=album_info"><img src="media/site/menu/menu_albums.jpg" name="menu_albums" width="80" height="25" border="0" id="menu_albums" onMouseOver="MM_swapImage('menu_albums','','media/site/menu/menu_albums_over.jpg',1)" onMouseOut="MM_swapImgRestore()"></a><a href="index.php?page=users"><img src="media/site/menu/menu_users.jpg" name="menu_users" width="80" height="25" border="0" id="menu_users" onMouseOver="MM_swapImage('menu_users','','media/site/menu/menu_users_over.jpg',1)" onMouseOut="MM_swapImgRestore()"></a><a href="index.php?page=<?php if($_SESSION["username"] == "") { echo "login" . get_request_vars(); } else { echo $_GET["page"] . get_request_vars(FALSE, FALSE) . "&logout=true"; } ?>"><img src="media/site/menu/menu_log<?php if($_SESSION["username"] == "") { echo "in"; } else { echo "out";} ?>.jpg" name="menu_log" width="80" height="25" border="0" id="menu_log" onMouseOver="MM_swapImage('menu_log','','media/site/menu/menu_log<?php if($_SESSION["username"] == "") { echo "in"; } else { echo "out";} ?>_over.jpg',1)" onMouseOut="MM_swapImgRestore()"></a><img src="media/site/menu/menu_right.jpg" width="25" height="25">
											</div>
										</td>
                                        <td>&nbsp;</td>
                                    </tr>
                                </table>
							</td>
						</tr>
						<tr>
							<td>
								<table width="100%" border="0" cellspacing="20" cellpadding="0">
                                    <tr>
                                        <td>
<?php

	if(isset($_GET["page"]) && $GLOBALS["import_from_get"] == TRUE)
	{
		switch($_GET["page"])
		{
			case "albums":
				$GLOBALS["page_filename"] = 'site/albums/albums.php';
				break;
			case "album_info":
				$GLOBALS["page_filename"] = 'site/albums/album_info.php';
				break;
			case "add_album":
				$GLOBALS["page_filename"] = 'site/albums/add_album.php';
				break;
			case "add_album_comment":
				$GLOBALS["page_filename"] = 'site/albums/add_album_comment.php';
				break;
			case "edit_album":
				$GLOBALS["page_filename"] = 'site/albums/edit_album.php';
				break;
            case "news":
                $GLOBALS["page_filename"] = 'site/news/news.php';
                break;
            case "news_info":
                $GLOBALS["page_filename"] = 'site/news/news_info.php';
                break;
            case "add_news":
                $GLOBALS["page_filename"] = 'site/news/add_news.php';
                break;
            case "add_news_comment":
                $GLOBALS["page_filename"] = 'site/news/add_news_comment.php';
                break;
            case "edit_news":
                $GLOBALS["page_filename"] = 'site/news/edit_news.php';
                break;
			case "photo_info":
				$GLOBALS["page_filename"] = 'site/photos/photo_info.php';
				break;
			case "add_photo":
				$GLOBALS["page_filename"] = 'site/photos/add_photo.php';
				break;
			case "add_photo_comment":
				$GLOBALS["page_filename"] = 'site/photos/add_photo_comment.php';
				break;
			case "edit_photo":
				$GLOBALS["page_filename"] = 'site/photos/edit_photo.php';
				break;
			case "users":
				$GLOBALS["page_filename"] = 'site/users/users.php';
				break;
			case "user_info":
				$GLOBALS["page_filename"] = 'site/users/user_info.php';
				break;
			case "add_user":
				$GLOBALS["page_filename"] = 'site/users/add_user.php';
				break;
			case "edit_user":
				$GLOBALS["page_filename"] = 'site/users/edit_user.php';
				break;
			case "login":
				$GLOBALS["page_filename"] = 'site/users/login.php';
				break;
			case "home":
				$GLOBALS["page_filename"] = 'site/home.php';
				break;
			default:
				$GLOBALS["page_filename"] = 'site/error404.php';
				break;
		}
	}

	if(file_exists($GLOBALS["page_filename"]))
		include_once($GLOBALS["page_filename"]);
	else
		include_once('site/error404.php');

?>

										</td>
                                    </tr>
                                </table>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<table width="100%" border="0" cellpadding="10" cellspacing="0" class="status_bg">
						<tr>
							<td>
								Welcome 
<?php

	if($_SESSION["username"] == "")
	{

?>
								Guest [<a href="index.php?page=login<?php echo get_request_vars(); ?>">login</a>] [<a href="index.php?page=add_user<?php echo get_request_vars(); ?>">register</a>] <br />
<?php

	}
	else
	{
		echo $_SESSION["username"];

?>
								 [<a href="index.php?page=<?php echo $_GET["page"]; ?><?php echo get_request_vars(FALSE, FALSE); ?>&logout=true">logout</a>] [<a href="index.php?page=user_info&username=<?php echo $_SESSION["username"]; ?>">my profile</a>] <br />
<?php

	}

	if((count($GLOBALS["users_online"]) + $GLOBALS["number_anonymous_users"]) == 1)
		echo "1 user";
	else
		echo count($GLOBALS["users_online"]) + $GLOBALS["number_anonymous_users"] . " users";

?>
								online in the last 5 minutes, 
<?php

	if($GLOBALS["number_anonymous_users"] == 1)
		echo "1 guest and ";
	else
		echo $GLOBALS["number_anonymous_users"] . " guests and ";

	if(count($GLOBALS["users_online"]) == 1)
		echo "1 member";
	else
		echo count($GLOBALS["users_online"]) . " members";

	if(count($GLOBALS["users_online"]))
	{
		echo " [";
		$i_count = 0;
		foreach($GLOBALS["users_online"] as $i_user_online)
		{
			if($i_count > 0 && $i_count < count($GLOBALS["users_online"]) - 1)
				echo ", ";

			if($i_count == count($GLOBALS["users_online"]) - 1 && count($GLOBALS["users_online"]) > 1)
				echo " and ";

?>
								<a href="index.php?page=user_info&username=<?php echo $i_user_online; ?>"><? echo $i_user_online; ?></a>
<?php

			$i_count++;
		}
		echo "]";
	}

?> 
								<br />
								Most users online at the same time <?php echo $_SESSION["max_users_online"]; ?> (<?php echo date("l, F jS Y - H:i:s", strtotime($_SESSION["time_max_users_online"])); ?>)<br />
								<?php echo get_number_users(); ?> Users Registered
<?php

	if(get_number_users() > 0)
	{

?>
								Welcome to our newest member <a href="index.php?page=user_info&username=<?php echo get_last_registered_user(); ?>"><?php echo get_last_registered_user();?></a><br />
<?php

	}

?>
								This site has been visited <?php echo $GLOBALS["number_hits"]; ?> times<br />
								<?php echo get_number_photos(); ?> Photos in <?php echo get_number_albums(); ?> Albums<br />
<?php

	$i_users_birthday_today = get_users_birthday_today();
	if(count($i_users_birthday_today) > 0)
	{

?>
                                <span class="status_bg_bold">
								Congratulations to
<?php

		$i_count = 0;
		foreach($i_users_birthday_today as $i_user_birthday_today)
		{
			if($i_count > 0 && $i_count < count($i_users_birthday_today) - 1)
				echo ", ";

			if($i_count == count($i_users_birthday_today) - 1 && count($i_users_birthday_today) > 1)
				echo " and ";

?>
								<a href="index.php?page=user_info&username=<?php echo $i_user_birthday_today; ?>"><?php echo $i_user_birthday_today; ?></a>
<?php

			$i_count++;
		}

		if(count($i_users_birthday_today) == 1)
			echo " in his/her ";
		else
			echo " in their ";

?>
								birthday!</span><br />
<?php

	}

?>
							<br /><a href="http://sourceforge.net/projects/zit"><img src="http://sourceforge.net/sflogo.php?group_id=123107&type=1" border="0"></a>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td height="20" bgcolor="#000000"><div align="center"><span class="copyright_font">ZitPG v0.04 &copy;2004|2005 - Aldemar Bernal.</span></div></td>
			</tr>
	</table>
</body>
</html>
Return current item: ZitPG (Zoom It! Photo Gallery)