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

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

 if (empty($_SESSION['private_login']))
 {
 $album_level = 'a.level = 1';
 }
 else
 {
	if ($_SESSION['level'] == 'admin' || $_SESSION['level'] == 'all') $album_level = 'a.level > 0';
	else  $album_level = 'a.level = 1 OR a.level IN ('. $_SESSION['level'].')';
 }

 echo '<td class="td2" colspan="3" align="center">';
 echo '<table border="0" width="100%" cellpadding="1" cellspacing="0" class="td1" valign="top"><tr>';
 echo '<td class="td1" width="'.$thumb_width.'">';
 $query = "SELECT p.idalbum, p.file, p.album, p.author, p.title, p.id FROM mcgallery_albumphoto a, mcgallery_photo p WHERE $album_level AND p.idalbum = a.idalbum ORDER BY RAND()";
 $result = mysql_query($query);
 $rand = mysql_fetch_row($result);
 list($path1,$path2) = split('_', $rand[1],2);
 echo '<a href="show.php?rand=1&id='.$rand[5].'" onMouseOver="window.status=\'\';return true">';
 echo '<img src="photos/'.$rand[0].'/small/'.$path2.'" border="0" alt="" width="'.$thumb_width.'" align="middle" class="img2"></a></td>';
 echo '<td class="td2" valign="bottom">';
 echo '<font size="1">';
 if ($rand[4] != '') { echo '&nbsp;&nbsp;'.$l_Titre.': '.stripslashes($rand[4]).'<br>'; }
 if ($rand[3] != '') { echo '&nbsp;&nbsp;'.$l_Auteur.': '.stripslashes($rand[3]).'<br>'; }
 echo '&nbsp;&nbsp;'.$l_Album.': '.stripslashes($rand[2]); echo $table;
 echo '</font>';
 echo '</td></tr></table>';
 echo '</td></tr><tr>';
?>