Changeset 1082 for trunk/random.php
- Timestamp:
- Mar 15, 2006, 11:44:35 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/random.php
r1072 r1082 29 29 // | define and include | 30 30 // +-----------------------------------------------------------------------+ 31 31 32 define('PHPWG_ROOT_PATH','./'); 32 33 include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); … … 41 42 // +-----------------------------------------------------------------------+ 42 43 43 // we must not show pictures of a forbidden category44 $where = '';45 if ( $user['forbidden_categories'] != '' )46 {47 $where = 'WHERE category_id NOT IN ('.$user['forbidden_categories'].')';48 }49 50 44 $query = ' 51 45 SELECT DISTINCT(id) 52 46 FROM '.IMAGES_TABLE.' 53 47 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id 54 '.$where.' 48 '.( 49 $user['forbidden_categories'] != '' 50 ? 'WHERE category_id NOT IN ('.$user['forbidden_categories'].')' 51 : '' 52 ).' 55 53 ORDER BY RAND(NOW()) 56 54 LIMIT 0, '.$conf['top_number'].' 57 55 ;'; 58 $result = pwg_query($query); 59 $ids = array(); 60 while ($row = mysql_fetch_array($result)) 61 { 62 array_push($ids, $row['id']); 63 } 56 64 57 // +-----------------------------------------------------------------------+ 65 58 // | redirect | 66 59 // +-----------------------------------------------------------------------+ 67 $url = PHPWG_ROOT_PATH.'category.php?cat=list&list='.implode(',', $ids); 68 redirect( $url);60 61 redirect(make_index_URL(array('list' => array_from_query($query, 'id')))); 69 62 ?>
Note: See TracChangeset
for help on using the changeset viewer.