<?php
///////////////////////////////////////////////////////////////////////////////
//                                                                           //
//   Program Name         : ProPhotoHost                                     //
//   Release Version      : 1.0                                              //
//   Home Page            : http://www.prophotohost.com                      //
//   Program Author       : Jake P                                           //
//   Supplied by          : drew010                                          //
//   Nullified by         : CyKuH [WTN]                                      //
//   Distribution         : via WebForum, ForumRU and associated file dumps  //
//                                                                           //
///////////////////////////////////////////////////////////////////////////////
session_start();
if($session_access == false) {
	header("location: ./error.php?error=session");
}

include('i.setup.php');
include('i.connection.php');
include('i.function.php');

if($mode == "delete") {
	$query = mysql_query("SELECT image_id FROM image WHERE image_member_id = '$session_member_id' and image_status = 'A' ORDER BY image_id");
	while($data = mysql_fetch_object($query, $db)) {
		if(${"checkbox" . $data->image_id} == 1) {
			$sql = "UPDATE image SET image_status='D' WHERE image_id = '$data->image_id'";
			$result = mysql_query($sql);
		}
	}
}
?>

<html>

<head>
<title><?php print($page_title); ?></title>

<?php include('i.style.php'); ?>

<script language="javascript">
	
	function copyit(theField) {
		var tempval=eval("document.home."+theField)
		tempval.focus()
		tempval.select()
		therange=tempval.createTextRange()
		therange.execCommand("Copy")
	}
	
	function new_window(mypage, myname, w, h, scroll) {
		var winl = (screen.width - w) / 2;
		var wint = (screen.height - h) / 2;
		winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
		win = window.open(mypage, myname, winprops)
		if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
	}
	
	function jp_delete(field) {
		var agree = confirm("Are you sure you want to delete the selected images?");
		
		if(agree) {
			document.home.action = "<? echo $PHP_SELF; ?>?mode=delete";
			document.home.submit();		
		}
	}
	
</script>

</head>

<body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" rightmargin="0">
	
	<table width="100%" cellpadding="0" cellspacing="0">
		
		<?php include('i.header.php'); ?>
		
		<tr>
			
			<td valign="top">
				
				<table cellpadding="0" cellspacing="0">
					
					<tr>
						
						<td><font face="verdana" size="1">&nbsp;&nbsp;&nbsp;</font></td>
						
					</tr>
					
				<tr>
					
					<td><font face="verdana" size="1">&nbsp;&nbsp;&nbsp;</font></td>
					
					<td valign="top">
						
						<table cellpadding="0" cellspacing="0">
							
							<?php include('i.tab.php'); ?>
							
						</table>
						
					</td>
					
					<td><font face="verdana" size="1">&nbsp;&nbsp;</font></td>
					
					<td valign="top" width="100%" height="100%">
						
						<table width="100%" height="100%" cellpadding="0" cellspacing="0">
							
							<tr>
								
								<td><font face="verdana" size="1">&nbsp;</font></td>
								
								<td width="100%" height="100%">
									
									<table width="100%" height="100%" cellpadding="0" cellspacing="0">
										
										<tr>
											
											<td><img src="./images/heading.control.gif"></td>
											
										</tr>
										
										<tr>
											
											<td height="8" background="images/hr.gif"></td>
											
										</tr>
										
										<tr>
											
											<td><font face="verdana" size="1">&nbsp;</font></td>
											
										</tr>
										
										<tr>
											
											<td>
												
												<table>
													
													<?php
													$query = mysql_query("SELECT member_name FROM member WHERE member_status = 'A'");
													$rows1 = mysql_num_rows($query);
													
													$query = mysql_query("SELECT member_name FROM member WHERE member_status = 'I'");
													$rows2 = mysql_num_rows($query);
													
													$query = mysql_query("SELECT member_name FROM member WHERE member_status = 'D'");
													$rows3 = mysql_num_rows($query);
													
													$query = mysql_query("SELECT image_id, image_size FROM image WHERE image_status = 'A'");
													while($data4 = mysql_fetch_object($query, $db)) {
														$size4 = $size4 + $data4->image_size;
													}
													$rows4 = mysql_num_rows($query);
													
													$query = mysql_query("SELECT image_id, image_size FROM image WHERE image_status = 'D'");
													while($data5 = mysql_fetch_object($query, $db)) {
														$size5 = $size5 + $data5->image_size;
													}
													$rows5 = mysql_num_rows($query);
													?>
													
													<tr>
														
														<td>
															
															<font face="verdana" size="1">
																
																Welcome <b>Administrator</b>!<br><br>
																<b><?php print($rows1); ?></b> activated members.<br>
																<b><?php print($rows2); ?></b> inactive members.<br>
																<b><?php print($rows3); ?></b> deleted members.<br><br>
																
																<b><?php print($rows4); ?></b> hosted images.<br>
																
																<?php
																$file_size = round(($size4/1024), 2);
																if($file_size > 1024) {
																?>
																	<b><?php print(round(($file_size/1024), 2)); ?> mb</b> of hosted images.<br><br>
																<?php } else { ?>
																	<b><?php print($file_size); ?> kb</b> of hosted images.<br><br>
																<?php } ?>
																
																<b><?php print($rows5); ?></b> deleted images.<br>
																
																<?php
																$file_size = round(($size5/1024), 2);
																if($file_size > 1024) {
																?>
																	<b><?php print(round(($file_size/1024), 2)); ?> mb</b> of deleted images.<br><br>
																<?php } else { ?>
																	<b><?php print($file_size); ?> kb</b> of deleted images.<br><br>
																<?php } ?>
																
															</font>
															
														</td>
														
													</tr>
													
												</table>
												
											</td>
											
										</tr>
										
										<tr>
											
											<td height="100%"><font face="verdana" size="1">&nbsp;</font></td>
											
										</tr>
										
										<tr>
											
											<td height="8" background="images/hr.gif"></td>
											
										</tr>
										
									</table>
									
								</td>
								
								<td><font face="verdana" size="1">&nbsp;</font></td>
								
							</tr>
							
						</table>
						
					</td>
					
				</tr>
				
			</table>
			
		</td>
		
	</tr>
	
	<?php include('i.footer.php'); ?>
	
	</table>
	
</body>

</html>