Показать сообщение отдельно

  #8  
Старый 07.03.2008, 20:53
cash$$$
Banned
Регистрация: 06.01.2008
Сообщений: 413
Провел на форуме:
1301036

Репутация: 1334
Отправить сообщение для cash$$$ с помощью ICQ
По умолчанию

Блок авторизации для форума IPB
Как установить:
-Создаем в директории block файл b-Login.php со следующим содержанием:
PHP код:
<?php 
if (!defined("DNREAD")) exit(); 
global 
$setting,$tm,$db,$basepref,$usermain
$block_cont ""
if(
$usermain['logged']==&& $usermain['uname']!="") { 
$block_cont.= "<form action=\"forum/index.php?act=Login&amp;CODE=03&amp;k=\" method=\"post\" target=\"_top\"><input type=\"hidden\" name=\"CookieDate\" value=\"1\"> 
\n"

$block_cont.= "<table width=\"125\" cellpadding=\"4\" cellspacing=\"1\" border=\"0\" align=\"center\">\n"
$block_cont.= "<tr>\n"
$block_cont.= "<td class=\"row1\" align=\"center\">\n"
$block_cont.= "<p align=\"center\">Добро пожаловать!<hr><p align=\"center\"><img border=\"0\" src=\"forum/style_avatars/".$usermain['avatar']."\"></p>\n Уважаемый <b>".$usermain['uname']."</b>!<br/><br>\n"
$block_cont.= "</td>\n"
$block_cont.= "</tr>\n"
$block_cont.= "</table>\n"
$block_cont.= "</form>\n"
return 
$block_cont


else { 
$block_cont.= "<table width=\"125\" cellpadding=\"4\" cellspacing=\"1\" border=\"0\" align=\"center\">\n"
$block_cont.= "<tr>\n"
$block_cont.= "<td class=\"row1\" align=\"center\">\n"
$block_cont.= "<p align=\"center\">Добро пожаловать!<hr/>Уважаемый <b>Гость</b>!<br/><br/>\n"
$block_cont.= "Для полноценного просмотра сайта, авторизируйтесь: <hr></td>\n"
$block_cont.= "</tr>\n"
$block_cont.= "</table>\n"
$block_cont.= "<form action=\"forum/index.php?act=Login&amp;CODE=01\" method=\"post\">\n"
$block_cont.= "<table width=\"125\" cellpadding=\"4\" cellspacing=\"1\" border=\"0\" align=\"center\">\n"
$block_cont.= "<tr>\n"
$block_cont.= "<td class=\"row1\">\n"
$block_cont.= "<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" width=\"100%\">\n"
$block_cont.= "<tr>\n"
$block_cont.= "<td colspan=\"2\" align=\"center\">\n"
$block_cont.= "</td>\n"
$block_cont.= "</tr>\n"
$block_cont.= "<tr>\n"
$block_cont.= "<td width=\"125\" align=\"right\">\n"
$block_cont.= "<span class=\"sub3\">Логин:</span>\n"
$block_cont.= "</td>\n"
$block_cont.= "<td>\n"
$block_cont.= "<input type=\"text\" name=\"UserName\" class=\"post\" size=\"10\" maxlength=\"40\" value=\"\">\n"
$block_cont.= "</td>\n"
$block_cont.= "</tr>\n"
$block_cont.= "<tr>\n"
$block_cont.= "<td align=\"right\" width=\"125\">\n"
$block_cont.= "<span class=\"sub3\">Пароль:</span>\n"
$block_cont.= "</td>\n"
$block_cont.= "<td>\n"
$block_cont.= "<input type=\"password\" class=\"post\" name=\"PassWord\" size=\"10\" maxlength=\"32\">\n"
$block_cont.= "</td>\n"
$block_cont.= "</tr>\n"
$block_cont.= "<tr align=\"center\">\n"
$block_cont.= "<td colspan=\"2\">\n"
$block_cont.= "<input type=\"hidden\" name=\"CookieDate\" value=\"1\"> 
<input onmouseover=\"this.className='rerbutton';\" onmouseout=\"this.className='rbutton';\" class=\"rbutton\" value=\" Войти \" type=\"submit\">\n"

$block_cont.= "\n"
$block_cont.= "</td>\n"
$block_cont.= "</tr>\n"
$block_cont.= "<tr align=\"center\">\n"
$block_cont.= "<td colspan=\"2\">\n"
$block_cont.= "<span class=\"smalllink\"><a href=\"forum/index.php?act=Reg&CODE=10\" class=\"sub3\"><hr> Забыли пароль?</a></span>\n"
$block_cont.= "</td>\n"
$block_cont.= "</tr>\n"
$block_cont.= "</table>\n"
$block_cont.= "</td>\n"
$block_cont.= "</tr>\n"
$block_cont.= "</table>\n"
$block_cont.= "<table width=\"125\" cellpadding=\"4\" cellspacing=\"1\" border=\"0\" class=\"forumline\" align=\"center\" id=\"table1\">\n"
$block_cont.= "<tr>\n"
$block_cont.= "<th height=\"25\" class=\"smalllink\" nowrap=\"nowrap\">\n"
$block_cont.= "<a class=\"sub3\" href=\"forum/index.php?act=Reg&CODE=00\">Новая\n"
$block_cont.= "регистрация</a><hr></th>\n"
$block_cont.= "</tr>\n"
$block_cont.= "</table>\n"
$block_cont.= "</form>\n"

return 
$block_cont
?>
Затем файл base/userbase/user.ipb.php заменить этим:
PHP код:
## WWW : www.danneo.com | www.danneo.org                ## 
## E-MAIL : help@danneo.com                             ## 
## ==================================================== */ 
if(!defined("DNREAD")) exit(); 
// Тестировалось на Invision Power Board v2.1.4 - 2.1.6 
// UNSET IPB & NEW ARRAY 
unset($ipb); $ipb = array(); 
################################### 
#         Форум фреймворкс        # 
################################### 
$ipb['dbname'] = 'tbl_old';           // НАЗВАНИЕ БАЗЫ 
$ipb['dbpref'] = 'ibf_';          // ПРЕФИКС БАЗЫ 
$ipb['lastact'] = 7200;           // ВРЕМЯ АКТИВНОСТИ СЕССИИ 
$ipb['cookie'] = '';              // ПРЕФИКС КУКИ 
################################### 
#            USER FORM            # 
################################### 
define('FORUMFORM','ipb.form'); 
// FORUM BASE 
$db->select($ipb['dbname'],0); 
// FORUM BASE 
// APANEL TEST ? 
if(defined("DNTEST")){ return $connet $db->works; } 
// APANEL TEST ? 
// THIS WORKS ? 
if($db->works==1){ 
// TOTAL 
$ipb['time'] = NEWTIME
$ipb['agent'] = substr($_SERVER['HTTP_USER_AGENT'],0,200); 
$ipb['ip'] = substr($_SERVER['REMOTE_ADDR'],0,16); 
$ipb['sessid'] = isset($_COOKIE[$ipb['cookie'].'session_id']) ? $_COOKIE[$ipb['cookie'].'session_id'] : ''
$ipb['passhash'] = isset($_COOKIE[$ipb['cookie'].'pass_hash']) ? $_COOKIE[$ipb['cookie'].'pass_hash'] : ''
// TEST 
if(!empty($ipb['sessid'])){ 
$ipbsess $db->fetchrow($db->query("SELECT * FROM ".$ipb['dbpref']."sessions WHERE id='".addslashes($ipb['sessid'])."' 
                                     AND running_time > "
.($ipb['time'] - $ipb['lastact'])." AND browser='".addslashes($ipb['agent'])."'")); 
} else { 
$ipbsess['member_id']=0

// NORMAL 
if(!empty($ipb['sessid']) && !empty($ipb['passhash']) && $ipbsess['member_id'] > 0){ 
// USER 
$ipbuser $db->fetchrow($db->query("SELECT id,name,email,member_login_key 
                                     FROM "
.$ipb['dbpref']."members WHERE id ='".$ipbsess['member_id']."'")); 
$ipphoto $db->fetchrow($db->query("SELECT avatar_location 
                                     FROM "
.$ipb['dbpref']."member_extra WHERE id ='".$ipbsess['member_id']."'")); 

// ISSET 
if($ipbuser['id'] && $ipbuser['name'] && $ipbuser['email'] && $ipbuser['member_login_key']==$ipb['passhash']){ 
// UPDATE 
$db->query("UPDATE ".$ipb['dbpref']."sessions SET browser='".addslashes($ipb['agent'])."',running_time='".$ipb['time']."' 
            WHERE id = '"
.addslashes($ipbsess['member_id'])."'"); 
// DATA 
$usermain = array('logged'=>1
                  
'userid'=>$ipbuser['id'], 
                  
'uname'=>$ipbuser['name'], 
                  
'umail'=>$ipbuser['email'], 
                  
'avatar'=>$ipphoto['avatar_location'], 
                  
'regdate'=>''
                  
'lastvisit'=>''
                  
'icq'=>''
                  
'msn'=>''
                  
'www'=>''
                  
'blocked'=>''); 
// DATA 

// ISSET 

// NORMAL 
// THIS WORKS ? 

// RETURN CMS BASE 
$db->select($namebase,1); 
// RETURN CMS BASE 
// UNSET IPB 
unset($ipb); 
?> 
Вывод последних тем с форума IPB
PHP код:
<?php 
if(!defined("DNREAD")) exit(); 

//******************************************************************************** 
//              БЛОК ВЫВОДА ПОСЛЕДНИХ СООБЩЕНИЙ С ФОРУМА 
//                            INVISION POWER BOARD 2.0.x , 2.1.x 
//                                        Разработка oleg_matasov 
// 
//                                        admin@tbilisskaya.com 
//******************************************************************************** 

//======[ОСНОВНЫЕ НАСТРОЙКИ]====== 
    //Префикс таблицы с IPB 
    
$prefix 'ibf'
    
//Сколько тем выводить 
    
$num 10
    
//Сколько символов оставить в названии темы после урезания 
    
$topic_num_sym 40
    
//Имя папки с картинками текущего скина 
    
$img_path '1'
    
//Формат времени 
    
$time 'd.m H:i'
    
//Форумы, которые мы не трогаем 
    
$forumexclude '11,21'
    
//Сервер БД на котором висит база форума 
    
$host="localhost"
    
//Имя БД 
    
$database="tbl_old"
    
//Логин БД 
    
$username="root"
    
//Пароль БД 
    
$password=""
     
//====[Если не знаем PHP - дальше ничего не трогаем :)]========= 

$ipb_db mysql_pconnect($host$username$password) or trigger_error(mysql_error(), E_USER_ERROR); 
mysql_select_db($database$ipb_db); 
$bt "<table width=\"100%\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\" bgcolor=\"#dee2e5\">"
$bt.= "<th width=\"60%\" height=\"26\" align=\"center\"><font class=\"storytitle\">Название темы</font></th>"
$bt.= "<th width=\"10%\" height=\"26\" align=\"center\"><font class=\"storytitle\"><b>Автор</b></font></th>"
$bt.= "<th width=\"5%\" height=\"26\" align=\"center\"><font class=\"storytitle\">Ответов</font></th>"
$bt.= "<th width=\"5%\" height=\"26\" align=\"center\"><font class=\"storytitle\">Просмотров</font></th>"
$bt.= "<th width=\"20%\" height=\"26\" align=\"center\" colspan=\"2\"><font class=\"storytitle\"><b>Последний ответ</b></font></th>"
$resultf mysql_query("SELECT tid, title, description, state, posts, starter_id, last_poster_id, last_post, icon_id, starter_name, last_poster_name, views, topic_hasattach FROM ".$prefix."_topics WHERE (forum_id NOT IN ($forumexclude)) ORDER BY last_post DESC LIMIT $num",$ipb_db) or die(mysql_error()); 
$row_resultf mysql_fetch_assoc($resultf); 
$totalRows_resultf mysql_num_rows($resultf); 
do { 
    
$topicstrip $row_resultf['title']; 
    if (
strlen($topicstrip) > $topic_num_sym) { 
        
$topicstrip substr($topicstrip,0,$topic_num_sym); 
        
$topicstrip $topicstrip."..."
    } 
    
$status = ($row_resultf['state'] == "closed") ? "<img src=\"forum/style_images/$img_path/f_closed.gif\" border=\"0\" alt=\"Тема закрыта\">" ""
    
$attach = ($row_resultf['topic_hasattach'] == "1") ? "<img src=\"temp/A-Vector/images/files.gif\" border=\"0\" alt=\"В сообщении есть прикрепленные файлы\">&nbsp;" ""
    
$icon = ($row_resultf['icon_id'] == "0") ? "&nbsp;<img border=\"0\" src=\"temp/Default/images/icon.gif\">&nbsp; " "<img src=\"forum/style_images/$img_path/folder_post_icons/icon$icon_id.gif\" border=\"0\" alt=\"Иконка сообщения\"> "
    
$last_date date($time,$row_resultf['last_post']); 
    
$bt.= "<tr>"
    
$bt.= "<td bgcolor=\"#FFFFFF\">"
    
$bt.= "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#FFFFFF\"><tr>"
    
$bt.= "<td>$icon</td>"
    
$bt.= "<td width=\"100%\"><a title=\"".$row_resultf['description']."\" href=\"forum/index.php?showtopic=".$row_resultf['tid']."&view=getlastpost\">$topicstrip</a></td>"
    
$bt.= "<td align=\"center\" valign=\"middle\">$attach</td>"
    
$bt.= "<td align=\"center\" valign=\"middle\">$status</td>"
    
$bt.= "</tr></table></td>"
    
$bt.= "<td bgcolor=\"#FFFFFF\" align=\"center\"><a href=\"forum/index.php?showuser=".$row_resultf['starter_id']."\">".$row_resultf['starter_name']."</a></td>"
    
$bt.= "<td bgcolor=\"#FFFFFF\" align=\"center\">".$row_resultf['posts']."</td>"
    
$bt.= "<td bgcolor=\"#FFFFFF\" align=\"center\">".$row_resultf['views']."</td>"
    
$bt.= "<td bgcolor=\"#FFFFFF\" align=\"center\">$last_date</td>"
    
$bt.= "<td bgcolor=\"#FFFFFF\" align=\"center\"><a href=\"forum/index.php?showuser=".$row_resultf['last_poster_id']."\">".$row_resultf['last_poster_name']."</a></td>"
    
$bt.= "</tr>"
} while(
$row_resultf mysql_fetch_assoc($resultf)); 
$bt.= "</table>"
mysql_free_result($resultf); 
return 
$bt
?>
 
Ответить с цитированием