FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Plugins and Code Hacks » Looking for hack...
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Looking for hack... [message #27290 is a reply to message #3253] Sat, 03 September 2005 09:33 Go to previous message
Iadnah is currently offline  Iadnah   United States
Messages: 7
Registered: September 2005
Karma:
Junior Member
This is the method I use (because I HATE fudapi). You'll probably want to edit the way it outputs data to suit your site.

<?php
        echo ( "
        <table width=\"100%\"><tr id=\"header\"><td><center><strong>.::Last Post in Each Forum::.</strong></center></td></tr></table>
        <div id=\"content\">
        <center>
        <table cellpadding=\"2\" width=\"100%\">
        " );

        function lastPost($fid)
        {
                $fname="snip"; //forum database login name
                $fpass="snip"; //forum database pass
                $fdb="forum";  //name of database forum uses

                mysql_connect(localhost,$fname,$fpass);
                @mysql_select_db($fdb) or die("Could not connect to database.");
                $query="select last_post_date, id, replies, forum_id, last_post_id from fud26_thread where forum_id = '$fid' order by last_post_date desc";
                $result=mysql_query($query);
                $num=mysql_numrows($result);
                $x=0;


                while ($x < $num) {
                        $post_id=mysql_result($result,$x,"id");
                        $replies=mysql_result($result,$x,"replies");
                        $last_post_date=mysql_result($result,$x,"last_post_date");
                        $last_post_id=mysql_result($result,$x,"last_post_id");
                $x=$num;
                }

                $num=mysql_numrows($result);
                $x=0;


                while ($x < $num) {
                        $post_id=mysql_result($result,$x,"id");
                        $replies=mysql_result($result,$x,"replies");
                        $last_post_date=mysql_result($result,$x,"last_post_date");
                        $last_post_id=mysql_result($result,$x,"last_post_id");
                        $url="http://www.uplinklounge.com/forum/index.php?t=msg&th=$post_id";

                $x=$num;
                }

                $query="select name from fud26_forum where id = \"$fid\"";
                $result=mysql_query($query);
                $num=mysql_numrows($result);
                $x=0;

                while ($x < $num) {
                        $forum_name=mysql_result($result,$x,"name");
                $x=$num;
                }

                $query="select subject, poster_id from fud26_msg where id = \"$last_post_id\"";
                $result=mysql_query($query);
                $num=mysql_numrows($result);
                $x=0;

                while ($x < $num) {
                        $poster_id=mysql_result($result,$x,"poster_id");
                        $subject=mysql_result($result,$x,"subject");

                $x=$num;;
                }
                if (!isset($poster))
                {
                        $poster = "Anonymous Coward";
                }
                $pdate=date("m/d/Y", $last_post_date);
                $ptime=date("g:i A", $last_post_date);

                echo ( "
                        <tr><td width=\"20%\">
                        <div align=\"right\"><b><a href=\"http://www.uplinklounge.com/forum/index.php?t=thread&frm_id=$fid\">$forum_name</a>: </b></div>
                        </td>
                        <td width=\"35%\">
                        <a href=\"$url\">$subject</a>
                        </td>
                        <td>($replies replies)</td>
                        <td>
                        <a href=\"http://www.uplinklounge.com/forum/index.php?t=usrinfo&id=$poster_id\">$poster</a>
                        </td>
                        <td>
                        <small>$pdate at $ptime</small>
                        </td>
                        </tr>
                "

                );

                mysql_close();
        }
        lastPost(2);
        lastPost(30);
        lastPost(8);
        lastPost(9);
        lastPost(10);
        lastPost(12);
        lastPost(32);
        lastPost(44);
        lastPost(42);
        lastPost(14);
        lastPost(17);
        lastPost(37);
        lastPost(38);
        lastPost(7);
        lastPost(41);

        echo ( "
        </table>
        </center>
        </div>
        " );
?>


I know my code's probably not efficient, but it gets the job done and displays a nice table showing each forum you tell it to, the subject of the last post in each forum, who posted it, when, and how many replies it's gotten. Also, it will have a link to the profile of the poster.

Those numbers where it says lastPost(number); are the id numbers of the forums you want it to get info about. I hope I helped.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message icon5.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message icon9.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message icon9.gif
Read Message
Read Message
Read Message
Read Message
Previous Topic: New threads on the front page of the site
Next Topic: General Hacking Recommendation please
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 07:07:01 GMT 2024

Total time taken to generate the page: 0.05394 seconds