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

Размер файла: 5.06Kb
<?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
--------------------------------------------------------------------------------------------*/

function fill($j, $k, $thumb_cols, $thumb_rows, $thumb_width)
{
 while ($j % $thumb_cols != 0)
 {
 echo '<td class="td3"><img src="images/blank.gif" width="'.$thumb_width.'" border="0" alt=""></td>';
 $j++;
 $tr = 1;
 }
 if ($tr == 1) { echo '</tr><tr>'; }
 while ($k < $thumb_rows - 1)
 {
 echo '<td class="td3" colspan='.$thumb_cols.'><img src="images/blank.gif" border="0" alt="" width="'.$thumb_width.'" height="'.($thumb_width / 4 * 3).'"></td></tr><tr>';
 $k++;
 }
}

$thumb_aff = $thumb_cols * $thumb_rows;

session_start();
if (!empty($_SESSION['private_pass']))
{
  if ($_SESSION['level']== 'admin' && $l != '') { $where = $l; $l_your_select = $l_sel_add.': '.$l; }
  else { $where = $_SESSION['private_login']; }

  $query = "SELECT file FROM mcgallery_select WHERE login = '$where' AND type = '$sel'";
  $result = mysql_query($query);
  $nbre = mysql_num_rows($result);
  
  echo '<table border="0" cellspacing="0" cellpadding="1"><tr><td class="td1">';

  echo '<table border="0" cellspacing="0" cellpadding="5"><tr>';
  echo '<td align="center" class="td0" colspan="'.($thumb_cols - 1).'">';
  echo '<font size="2">'.$l_your_select.'</font></td>';
  echo '<td class="td0" align="right">';

  if ($start == '') { $start = 0; }
  $query = "SELECT id, file FROM mcgallery_select WHERE login='$where' AND type='$sel' ORDER BY file LIMIT $start, $thumb_aff";
  $result = mysql_query($query);
  
  echo '<font size="1">('.$nbre.' &nbsp;';
   if ($sel == 'P') echo $l_photos.')';
   elseif ($sel == 'V') echo $l_videos.')';
   elseif ($sel == 'F') echo $l_flash.')';
  echo '</font></td></tr><tr>';
  $j = 0;
  $k = 0;
    while ($row2=mysql_fetch_array($result))
   {
   $id = $row2['id'];
	if ($sel == 'P')
	{
		$image = substr(strstr($row2['file'], '_'), 1);
		$album = substr(str_replace($image, '', $row2['file']), 0, -1);
		if ($l == '')
		{
		   echo '<td class="td3" align="center">'.shadow7($album, $image, $start, $id);
		   echo '<font size="1">';
		   echo '<a href="index.php?del='.$row2['id'].'&t=P&sel=P" class="lien1"><b>'.$l_Suppr.'</b></a></font></td>';
		}
		else
		{
		   echo '<td class="td3" align="center">'.shadow13($album, $image);
		   echo '<font size="1" color="black">';
		   echo $row2['file'].'</font></td>';
		}
	}
	if ($sel == 'F')
	{
		$image = substr(strstr($row2['file'], '_'), 1, -3).'jpg';
		$flash = substr(strstr($row2['file'], '_'), 1);
		$album = substr(str_replace($flash, '', $row2['file']), 0, -1);
		if ($l == '')
		{
		 echo '<td class="td3" align="center">'.shadow12($album, $image, $start, $id);
		 echo '<font size="1">';
		 echo '<a href="index.php?del='.$row2['id'].'&t=F&sel=F" class="lien1"><b>'.$l_Suppr.'</b></a></font></td>';
		}
		else
		{
		 echo '<td class="td3" align="center">'.shadow15($album, $image);
		 echo '<font size="1" color="black">';
		 echo $row2['file'].'</font></td>';
		}
	}
	if ($sel == 'V')
	{
		$image = substr(strstr($row2['file'], '_'), 1, -3).'jpg';
		$video = substr(strstr($row2['file'], '_'), 1);
		$album = substr(str_replace($video, '', $row2['file']), 0, -1);
		if ($l == '')
		{
		 echo '<td class="td3" align="center">'.shadow9($album, $image, $start, $id);
		 echo '<font size="1">';
		 echo '<a href="index.php?del='.$row2['id'].'&t=V&sel=V" class="lien1"><b>'.$l_Suppr.'</b></a></font></td>';
		}
		else
		{
		echo '<td class="td3" align="center">'.shadow14($album, $image);
		echo '<font size="1" color="black">';
		echo $row2['file'].'</font></td>';
		}
	}
	$j++;
	if ($j % $thumb_cols == 0)
	{
	echo '</tr><tr>';
	$k++;
	}
   }

  fill($j, $k, $thumb_cols, $thumb_rows, $thumb_width);

  echo '<td class="td1" colspan="'.($thumb_cols - 1).'" align="left">';
  if ($sel == 'P' && $nbre > 1)
  {
  echo '<font size="1"><a href="slideselect.php?l='.$l.'&sel='.$sel.'" class="lien2">'.$l_slide.'</a></font></td>';
  }
  else echo '&nbsp;</td>';
  echo '<td class="td1" align="right">';
  echo '<font size="1">'.$l_page.':&nbsp;&nbsp;</font>';

  // start navigation
  $nbre_pages= ceil($nbre / $thumb_aff);

 $i=1;
 while ($i<(($start + $thumb_aff)/$thumb_aff))
  {
   echo '<font size="1"><a href="index.php?l='.$l.'&start='.($thumb_aff * ($i - 1)).'&sel=1" class="lien2">'.$i.'</a></font>&nbsp;';
   $i++;
  }
  echo '<font size="1"><b> '.$i.' </b></font>&nbsp;';
  $i++;
  while ($i<=ceil($nbre/ $thumb_aff))
  {
   echo '<font size="1"><a href="index.php?l='.$l.'&start='.($thumb_aff * ($i - 1)).'&sel=1" class="lien2">'.$i.'</a></font>&nbsp;';
   $i++;
 }
 //  end navigation

 echo '</td></tr></table>';
 echo '</td></tr><td class="td0">&nbsp;';
  echo '</td></tr></table>';
}

?>