MODs: Ja
Dein Wissensstand: Einsteiger
Link zu Deinem Forum: [url]http://[/url]
PHP Version:
MySQL Version:
Was hast Du gemacht, bevor das Problem aufgetreten ist?
Einbau Problem
Was hast Du bereits versucht um das Problem zu lösen?
Fehlerbeschreibung und Nachricht
Ich hab doch mal gesucht, wo ich ein Forum Passwort geschützt machen kann! Damals wurde mir nur das für Beiträge gegeben! Jetzt hab ich gefunden was ich suche!
Da tauchen dann auch gleich ein paar Probleme auf!
Code: Alles auswählen
#
#-----[ OPEN ]--------------------------------------------
#
search.php
#
#-----[ FIND ]--------------------------------------------
#
$auth_sql = '';
if ( $search_forum != -1 )
{
$is_auth = auth(AUTH_READ, $search_forum, $userdata);
if ( !$is_auth['auth_read'] )
#
#-----[ REPLACE WITH ]------------------------------------
#
$passdata = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_fpass']) ) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_fpass'])) : '';
$auth_sql = '';
if ( $search_forum != -1 )
{
$is_auth = auth(AUTH_ALL, $search_forum, $userdata);
$has_access = true;
if( !$is_auth['auth_mod'] && $userdata['user_level'] != ADMIN )
{
$sql = "SELECT forum_password FROM " . FORUMS_TABLE . " WHERE forum_id = " . $search_forum;
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not retrieve forum password information', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if( $row['forum_password'] != '' && $passdata[$key] != md5($row['forum_password']) )
{
$has_access = false;
}
}
if ( !$is_auth['auth_read'] || !$has_access )
#
#-----[ FIND ]--------------------------------------------
#
$is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
if ( $search_cat != -1 )
{
#
#-----[ REPLACE WITH ]------------------------------------
#
$is_auth_ary = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata);
if ( $search_cat != -1 )
{
#
#-----[ FIND ]--------------------------------------------
#
$ignore_forum_sql = '';
while( list($key, $value) = each($is_auth_ary) )
{
if ( !$value['auth_read'] )
#
#-----[ REPLACE WITH ]------------------------------------
#
$ignore_forum_sql = '';
while( list($key, $value) = each($is_auth_ary) )
{
$has_access = true;
if( !$is_auth['auth_mod'] && $userdata['user_level'] != ADMIN )
{
$sql = "SELECT forum_password FROM " . FORUMS_TABLE . " WHERE forum_id = " . $key;
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not retrieve forum password information', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if( $row['forum_password'] != '' && $passdata[$key] != md5($row['forum_password']) )
{
$has_access = false;
}
}
if ( !$value['auth_read'] || !$has_access )Code: Alles auswählen
#
#-----[ OPEN ]--------------------------------------------
#
admin/admin_forums.php
#
#-----[ FIND ]--------------------------------------------
#
if( !empty($mode) )
{
switch($mode)
{
#
#-----[ BEFORE, ADD ]-------------------------------------
#
if( !empty($HTTP_POST_VARS['password']) )
{
if( !preg_match("#^[A-Za-z0-9]{3,20}$#si", $HTTP_POST_VARS['password']) )
{
message_die(GENERAL_MESSAGE, $lang['Only_alpha_num_chars']);
}
}Code: Alles auswählen
if( !empty($mode) )
{
//-- mod : categories hierarchy --------------------------------------------------------------------
//-- add
admin_check_cat();
get_user_tree($userdata);
//-- fin mod : categories hierarchy ----------------------------------------------------------------
switch($mode)
{Und dann soll ich Sachen in der session.php einfügen. Die gibt es aber 2 mal. Immer das erste mal?
Hier mal der Code dafür:
Code: Alles auswählen
#
#-----[ OPEN ]--------------------------------------------
#
includes/sessions.php
#
#-----[ FIND ]--------------------------------------------
#
setcookie($cookiename . '_data', serialize($sessiondata), $current_time + 31536000, $cookiepath, $cookiedomain, $cookiesecure);
setcookie($cookiename . '_sid', $session_id, 0, $cookiepath, $cookiedomain, $cookiesecure);
#
#-----[ AFTER, ADD ]--------------------------------------
#
setcookie($cookiename . '_fpass', '', $current_time - 31536000, $cookiepath, $cookiedomain, $cookiesecure);
#
#-----[ FIND ]--------------------------------------------
#
setcookie($cookiename . '_data', '', $current_time - 31536000, $cookiepath, $cookiedomain, $cookiesecure);
setcookie($cookiename . '_sid', '', $current_time - 31536000, $cookiepath, $cookiedomain, $cookiesecure);
#
#-----[ AFTER, ADD ]--------------------------------------
#
setcookie($cookiename . '_fpass', '', $current_time - 31536000, $cookiepath, $cookiedomain, $cookiesecure);