Просмотр файла script/admin/alb_thumb.php

Размер файла: 2.73Kb
<?php
/*-----------------------------------------------------------------------------------------
mcGalleryPRO
All code is © 2003 Marc Cagninacci.
No files may be redistributed in whole or significant part.
----------------- mcgalleryPRO IS NOT FREE SOFTWARE -------------------
You should have receive a file called license.txt in this package
--------------------------------------------------------------------------------------------*/

session_start();
if (empty($_SESSION['private_login']))
{
include "./sess.php";
exit;
}
include './header.php';

if ($t == 'P')
{
$table = 'mcgallery_photo';
$table_album = 'mcgallery_albumphoto';
$dir = 'photos';
$back = 'detailphoto.php';
}
elseif ($t == 'V')
{
$table = 'mcgallery_video';
$table_album = 'mcgallery_albumvideo';
$dir = 'videos';
$back = 'detailvideo.php';
}
elseif ($t == 'F')
{
$table = 'mcgallery_flash';
$table_album = 'mcgallery_albumflash';
$dir = 'flash';
$back = 'detailflash.php';
}

$connect = mysql_connect($host,$login,$pass);
mysql_select_db($base, $connect);

if ($thmb != '')
{
$query = "UPDATE $table_album SET thumb='$thmb' WHERE idalbum='$idalbum'";
mysql_query($query);

}
    $query = "SELECT thumb FROM $table_album WHERE idalbum='$idalbum'";
    $resultat = mysql_query($query);
    $thumb = mysql_fetch_row($resultat);
    if (!is_file('../'.$dir.'/'.$idalbum.'/small/'.$thumb[0])) { $thumb = '../images/blank.gif'; }
    else { $thumb = '../'.$dir.'/'.$idalbum.'/small/'.$thumb[0]; }


$len = strlen($idalbum);

$query = "SELECT file FROM $table WHERE idalbum='$idalbum'";
$resultat = mysql_query($query);

echo '<table border="0" cellspacing="1" cellpadding="1" align="center"><tr>';
echo '<td bgcolor="black" align="center"><img src="'.$thumb.'" width="40" height="30" border="0" alt=""></td>';
echo '<td bgcolor="black" colspan="5" align="center"><font face="verdana" size="2" color="white">'.$l_Thumbtitle.' '.$idalbum.'</font></td>';
echo '<td bgcolor="black" colspan="2" align="center"><font face="verdana" size="2"><a href="'.$back.'?idalbum='.$idalbum.'" class="lien2">'.$l_Retour.'</a></font></tr><tr>';
$i = 0;
while ($row = mysql_fetch_array($resultat))
  {
  $image = substr($row['file'], ($len + 1), -3).'jpg';
  if (!file_exists('../'.$dir.'/'.$idalbum.'/small/'.$image)) { $image = substr($row['file'], ($len + 1), -3).'JPG'; }
  echo '<td><a href="alb_thumb.php?t='.$t.'&idalbum='.$idalbum.'&thmb='.$image.'"><img src="../'.$dir.'/'.$idalbum.'/small/'.$image.'" border="0" alt=""></a></td>';
  $i++;
  if (($i % 8) == 0) { echo '</tr><tr>'; }
  }
while (($i % 8) != 0)
  {
  echo '<td>&nbsp;</td>';
  $i++;
  }
echo '</tr><tr><td bgcolor="black" colspan="8" height="3"></td></tr></table>';
include './footer.php';
?>