Location: PHPKode > projects > phpimageview > comments.php
<?
require_once('classes/class.phpivDirectory.php');
require_once('classes/DirectoryReader.php');
$thei_dir = new phpivDirectory();
$thei_dir->GatherMetrics(); 
 if (isset($_POST['Submit'])) {
 	array_pop($_POST);
	$qry = "INSERT INTO USR_CMNTS SET ";
	$cnt = count($_POST);
	$cntr = 0;
	foreach($_POST as $key => $value) {
		$cntr++;
		$value = $thei_dir->db->qstr($value);
		if ($cntr != $cnt) { 
			$qry .= strtoupper($key) ." = ".$value.", ";
		} else {
			$qry .= strtoupper($key) ." = ".$value." ";
		}
		
	}
	if ($thei_dir->db->Execute($qry) === false) {
		die ("can't execute insert". $thei_dir->db->ErrorMsg() . "<br>". $qry);
	}
	header("Location: show_single.php?d=".urlencode($_POST['dir_nm'])."&single=".$_POST['fl_nm']);

 }
	
	$data 		= '';
	$curr_dir 	= (is_dir($thei_dir->main_cfg['image_dir'].$_GET['d'])) ? $_GET['d'] : false;
	$curr_img 	= (is_file($thei_dir->main_cfg['image_dir'].$curr_dir."/".$_GET['single'])) ? $_GET['single'] : false;
	
	if ($curr_dir === false) {
		print RaiseError("I've not been passed valid parameters, please contact admin");
		die;
	}
	if ($curr_img === false) {
		
		print RaiseError("I've not been passed valid parameters, please contact admin, or try another URL");
		die;
	} 
	$cmnt_msg	 = 'Please fill out the comment field and submit, other fields are optional<br>';
	$cmnt_msg	.= 'A successful submission with bring you back to the full image.';
	
	$dir_read = new DirectoryReader();
        $dir_read->setSearchDir($thei_dir->main_cfg['image_root']);
        $dir_read->set_ignore_dirs_file('classes/dir.ignore.dat');
        $dir_read->build_ignore_dirs();
        $dir_read->read();
    $nav_array = $dir_read->getResult();
        
	$dir_nav 	= $thei_dir->BuildNavigation($nav_array, $_GET['d']);
	$parent		= $thei_dir->main_cfg['image_root'];
	$toolbar 	= $thei_dir->CreateNav_ToolBar();

	$data 		= '';
	if (is_dir($thei_dir->main_cfg['image_dir'].$_GET['d'])) {
		$curr_dir = $_GET['d']; 
	} else if ($_GET['d'] == @($_SESSION['TITLE'])) {
		$curr_dir = ''; 
	} else {
		$curr_dir = false;
	}
	$curr_img 	= (is_file($thei_dir->main_cfg['image_dir'].$curr_dir."/".$_GET['single'])) ? $_GET['single'] : false;
	
	$which_dir 	= (isset($_GET['v'])) ? true: false;
	$about_ar 	= $thei_dir->GetImageData($_GET['d'], $_GET['single']);
	
	$fldr_title = $thei_dir->CurrentFolderTitles($nav_array,$_GET['d']);
	//print_r($fldr_title);
	
	$title 		= "Thumbnails :: " .$thei_dir->BuildFldrTitle($_GET['d']);
	$toolbar 	= $thei_dir->CreateNav_ToolBar();
	
	$title 		= $thei_dir->BuildFldrTitle($_GET['d']) . " :: " . @($about_ar['TITLE']);
	$selected 	= (isset($_GET['v'])) ? $_GET['v'] : $curr_dir;
	$fldr_tabs 	= $thei_dir->FolderTabs($fldr_title,$selected);
	$n_p 		= $thei_dir->FindNextPrev($_GET['d'],$_GET['single'],$which_dir);

	 if (!isset($_SESSION['hide_nav'])) { 
		$side_data = "\n".
		             "<!-- Starting Navigation -->\n". 
		             $dir_nav.
		             "<!-- End Navigation -->\n".
		             "<img src=\"".$thei_dir->theme."/images/nav_divider.gif\" height=\"1\" width=\"180\"><br>\n".
		             $toolbar.
		             "\n<img src=\"".$thei_dir->theme."/images/nav_divider.gif\" height=\"1\" width=\"180\">\n";
		$colspn = '';
		$hide_show = "<a href=\"index.php?hide_nav=true\">Hide</a>";
	} else {
		$side_data = "";
		$colspn = "colspan=\"3\"";
		$hide_show = "<a href=\"index.php?hide_nav=false\">Show</a>";
	}	
