Проблем при връзката на сайт и форум

  • Автор Автор SuX
  • Начална дата Начална дата

SuX

Registered
Проблем със сайта и форума...Понеже човека, който питах е доста зает както винаги (за което се извинявам) имам проблем с това свързване:

тоест от единя урок за итегриране имаше ей това:
Код:
<? 
define('IN_PHPBB', true); 
$phpbb_root_path ='forum/'; 
include($phpbb_root_path . 'config.php'); 
include($phpbb_root_path . 'extension.inc'); 
include($phpbb_root_path . 'common.'.$phpEx); 
$userdata = session_pagestart($user_ip, PAGE_INDEX); 
?>

да се сложи в index.php(при мен е така) и вече може да се вади информацията на сайта какво и във форума обаче нещо не се получава.

сайта ми е в главната директория а форума в папка форум тоест това условие $phpbb_root_path ='forum/'; е вярно каде може да е проблема?

Пробвах с echo ($userdata['username']);(при ЛС съм сбъркал двапати echo-to не при кода ) да видя да ли ще ме изпише, но не резултата е Anonymous

Някакви идей :)
 
Код:
 <? 
define('IN_PHPBB', true); 
$phpbb_root_path ='forum/'; 
include($phpbb_root_path . 'config.php'); 
include($phpbb_root_path . 'extension.inc'); 
include($phpbb_root_path . 'common.'.$phpEx); 
$userdata = session_pagestart($user_ip, PAGE_INDEX); 
?> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb">
<head>
<title>blabla</title>
<script type="text/javascript" src="scrollOperator.js"></script> 
</head>
<body  background="background.jpg" link="green" vlink="Black">
<br />
<? 
include("menu.php");
?>
<br />
<center>
<table border="1" width="80%" background="pics/stats.jpg" cellspacing="2" cellpadding="2" >

	<tr align="left" >
		<td width="40%" >
			<div id="lastforumnews"> 
<?php 

$connection = mysql_connect("localhost", "...", "...."); 
$db = mysql_select_db("phpbb", $connection); 

$query = mysql_query("select * from phpbb_topics order by topic_last_post_id desc limit 0,20"); 
while($rows = mysql_fetch_array($query)) 
{ 
print "<br>"; 
print "<font color='red'>new</font>"; 
$forum = $rwz[forum_name]; 
$catid = $rwz[cat_id]; 
$qry2 = mysql_query("select * from phpbb_categories where cat_id='$catid'"); 
$rwz2 = mysql_fetch_array($qry2); 
$cat = $rwz2[cat_title]; 
if (strlen($rows[topic_title])>1){ 
printf("<a style='text-decoration: none; font-size: 11px;' href=\"http://site/viewtopic.php?t=%d\">%s %s</a></font> <font color='gray' style='font-size: 12px'>(%d)</font>", $rows[topic_id], $cat, ((strlen($rows[topic_title])>42)?substr($rows[topic_title],0,42)."...": $rows[topic_title]), $rows[topic_replies]); 
} 
} 

?></div> 

<script type="text/javascript"> 
new SetScrollOperator('lastforumnews',[400,150],2); </script>
	</td>
		<td  valign="top">
		<center><font color="Red" style="text-decoration:none;">Статистика</font></center>
		<? if ( $userdata["user_level"] == 1  )
		{ 
		?>
		<a style="text-decoration:none;" href='admin.php'>Админ</a><font color='Green'> ! </font>
		<? 
		} 
		?>
		<?
		echo $userdata['username'];
		?>
		</td>
	</tr>

		<tr>		
			<td colspan="3">
				dadad ada dad asd a
				</font></center>
			</td>
		</tr>
</table>

<?
include("footer.php");
?>

</body>
</html>
 
Я пробвай така.
Да видя като го сложиш веднага след кода какво ще стане:


<?
define('IN_PHPBB', true);
$phpbb_root_path ='forum/';
include($phpbb_root_path . 'config.php');
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
echo $userdata['username'];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb">
<head>
<title>blabla</title>
<script type="text/javascript" src="scrollOperator.js"></script>
</head>
<body background="background.jpg" link="green" vlink="Black">
<br />
<?
include("menu.php");
?>
<br />
<center>
<table border="1" width="80%" background="pics/stats.jpg" cellspacing="2" cellpadding="2" >

<tr align="left" >
<td width="40%" >
<div id="lastforumnews">
<?php

$connection = mysql_connect("localhost", "...", "....");
$db = mysql_select_db("phpbb", $connection);

$query = mysql_query("select * from phpbb_topics order by topic_last_post_id desc limit 0,20");
while($rows = mysql_fetch_array($query))
{
print "<br>";
print "<font color='red'>new</font>";
$forum = $rwz[forum_name];
$catid = $rwz[cat_id];
$qry2 = mysql_query("select * from phpbb_categories where cat_id='$catid'");
$rwz2 = mysql_fetch_array($qry2);
$cat = $rwz2[cat_title];
if (strlen($rows[topic_title])>1){
printf("<a style='text-decoration: none; font-size: 11px;' href=\"http://site/viewtopic.php?t=%d\">%s %s</a></font> <font color='gray' style='font-size: 12px'>(%d)</font>", $rows[topic_id], $cat, ((strlen($rows[topic_title])>42)?substr($rows[topic_title],0,42)."...": $rows[topic_title]), $rows[topic_replies]);
}
}

?></div>

<script type="text/javascript">
new SetScrollOperator('lastforumnews',[400,150],2); </script>
</td>
<td valign="top">
<center><font color="Red" style="text-decoration:none;">Статистика</font></center>
<? if ( $userdata["user_level"] == 1 )
{
?>
<a style="text-decoration:none;" href='admin.php'>Админ</a><font color='Green'> ! </font>
<?
}
?>
<?
echo $userdata['username'];
?>
</td>
</tr>

<tr>
<td colspan="3">
dadad ada dad asd a
</font></center>
</td>
</tr>
</table>

<?
include("footer.php");
?>

</body>
</html>[/code]
 
изписва горе в ляво с млки букви Anonymous :)

Едитнах си php файка като риплейснах ето това само

Код:
<? 
define('IN_PHPBB', true); 
$phpbb_root_path ='forum/'; 
include($phpbb_root_path . 'config.php'); 
include($phpbb_root_path . 'extension.inc'); 
include($phpbb_root_path . 'common.'.$phpEx); 
$userdata = session_pagestart($user_ip, PAGE_INDEX); 
?>

И тръгна работеше докато не ссе логаутнах... После и да съм логин пак си е Anonymous :( да не би да липсва нещо-много странно
 
Прегледай хубаво кода да не си изпуснал нещо!

Сигурен ли си, че са само тези include-и да не ти липсва там нещо точно в този скрипт ?
 
4Karry каза:
Прегледай хубаво кода да не си изпуснал нещо!

Сигурен ли си, че са само тези include-и да не ти липсва там нещо точно в този скрипт ?

Ами нз според мен само тези са. Прегледах кода както и урока от който съм зел скрипта и всичко трябва да е наред...

Нз защо така се получава...
 

Back
Горе