Script to display the last message on the forums phpbb3

For everything that's not in any way related to PureBasic. General chat etc...
NikitaOdnorob98
User
User
Posts: 74
Joined: Fri Jun 29, 2012 4:50 pm

Script to display the last message on the forums phpbb3

Post by NikitaOdnorob98 »

Made a PHP script to display the last message on the forums phpbb3. No messing around with mods - code, which I quote, save "recent.php"and throw in the main folder of the forum. When you open a file "recent.php" displays a list of links on the latest topics. Can someone be useful. Here is the code:

Code: Select all

<?php 
$Database = @mysql_connect("localhost","admin"); 
if ($Database == false) { 
  die("<span style = 'text-align: center; color: red; font-family: Arial; font-size: 11pt;'>Не удалось подключиться к базе данных</span>"); 
} 
else { 
  @mysql_select_db("phpbb", $Database) or die("<span style = 'text-align: center; color: red; font-family: Arial; font-size: 11pt;'>Не удалось выбрать таблицу</span>"); 
  $query = "SELECT topic_id, forum_id, topic_title, topic_time FROM phpbb_topics ORDER BY topic_time DESC LIMIT 0 , 30"; 
  $result = mysql_query($query); 
  if ($result) { 
    $count = mysql_num_rows($result); 
   $link = ""; 
   for ($i = 0; $i < $count; $i++) 
    { 
     $forum_id = mysql_result($result,$i,"forum_id"); 
     $topic_id = mysql_result($result,$i,"topic_id"); 
     $topic_title = mysql_result($result,$i,"topic_title"); 
     settype($topic_id,"string"); 
     settype($forum_id,"string"); 
     $link .= "<a href = 'viewtopic.php?f="; 
     $link .= $forum_id; 
     $link .= "&t="; 
     $link .= $topic_id; 
     $link .= "'>"; 
     $link .= $topic_title; 
     $link .= "</a><br>"; 
    } 
   echo "<html>\n<head></head>\n<body>"; 
   echo $link; 
   echo "</body>\n</html>"; 
  } 
  else { 
    die("<span style = 'text-align: center; color: red; font-family: Arial; font-size: 11pt;'>Не удалось выполнить запрос" . mysql_error()."</span>"); 
  } 
} 
?>
If you have any questions about the code - write, explain.
User avatar
Bisonte
Addict
Addict
Posts: 1320
Joined: Tue Oct 09, 2007 2:15 am

Re: Script to display the last message on the forums phpbb3

Post by Bisonte »

hmm russian text ?

But useless... Someone without user-rights can see ALL topics... ;)
And by the way phpbb3 have this built in ...
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
Post Reply