Poniżej kod funkcji:
Kod
$group = select('groups', 'id', 'premium_box = "1"', '', '');
for ($j=0; $j<count($group); $j++) {
$groups .= $group[$j]['id'];
if ($j != count($group)-1) $groups .= ', ';
}
if (count($group) > 0) {
$select = select('sites', 'id, title, description, url, date, `group`', '`group` in ('.$groups.') && active = "1"', '', '');
if (count($select) > 0) {
$select[0] = $select[rand(0, count($select)-1)];
if ($_GET['action'] == 'premium_box') {
$select[0]['count'] = count($select);
unset($_SESSION['group']);
$_SESSION['group'] = $group[0]['id'];
$check_group = select('groups', 'days', 'id = "'.$select[0]['group'].'"', '', '');
if ($check_group[0]['days'] == 0) $select[0]['time'] = time();
else $select[0]['time'] = $select[0]['date']+($check_group[0]['days']*24*60*60);
}
if ($GLOBALS['cfg']['box_premium_link'] == 0) $select[0]['link'] = url('site', $select[0]['title'], $select[0]['id']);
else $select[0]['link'] = $select[0]['url'];
}
}
return $select;
for ($j=0; $j<count($group); $j++) {
$groups .= $group[$j]['id'];
if ($j != count($group)-1) $groups .= ', ';
}
if (count($group) > 0) {
$select = select('sites', 'id, title, description, url, date, `group`', '`group` in ('.$groups.') && active = "1"', '', '');
if (count($select) > 0) {
$select[0] = $select[rand(0, count($select)-1)];
if ($_GET['action'] == 'premium_box') {
$select[0]['count'] = count($select);
unset($_SESSION['group']);
$_SESSION['group'] = $group[0]['id'];
$check_group = select('groups', 'days', 'id = "'.$select[0]['group'].'"', '', '');
if ($check_group[0]['days'] == 0) $select[0]['time'] = time();
else $select[0]['time'] = $select[0]['date']+($check_group[0]['days']*24*60*60);
}
if ($GLOBALS['cfg']['box_premium_link'] == 0) $select[0]['link'] = url('site', $select[0]['title'], $select[0]['id']);
else $select[0]['link'] = $select[0]['url'];
}
}
return $select;
Kto pomoże, temu podziękuje

