Beiträge und post anzahl auslesen

Fragen zu allen Themen rund ums Programmieren außerhalb von phpBB können hier gestellt werden - auch zu anderen Programmiersprachen oder Software wie Webservern und Editoren.
Antworten
[VS]TheKIller
Mitglied
Beiträge: 3
Registriert: 21.06.2007 11:15

Beiträge und post anzahl auslesen

Beitrag von [VS]TheKIller »

Hi ihrs,

Muss zu anfang sagen das ich mich in php nur bedingt auskenne und nix spizels kann.

Nun meine erste frage

Code: Alles auswählen

<?php 
// ############         Edit below         ######################################## 
$dbms = 'mysql';

$dbhost = 'localhost';
$dbname = '*****';
$dbuser = '*****';
$dbpasswd = '******';

$table_prefix = 'phpbb_';

$topic_length = '15';   // length of topic title 
$topic_limit = '5';   // limit of displayed topics 
$special_forums = '1';   // specify forums ('0' = no; '1' = yes) 
$forum_ids = '';      // IDs of forums; separate them with a comma 

$config_path = '/forum';   // path to config.php 
$root_path = 'http://www.dod-volkssturm.de/forum/';      // link path 
// ############         Edit above         ######################################## 

//$path = dirname(__FILE__); 
//include_once($path.$config_path .'config.php'); 
mysql_connect($dbhost, $dbuser, $dbpasswd) OR die('Unable to select server.'); 
mysql_select_db($dbname) OR die('Unable to select database.'); 

// ############## output ############## 
echo '<table> 
         <tr> 
            <td colspan="4"></td> 
         </tr> 
         <tr> 
            <td </td> 
            <td </td> 
            <td </td> 
            <td </td> 
         </tr>'; 
// ############## output ############## 

$where_forums = ( $special_forums == '1' ) ? '' : 't.forum_id NOT IN ('. $forum_ids .') AND '; 
$sql = "SELECT t.*, f.forum_id, f.forum_name, u.username AS first_poster, u.user_id AS first_poster_id, u2.username AS last_poster, u2.user_id AS last_poster_id, p.post_username AS first_poster_name, p2.post_username AS last_poster_name, p2.post_time 
   FROM ". $table_prefix ."topics t, ". $table_prefix ."forums f, ". $table_prefix ."users u, ". $table_prefix ."posts p, ". $table_prefix ."posts p2, ". $table_prefix ."users u2 
   WHERE $where_forums t.topic_poster = u.user_id AND f.forum_id = t.forum_id AND p.post_id = t.topic_first_post_id AND p2.post_id = t.topic_last_post_id AND u2.user_id = p2.poster_id 
   ORDER BY t.topic_last_post_id DESC LIMIT $topic_limit"; 
$result = mysql_query($sql); 
if( !$result ) 
{ 
   die('SQL Statement Error: '. mysql_error()); 
   exit(); 
} 

$line = array(); 
while( $row = mysql_fetch_array($result) ) 
{ 
   $line[] = $row; 
} 

for( $i = 0; $i < count($line); $i++ ) 
{ 
   $forum_id = $line[$i]['forum_id']; 
   $forum_url = $root_path .'viewforum.php?f='. $forum_id; 
   $topic_id = $line[$i]['topic_id']; 
   $topic_url = $root_path .'viewtopic.php?t='. $topic_id; 

   $topic_title = ( strlen($line[$i]['topic_title']) < $topic_length ) ? $line[$i]['topic_title'] : substr(stripslashes($line[$i]['topic_title']), 0, $topic_length) .'...'; 

   $topic_type =  ( $line[$i]['topic_type'] == '2' ) ? 'Announcement ': ''; 
   $topic_type .= ( $line[$i]['topic_type'] == '3' ) ? 'Global Announcement ': ''; 
   $topic_type .= ( $line[$i]['topic_type'] == '1' ) ? 'Sticky ': ''; 
   $topic_type .= ( $line[$i]['topic_vote'] ) ? 'Poll ': ''; 

   $views = $line[$i]['topic_views']; 
   $replies = $line[$i]['topic_replies']; 

   $first_time = date('d.m.Y', $line[$i]['topic_time']); 
   $first_author = ( $line[$i]['first_poster_id'] != '-1' ) ? '<a href="'. $root_path .'profile.php?mode=viewprofile&u='. $line[$i]['first_poster_id'] .'" target="_blank">'. $line[$i]['first_poster'] .'</a>' : ( ($line[$i]['first_poster_name'] != '' ) ? $line[$i]['first_poster_name'] : 'guest' ); 
   $last_time = date('d.m.y', $line[$i]['post_time']); 
   $last_author = ( $line[$i]['last_poster_id'] != '-1' ) ? $line[$i]['last_poster'] : ( ($line[$i]['last_poster_name'] != '' ) ? $line[$i]['last_poster_name'] : 'guest' ); 
   $last_url = '<a href="'. $root_path .'viewtopic.php?p='. $line[$i]['topic_last_post_id'] .'#'. $line[$i]['topic_last_post_id'] .'" target="_blank">'. $last_author .'</a>'; 

   // ############## output ############## 
   echo '<tr> 
             
            <td style="width: 10" align="center">'. $last_url .'</td> 
            <td style="width: 10" align="center">'. $last_time .'</td> 
            <td style="width: 100"><a href="'. $topic_url .'" target="_blank">'. $topic_title .'</a></td> 
        </tr>'; 
   // ############## output ############## 
} 

