Mitarbeiter nur von User sehen die Angemldet sind.
Verfasst: 14.05.2004 02:25
Wie bekomme ich es hin wenn nur User die in Forum angemeldet sind nur die Funktion Mitarbeiter nutzten können.
Der Code sieht so aus:
Jetzt möchte ich wenn diese Bedienung nicht erfühlt wird
Das der Benutzer zu der login.php gelangt und wenn er sich angemeldet hat zu der MitarbeiterFunktion zurück kommt.
Was oder wie muss ich ändern?
Danke für die Hilfe
Der Code sieht so aus:
Code: Alles auswählen
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_STAFF);
init_userprefs($userdata);
$page_title = $lang['Staff'];
include('includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => 'staff_body.tpl',
));
$is_auth_ary = array();
$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_data);
$ignored_user = '10,11';
$sql_forums = "SELECT ug.user_id, f.forum_id, f.forum_name
FROM ". AUTH_ACCESS_TABLE ." aa, ". USER_GROUP_TABLE ." ug, ". FORUMS_TABLE ." f
WHERE aa.auth_mod = ". TRUE . "
AND user_id NOT IN ($ignored_user)
AND ug.group_id = aa.group_id
AND f.forum_id = aa.forum_id";
if( !$result_forums = $db->sql_query($sql_forums) )
{
message_die(GENERAL_ERROR, 'Could not query forums.', '', __LINE__, __FILE__, $sql_forums);
}
while( $row = $db->sql_fetchrow($result_forums) )
{
$display_forums = ( $is_auth_ary[$row['forum_id']]['auth_view'] ) ? true : false;
if( $display_forums )
{
$forum_id = $row['forum_id'];
$staff2[$row['user_id']][$row['forum_id']] = '<a href="'. append_sid("viewforum.$phpEx?f=$forum_id") .'" class="genmed">'. $row['forum_name'] .'</a><br />';
}
}
$sql_ranks = "SELECT * FROM ". RANKS_TABLE ." ORDER BY rank_special, rank_min";
if( !($results_ranks = $db->sql_query($sql_ranks)) )
{
message_die(GENERAL_ERROR, "Could not obtain ranks information.", '', __LINE__, __FILE__, $sql_ranks);
}
$ranksrow = array();
while( $row = $db->sql_fetchrow($results_ranks) )
{
$ranksrow[] = $row;
}
$db->sql_freeresult($result);
$level_cat = $lang['Staff_level'];
for( $i = 0; $i < count($level_cat); $i++ )
{
$user_level = $level_cat[$i];
$template->assign_block_vars('user_level', array(
'USER_LEVEL' => $user_level,
));
if( $level_cat['0'] )
{
$where = 'user_level = '. ADMIN;
}
else if( $level_cat['1'] )
{
$where = 'user_level = '. MOD;
}
else if( $level_cat['3'] )
{
$where = 'user_level = '. User;
}
else if( $level_cat['4'] )
{
$special_users = '0,1,2,3,4,5,6,7,8,9,10'; // ID der User eintragen; mit Komma trennen
$where = 'user_id IN ('.$special_users.')';
}
$level_cat[$i] = '';
$ignored_user = '10,11';
$sql_user = "SELECT * FROM ". USERS_TABLE ." WHERE $where AND user_id NOT IN ($ignored_user)";
if( !($result_user = $db->sql_query($sql_user)) )
{
message_die(GENERAL_ERROR, 'Could not obtain user information.', '', __LINE__, __FILE__, $sql_user);
}
if( $staff = $db->sql_fetchrow($result_user) )
{
$k = 0;
do
{
$row_class = ( !($k % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$user_id = $staff['user_id'];
$rank = '';
$rank_image = '';
if( $staff['user_rank'] )
{
for( $j = 0; $j < count($ranksrow); $j++ )
{
if( $staff['user_rank'] == $ranksrow[$j]['rank_id'] && $ranksrow[$j]['rank_special'] )
{
$rank = $ranksrow[$j]['rank_title'];
$rank_image = ( $ranksrow[$j]['rank_image'] ) ? '<img src="'. $ranksrow[$j]['rank_image'] .'" alt="'. $rank .'" title="'. $rank .'" border="0" />' : '';
}
}
}
else
{
for( $j = 0; $j < count($ranksrow); $j++ )
{
if( $staff['user_posts'] >= $ranksrow[$j]['rank_min'] && !$ranksrow[$j]['rank_special'] )
{
$rank = $ranksrow[$j]['rank_title'];
$rank_image = ( $ranksrow[$j]['rank_image'] ) ? '<img src="'. $ranksrow[$j]['rank_image'] .'" alt="'. $rank .'" title="'. $rank .'" border="0" />' : '';
}
}
}
$avatar = '';
if( $staff['user_avatar'] )
{
switch( $staff['user_avatar_type'] )
{
case USER_AVATAR_UPLOAD:
$avatar = ( $board_config['allow_avatar_upload'] ) ? '<img src="'. $board_config['avatar_path'] .'/'. $staff['user_avatar'] .'" border="0" />' : '';
break;
case USER_AVATAR_REMOTE:
$avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="'. $staff['user_avatar'] .'" width="50" height="50" border="0" />' : '';
break;
case USER_AVATAR_GALLERY:
$avatar = ( $board_config['allow_avatar_local'] ) ? '<img src="'. $board_config['avatar_gallery_path'] .'/'. $staff['user_avatar'] .'" border="0" />' : '';
break;
}
}
$forums = '';
if( !empty($staff2[$staff['user_id']]) )
{
asort($staff2[$staff['user_id']]);
$forums = implode(' ',$staff2[$staff['user_id']]);
}
$sql_posts = "SELECT DISTINCT p.post_time, p.post_id, count(DISTINCT t.topic_id) AS user_topics
FROM ". POSTS_TABLE ." p, ". TOPICS_TABLE ." t
WHERE p.poster_id = '$user_id' AND t.topic_poster = '$user_id'
GROUP BY p.post_time
ORDER BY p.post_time DESC LIMIT 1";
if( !($results_posts = $db->sql_query($sql_posts)) )
{
message_die(GENERAL_ERROR, 'Error getting user last post.', '', __LINE__, __FILE__, $sql_posts);
}
$row = $db->sql_fetchrow($results_posts);
$last_post = ( isset($row['post_time']) ) ? '<a href="'. append_sid("viewtopic.$phpEx?". POST_POST_URL ."=$row[post_id]#$row[post_id]") .'" class="gensmall">'. create_date($board_config['default_dateformat'], $row['post_time'], $board_config['board_timezone']) .'</a>' : $lang['None'];
$user_topics = $row['user_topics'];
$memberdays = max(1, round( ( time() - $staff['user_regdate'] ) / 86400 ));
$posts_per_day = $staff['user_posts'] / $memberdays;
$topics_per_day = $user_topics / $memberdays;
if( $staff['user_posts'] != '0' )
{
$total_posts = get_db_stat('postcount');
$total_topics = get_db_stat('topiccount');
$post_percent = ( $total_posts ) ? min(100, ($staff['user_posts'] / $total_posts) * 100) : 0;
$topic_percent = ( $total_topics ) ? min(100, ($user_topics / $total_topics) * 100) : 0;
}
else
{
$post_percent = 0;
$topic_percent = 0;
}
$pmto = append_sid("privmsg.$phpEx?mode=post&" . POST_USERS_URL . "=$staff[user_id]");
$pm = '<a href="' . $pmto . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>';
$mailto = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&" . POST_USERS_URL .'=' . $staff['user_id']) : 'mailto:' . $staff['user_email'];
$mail = ( $staff['user_email'] ) ? '<a href="' . $mailto . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" border="0" /></a>' : '';
$msn = ( $staff['user_msnm'] ) ? '<a href="mailto: '.$staff['user_msnm'].'"><img src="' . $images['icon_msnm'] . '" alt="' . $lang['MSNM'] . '" title="' . $lang['MSNM'] . '" border="0" /></a>' : '';
$yim = ( $staff['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $staff['user_yim'] . '&.src=pg"><img src="' . $images['icon_yim'] . '" alt="' . $lang['YIM'] . '" title="' . $lang['YIM'] . '" border="0" /></a>' : '';
$aim = ( $staff['user_aim'] ) ? '<a href="aim:goim?screenname=' . $staff['user_aim'] . '&message=Hello+Are+you+there?"><img src="' . $images['icon_aim'] . '" alt="' . $lang['AIM'] . '" title="' . $lang['AIM'] . '" border="0" /></a>' : '';
$icq = ( $staff['user_icq'] ) ? '<a href="http://wwp.icq.com/scripts/contact.dll?msgto=' . $staff['user_icq'] . '"><img src="' . $images['icon_icq'] . '" alt="' . $lang['ICQ'] . '" title="' . $lang['ICQ'] . '" border="0" /></a>' : '';
$www = ( $staff['user_website'] ) ? '<a href="' . $staff['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['Visit_website'] . '" title="' . $lang['Visit_website'] . '" border="0" /></a>' : '';
$template->assign_block_vars('user_level.staff', array(
'ROW_CLASS' => $row_class,
'USERNAME' => $staff['username'],
'U_PROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$staff[user_id]"),
'RANK' => $rank,
'RANK_IMAGE' => $rank_image,
'AVATAR' => $avatar,
'FORUMS' => $forums,
'POSTS' => $staff['user_posts'],
'POST_PERCENT' => sprintf($lang['User_post_pct_stats'], $post_percent),
'POSTS_PER_DAY' => sprintf($lang['User_post_day_stats'], $posts_per_day),
'TOPICS' => $user_topics,
'TOPIC_PERCENT' => sprintf($lang['User_post_pct_stats'], $topic_percent),
'TOPICS_PER_DAY' => sprintf($lang['Staff_user_topic_day_stats'], $topics_per_day),
'LAST_POST' => $last_post,
'JOINED' => create_date($board_config['default_dateformat'], $staff['user_regdate'], $board_config['board_timezone']),
'PERIOD' => sprintf($lang['Staff_period'], $memberdays),
'PM' => $pm,
'EMAIL' => $mail,
'MSN' => $msn,
'YIM' => $yim,
'AIM' => $aim,
'ICQ' => $icq,
'WWW' => $www,
));
$k++;
}
while( $staff = $db->sql_fetchrow($result_user) );
}
}
$template->assign_vars(array(
'L_USERNAME' => $lang['Username'],
'L_FORUMS' => $lang['Staff_forums'],
'L_STATS' => $lang['Staff_stats'],
'L_POSTS' => $lang['Posts'],
'L_TOPICS' => $lang['Topics'],
'L_LAST_POST' => $lang['Last_Post'],
'L_JOINED' => $lang['Joined'],
'L_CONTACT' => $lang['Staff_contact'],
'L_MESSENGER' => $lang['Staff_messenger'],
'L_WWW' => $lang['Website'],
));
$template->pparse('body');
include('includes/page_tail.'.$phpEx);
?>Jetzt möchte ich wenn diese Bedienung nicht erfühlt wird
Code: Alles auswählen
if( ($userdata['session_logged_in']) and ($userdata['user_level'] == ADMIN) || ($userdata['user_level'] == MODDER) || ($userdata['user_level'] == USER))
Was oder wie muss ich ändern?
Danke für die Hilfe