<?php require_once('../Connections/telmanik_press.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$colname_photos = "-1";
if (isset($_GET['gallery'])) {
  $colname_photos = $_GET['gallery'];
}
mysql_select_db($database_telmanik_press, $telmanik_press);
$query_photos = sprintf("SELECT * FROM photos WHERE gallery = %s", GetSQLValueString($colname_photos, "text"));
$photos = mysql_query($query_photos, $telmanik_press) or die(mysql_error());
$row_photos = mysql_fetch_assoc($photos);
$totalRows_photos = mysql_num_rows($photos);
?>
<?php
require_once('language/class.translation.php');

if(isset($_GET['lang']))
	$translate = new Translator($_GET['lang']);
else
	$translate = new Translator('en');
?>


<form action="" method="get" name="display">
  <?php do { ?>
    <img src="../photos/<?php echo $row_photos['image_name']; ?>" width="150" height="100" alt=""/>
    <?php } while ($row_photos = mysql_fetch_assoc($photos)); ?>
</form>
<?php echo $translate->__('Total images');?> - <?php echo $totalRows_photos ?>

<?php
mysql_free_result($photos);
?>
