";
echo " ".$locale['XXX_002']." \n";
$result=dbquery("SELECT * FROM ".$db_prefix."users ORDER BY user_lastvisit DESC LIMIT 0,8");
if(dbrows($result)!=0){
while($data=dbarray($result)){
$lastseen=time()-$data['user_lastvisit'];
$iW=sprintf("%2d",floor($lastseen/604800));
$iD=sprintf("%2d",floor($lastseen/(60*60*24)));
$iH=sprintf("%02d",floor((($lastseen%604800)%86400)/3600));
$iM=sprintf("%02d",floor(((($lastseen%604800)%86400)%3600)/60));
$iS=sprintf("%02d",floor((((($lastseen%604800)%86400)%3600)%60)));
if($lastseen<60){
$lastseen="OnLine ";
}elseif($lastseen<360){
$lastseen="OffLine ";
}elseif($iW>0){
if($iW==1) $Text="".$locale['XXX_007']."";
elseif($iW==2 || $iW==3 || $iW==4) $Text="".$locale['XXX_011']."";
else $Text="".$locale['XXX_008']."";
$lastseen="$iW $Text ";
}elseif($iD>0){
if($iD==1) $Text="".$locale['XXX_009']."";
else $Text="".$locale['XXX_010']."";
$lastseen="$iD $Text ";
}else{
$lastseen="$iH:$iM:$iS";
}
if (!isset($start)) $start="";
echo "";
}
}
echo " Najnowsze Posty: \n";
if (!isset($usr_grps) || !isNum($usr_grps)) $usr_grps="";
$result = dbquery(
"SELECT tf.*, tt.*, tu.user_id,user_name,user_color,user_prefix FROM ".$db_prefix."forums tf
INNER JOIN ".$db_prefix."threads tt USING(forum_id)
INNER JOIN ".$db_prefix."users tu ON tt.thread_lastuser=tu.user_id
".$usr_grps." ORDER BY thread_lastpost DESC LIMIT 0,8");
if (dbrows($result) != 0) {
$i=0;
if ($theme_width == "100%") echo "\n";
while ($data = dbarray($result)) {
if ($i % 2 == 0) { $row_color = "tbl1"; } else { $row_color = "tbl1"; }
$new_posts = dbcount("(thread_id)", "posts", "thread_id='".$data['thread_id']."' and post_datestamp>'".(isset($lastvisited) ? $lastvisited : 0)."'");
//$thread_replies = dbcount("(thread_id)", "posts", "thread_id='".$data['thread_id']."'") - 1;
$thread_replies = $data['thread_replies'];
$forum_id = $data['forum_id'];
if ($new_posts > 0) {
$folder123 = " ";
} else if ($new_posts > 19) {
$folder123 = " ";
} else {
if ($data['thread_locked'] == 1) {
$folder123 = " ";
} else if ($data['thread_locked'] == 0) {
$folder123 = " ";
}
}
//$reply_count = dbcount("(thread_id)", "posts", "thread_id='".$data['thread_id']."'");
[color=red]$dbms = '[/color][color=green]mysql[/color][color=red]';[/color]
[color=red]$adr = '[/color][color=green]ADRES_FORUM_(np. http://www.lsfan.info/forum/)[/color][color=red]';[/color]
[color=red]$dbhost = '[/color][color=green]HOST[/color][color=red]';[/color]
[color=red]$dbname = '[/color][color=green]NAZWA_BAZY_DANYCH[/color][color=red]';[/color]
[color=red]$dbuser = '[/color][color=green]NAZWA_USERA_BAZY[/color][color=red]';[/color]
[color=red]$dbpasswd = '[/color][color=green]HASŁO_BAZY[/color][color=red]';[/color]
[color=red]$table_prefix = '[/color][color=green]phpbb_[/color][color=red]';[/color]
[color=red]
define('PHPBB_INSTALLED', true);
mysql_connect($dbhost, $dbuser, $dbpasswd) or
die('Nie moglem polaczyc sie z baza danych, sprobuj pozniej');
mysql_select_db($dbname) or
die('Mam problemy z wyborem bazy danych');
$zapytanie = "
SELECT t.topic_id, t.topic_title, t.topic_replies, t.topic_last_post_id,
p.poster_id, p.post_time, u.username, u.user_id
FROM ".$table_prefix."topics t, ".$table_prefix."posts p, ".$table_prefix."users u
WHERE p.post_id = t.topic_last_post_id
AND u.user_id = p.poster_id
ORDER BY t.topic_id DESC
LIMIT 5";
$wykonanie = mysql_query($zapytanie);
echo '';
$i = 2;
while( $row = mysql_fetch_array($wykonanie, MYSQL_ASSOC) )
{
// usuwamy ukośniki
$row['topic_title'] = stripslashes($row['topic_title']);
$row['username'] = stripslashes($row['username']);
// ucinamy przydługie tematy
$row['topictitle'] = ( strlen($row['topic_title']) > 26 ) ? substr($row['topic_title'], 0, 23) . "..." : $row['topictitle'];
// dobieramy kolor wiersza
$i % 2 == 1 ? $r = '' : $r = ' bgcolor=""';
// ustawiamy format daty
$data = date("d-m-Y H:i", $row['post_time']);
// link do ostatniego postu w temacie
$p = 'p=' . $row['topic_last_post_id'] . '#' . $row['topic_last_post_id'];
// link do tematu
$t = 't=' . $row['topic_id'];
echo'
' . $row['topic_title'] . '
';
$i++;
}
echo '
';
dbconnect($db_host, $db_user, $db_pass, $db_name);[/color]
$i++;
}
} else {
echo "".$locale['004']." \n";
}
echo "
Najnowsze Tematy \n";
$result = dbquery(
"SELECT tf.*, tt.*, tu.user_id,user_name FROM ".$db_prefix."forums tf
INNER JOIN ".$db_prefix."threads tt USING(forum_id)
INNER JOIN ".$db_prefix."users tu ON tt.thread_lastuser=tu.user_id
".$usr_grps." ORDER BY thread_views DESC LIMIT 0,8");
if (dbrows($result) != 0) {
$i=0;
if ($theme_width == "100%") echo "\n";
while ($data = dbarray($result)) {
if ($i % 2 == 0) { $row_color = "tbl1"; } else { $row_color = "tbl1"; }
$new_posts = dbcount("(thread_id)", "posts", "thread_id='".$data['thread_id']."' and post_datestamp>'".(isset($lastvisited) ? $lastvisited : 0)."'");
//$thread_replies = dbcount("(thread_id)", "posts", "thread_id='".$data['thread_id']."'") - 1;
$thread_replies = $data['thread_replies'];
$forum_id = $data['forum_id'];
if ($new_posts > 0) {
$folder123 = " ";
} else if ($new_posts > 19) {
$folder123 = " ";
} else {
if ($data['thread_locked'] == 1) {
$folder123 = " ";
} else if ($data['thread_locked'] == 0) {
$folder123 = " ";
}
}
//$reply_count = dbcount("(thread_id)", "posts", "thread_id='".$data['thread_id']."'");
[b][color=red]$limit = 10;
$adr = '[/color][color=green]ADRES_DO_FORUM(NP. http://www.lsfan.info/forum/)[/color][color=red]';
$con2 = dbconnect('[/color][color=green]TWÓJ_HOST[/color][color=red]', '[/color][color=green]NAZWA_USERA_BAZY[/color][color=red]', '[/color][color=green]HASŁO_BAZY[/color][color=red]', '[/color][color=green]NAZWA_BAZY[/color][color=red]');
$result = dbquery("SELECT topic_id, topic_title, topic_poster FROM phpbb_topics ORDER BY topic_poster DESC LIMIT $limit");
while ($row = mysql_fetch_array($result))
{
echo ' ';
echo(substr($row['topic_title'],0,20));
echo ' ';
echo ' ';
}
dbconnect($db_host, $db_user, $db_pass, $db_name);[/color][/b]
$i++;
}
} else {
echo "".$locale['004']." \n";
}
echo "