?>
<html>
<head><title><?=$title;?></title>
<? include("includes/usr.meta.html"); ?>
<link rel="stylesheet" href="<?php print $thei_dir->theme; ?>/styles.css" type="text/css">
<link rel="stylesheet" href="<?php print $thei_dir->theme; ?>/styles.form.css" type="text/css">
<link rel="stylesheet" href="<?php print $thei_dir->theme; ?>/styles.html_elem.css" type="text/css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0" >
<? include($thei_dir->theme."/header.php"); ?>
<br>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
 	<td valign="bottom" width="150" >
 		<table border="0" cellpadding="0" cellspacing="0">
	 		<tr>
	 			<td height="15" align="left" width="180" nowrap class="navtitle" ><img src="<?php print $thei_dir->theme;?>/images/bgtabletop.gif" height="1" width="180"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Directories&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php print $hide_show; ?> </td>
	 		</tr>
	 	</table>
	</td>
 	<td colspan="2" height="15" class="fldrtaboff" align="center" valign="bottom"><?php print $fldr_tabs;?></td>
	</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td valign="top" height="100%" width="180">
        <? 
			print $side_data;
			print "\n<p class=\"navtext\">\n" . @nl2br($about_ar['TEXT2']). "\n</p>\n<p class=\"navtext\">\n". @nl2br($about_ar['TEXT3']). "\n</p>\n<p class=\"navtext\">\n" . @nl2br($about_ar['TEXT4']) . "</p>\n";
		?>
		</td>
		<td <?php print $colspn; ?> width="100%" valign="top">
			
			<table border="0" width="100%" class="fldr_tab" cellspacing="0" cellpadding="0">
				<tr>
					<td height="2" colspan="2"><img src="<?php print $thei_dir->theme;?>/images/spacer.gif" height="1" width="100%"><br></td>
				</tr>
				<tr> 
	    			<td width="4" rowspan="3" valign="bottom"><img src="<?php print $thei_dir->theme;?>/images/bgtabletop.gif" height="1" width="4"></td>
	    			<td height="10" width="100%" valign="top" align="left"><?php print $cmnt_msg; ?></td>
	    			<td height="10" width="21%" valign="top"> <?php print $thei_dir->ShowNextPrev($_GET['d'],$_GET['single'], $which_dir);?></td>
				</tr>
	    		<tr>
	    			<td valign="top" colspan="2"></td>
				</tr>
	    		<tr>
	    			<td height="1" colspan="2"><img src="<?php print $thei_dir->theme;?>/images/bgtabletop.gif" height="1" width="100%"></td>
				</tr>
			</table>
		<br>
		<?
			if (isset($_GET['single'])) {
				include('includes/form.comment.inc.php');			
			} else {
				print UserOutput("This page was not passed the proper information, please return to the <a href=\"".$main_cfg['home_page']."\">Home page</a>");
			}
   			print (isset($errors)) ? $errors : $data;
   	   ?>
   	   	<br>
		<form name="addimage" method="GET" action="<?php print $_SERVER['PHP_SELF'];?>">
	   	   	<input type="hidden" name="BuildShow[]" value="<?php print $_GET['d']."/".$_GET['single'];?>">
	   	   	<input type="hidden" name="single" value="<?php print $_GET['single'];?>">
	   		<input type="hidden" name="d" value="<?php print $_GET['d'];?>">
		</form>
		</td>
	</tr>
</table>
<?
	print $thei_dir->DrawNextPrevMap($thei_dir->main_cfg['image_dir'].$_GET['d']."/".$_GET['single'], $n_p);
	if (isset($thei_dir->main_cfg['statistics']) && $thei_dir->main_cfg['statistics'] == 'true' && !isset($_SESSION['THEIBC']) && !isset($_SESSION['ADMIN_AUTH']) && !ereg("thei",$_SERVER['HTTP_USER_AGENT']) && (!isset($_COOKIE['noStats']) )) {
		include ("statistics.counter.inc.php"); 
	}
?>
<? include($thei_dir->theme."/footer.php"); ?>
</body>
</html>
Return current item: phpimageview