<?php
session_start();
include("../check.access.php");
include('../_db.connection.php');

// DB Setup Pull
$setup_result = mysql_query("SELECT * FROM setup WHERE setup_id = 1", $db);
$setup = mysql_fetch_object($setup_result);
?>
<body bgcolor="#ECE9D8" topmargin="0" leftmargin="0" rightmargin="0" marginheight="0" marginwidth="0">
<br>
	<table cellpadding="3" cellspacing="0" width="100%">
		<tr>
			<td colspan="4" align="center">
				<table>
				<form action="image.manager.php" method="post">
					<tr>
						<td><font face="verdana" size="1" color="#333333"><b>View Images In This Folder: &nbsp;</td>
						<td>
						<select name="fid">
							<?
							$folder_result = mysql_query("SELECT * FROM folders WHERE mid = '$mid'", $db);
							$folder_count = mysql_num_rows($folder_result);
							while($folder = mysql_fetch_object($folder_result)){
							?>
								<option value="<?php echo $folder->folder_id; ?>"><?php echo $folder->name; ?></option>
							<? } ?>
						</select><input type="submit" value="Show Images">
						</td>
					</tr>
				</form>
				</table>
			</td>
		</tr>
		<form action="../actions.php?pmode=delete_images&app=hta" method="post">	
		<tr>
			<td align="center" style="border-top: 1px solid #FEFCF1;border-bottom: 1px solid #CAC7B5;border-right: 1px solid #CAC7B5"><font face="verdana" size="1" color="#333333"><b>Thumbnail</b></td>
			<td style="border-top: 1px solid #FEFCF1;border-bottom: 1px solid #CAC7B5;border-right: 1px solid #CAC7B5"><font face="verdana" size="1" color="#333333"><b>Filename</b></td>
			<td style="border-top: 1px solid #FEFCF1;border-bottom: 1px solid #CAC7B5;border-right: 1px solid #CAC7B5"><font face="verdana" size="1" color="#333333"><b>Link</b></td>
			<td align="center" style="border-top: 1px solid #FEFCF1;border-bottom: 1px solid #CAC7B5;border-right: 1px solid #CAC7B5"><font face="verdana" size="1" color="#333333"><b>Delete</b></td>
		</tr>
		<?
			$image_result = mysql_query("SELECT * FROM images WHERE fid = '$fid'", $db);
			$image_count = mysql_num_rows($image_result);
			while($image = mysql_fetch_object($image_result)){
		?>
		<tr>
			<td align="center" style="border-top: 1px solid #FEFCF1;border-bottom: 1px solid #CAC7B5"><img src="../usr/<?echo $mid . "/hta_" . $image->filename; ?>" style="border: 1px solid #333333"></td>
			<td style="border-top: 1px solid #FEFCF1;border-bottom: 1px solid #CAC7B5"><font face="verdana" size="1" color="#333333"><?php echo $image->filename; ?></td>
			<td style="border-top: 1px solid #FEFCF1;border-bottom: 1px solid #CAC7B5"><font face="verdana" size="1" color="#333333"><input type="textbox" name="link" value="<? echo $setup->url; ?>/is.php?i=<?php echo $image->image_id . "&fn=" . $image->filename; ?>" style="font-size: 10; width: 300;"></td>
			<td align="center" style="border-top: 1px solid #FEFCF1;border-bottom: 1px solid #CAC7B5"><font face="verdana" size="1" color="#333333"><input type="checkbox" name="<? echo $image->image_id; ?>" value="1"></td>
		</tr>
		<?
			}
		?>
		<tr>
			<td colspan="3" align="right"></td>
			<td><input type="submit" value="Delete"></td>
		</tr>
		</form>
	</table>
	
</body>