echo '</table>'; 
mysql_close(); 
?>
das geht soweit siehe Hier
mein problem ist wenn ich das include geht meine webseite nicht mehr.
News beiträge wech und auch alles andere. ich weiss nicht was ich machen soll.
Dazu muss ich sagen das ich eine clan skript benutze (ilch.de)
aber auf der webseite vonmeinem radio geht es.
http://www.mpradio.net

Das war meine erste frage, meine zweite ist: ich möchte die anzahl der letzten
Forum Posts, Forum Threads auslesen, da ich eine statistik auf der HP habe und die dort wieder einbinden möchte. (sind jetzt zwar schon welche drin aber die sind von dem forum was dabei ist aber erstens hat es kaum funktionen und ich möchte ein externes forum haben.)
Bitte alle befehle und was ich genau machen muss da ich keine ahnug habe wiedas gegensoll. Es sollen nur sie Zahlen sein nix sonst.

Meine 3. frage ich weiss das es geht aber alles was ich bis jetzt gefunden habe habe ich nicht verstanden.

Wie oben schon geschrieben habe icheine com.. und möchte das alle Registrierten leute auch im forum Registriert sind und wenn man sich auf der HP Registriert auch im forum Registriert ist.

Ja ich weiss viel für den anfang aber ich hoffe ihr könnt eine nop wie mir helfen.

INFOS:
Forum und HP haben je eine eigene db
alles liegt auf dem selben Server
ich hoffe das reicht und bin hier im richtgem forum.
sorry wenn ich hier falsch bin

Danke für eure hilfe

MFG
Marco
[VS]TheKIller
Mitglied
Beiträge: 3
Registriert: 21.06.2007 11:15

Beitrag von [VS]TheKIller »

Hi ihr,
da mir keiner geholfen hat musste ich es selbst versuchen und hin bekommen, musste einfach nur die db vom forum in das der HP Packen somit funkste auch alles.
[VS]TheKIller hat geschrieben:Das war meine erste frage, meine zweite ist: ich möchte die anzahl der letzten
Forum Posts, Forum Threads auslesen, da ich eine statistik auf der HP habe und die dort wieder einbinden möchte. (sind jetzt zwar schon welche drin aber die sind von dem forum was dabei ist aber erstens hat es kaum funktionen und ich möchte ein externes forum haben.)
Bitte alle befehle und was ich genau machen muss da ich keine ahnug habe wiedas gegensoll. Es sollen nur sie Zahlen sein nix sonst.
hier meine lösung

Code: Alles auswählen

// Anfang /Verbindungsdaten 
// Verbindungsdaten 
$dbhost = "localhost"; 
$dbuser = "*****"; 
$dbpwd = "******"; 
$db = "*********"; 

$link = mysql_connect($dbhost, $dbuser, $dbpwd); 
mysql_select_db($db); 


 
$themen_total = mysql_query("SELECT COUNT(*) FROM phpbb_topics", $link); 
$posts_total = mysql_query("SELECT COUNT(*) FROM phpbb_posts", $link); 
 



while($themen_liste = mysql_fetch_row($themen_total)) 
{ 
   $themen_zahl = $themen_liste[0]; 
} 

while($posts_liste = mysql_fetch_row($posts_total)) 
{ 
   $posts_zahl = $posts_liste[0]; 
}  
 //ende

// ausgebe

<tr><td>Forum Posts:</td><td>'.$posts_zahl.'</td></tr>
	 <tr><td>Forum Threads:</td><td>'.$themen_zahl.'</td></tr>
hier zu sehen http://www.dod-volkssturm.de/index.php

Hoffe die leute die das selbe machen hilft das, sonst hätte ich hier nicht geschrieben ^^
Aber ich hasse es ich habe das problem beseitigt und andere wisen nicht was sache ist, das wollte damit unterbinden ^^

So jetzt ist aber noch eine sache

Wie oben schon geschrieben habe ich eine com.. und möchte das alle Registrierten leute auch im forum Registriert sind, das heisst wenn man sich auf der HP Registriert auch im forum Registriert ist.

Wie kann ich das ohne großen aufwand machen??

Es soll aber das login formula von meiner HP benutz werden!!
Antworten

Zurück zu „Coding & Technik“