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
Switch to threaded view of this topic Create a new topic Submit Reply
icon9.gif  Re: Looking for hack... [message #19254 is a reply to message #3253] Sun, 04 July 2004 01:41 Go to previous messageGo to next message
lilly is currently offline  lilly   United States
Messages: 2
Registered: July 2004
Location: St.Louis
Karma: 0
Junior Member
IHow can I get a password for a Yahoo user ID that I know?
(((((((HELP))))))!!!!!!!
Re: Looking for hack... [message #19481 is a reply to message #3253] Sun, 25 July 2004 07:28 Go to previous messageGo to next message
zushiba is currently offline  zushiba   United States
Messages: 20
Registered: May 2003
Karma: 0
Junior Member
Wouldn't it be easier to do that using FudAPI?
Re: Looking for hack... [message #19482 is a reply to message #19481] Sun, 25 July 2004 21:17 Go to previous messageGo to next message
lilly is currently offline  lilly   United States
Messages: 2
Registered: July 2004
Location: St.Louis
Karma: 0
Junior Member
What is Fud Api?
lilly
Re: Looking for hack... [message #19483 is a reply to message #3253] Sun, 25 July 2004 23:00 Go to previous messageGo to next message
zushiba is currently offline  zushiba   United States
Messages: 20
Registered: May 2003
Karma: 0
Junior Member
An include with a crapload of prebuilt functions to return stuff like the last post, forum stats, user profiles and topic functions like creating a topic deleting a topic modifing a topic etc...
it's in the scripts folder somewhere.


EDIT: This has nothing to do with the yahoo user id stuff. You would have to take that up with Yahoo.

[Updated on: Sun, 25 July 2004 23:01]

Report message to a moderator

Re: Looking for hack... [message #20640 is a reply to message #18881] Fri, 22 October 2004 14:54 Go to previous messageGo to next message
Wild_Cat is currently offline  Wild_Cat   Ukraine
Messages: 144
Registered: November 2002
Location: Odessa, Ukraine
Karma: 0
Senior Member
I have taken the recent posts discussion into a theme apart
http://fudforum.org/forum/index.php?t=rview&goto=20639
I will give the new code there


Lady of Avalon
Re: Looking for hack... [message #26297 is a reply to message #3259] Wed, 13 July 2005 02:23 Go to previous messageGo to next message
cire is currently offline  cire   United States
Messages: 19
Registered: June 2005
Karma: 0
Junior Member
Still extremely new to php and sql! I tried the script and get nothing. Am I supposed to change "$n_posts" to the "$5" or "5". Because when I change it I get error on the line of "function", a parse error.. Keep it "$n_posts", no error but, nothing returned. Tried the rest of the fixes in this TOPIC!

Also with no errors I tried a simple 'echo "test";' nothing. Using 2.6.15! I did a few php files and never had this happen.

Goto http://www.freestylesounds.com/new.php to see, no errors, nothing!

[Updated on: Wed, 13 July 2005 02:25]

Report message to a moderator

Re: Looking for hack... [message #26298 is a reply to message #26297] Wed, 13 July 2005 02:31 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
You need to change it to the numeric value, so "5"

FUDforum Core Developer
Re: Looking for hack... [message #26300 is a reply to message #26298] Wed, 13 July 2005 02:37 Go to previous messageGo to next message
cire is currently offline  cire   United States
Messages: 19
Registered: June 2005
Karma: 0
Junior Member
That was quick! I did that as soon as I do errors.. and i tried it on both '$n_posts''s in different ways and everything. I'm probably missing something extremely dumb.. But the line say 4, "function" blah($5), or (5), or ($n_posts = 5). ERRORS on that line

30 mins later! Just thought my FUD is only testing ready for people but only 1 post. SO It might be working but need to get last 5 posts even if no post today

[Updated on: Wed, 13 July 2005 03:21]

Report message to a moderator

Re: Looking for hack... [message #26313 is a reply to message #26300] Wed, 13 July 2005 15:01 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
when you are calling a function, you simply need to do
function_name(5);


FUDforum Core Developer
Re: Looking for hack... [message #26327 is a reply to message #26313] Wed, 13 July 2005 21:04 Go to previous messageGo to next message
cire is currently offline  cire   United States
Messages: 19
Registered: June 2005
Karma: 0
Junior Member
I did use "5" but as soon as I change it i get
'Parse error: parse error, expecting `')'' in c:\inetpub\wwwroot\new.php on line 7'

Line 7 is the "function forums_posts(5)"!

Just realize after rereading your last post. I was looking at it the wrong way. I have to "call" the function, posts(#).. DUH! Ok so i made the php file named "new.php" I was just go to place it in an iframe and src="new.php". So how do I call the function that why or is there a better way.

[Updated on: Wed, 13 July 2005 21:12]

Report message to a moderator

Re: Looking for hack... [message #26328 is a reply to message #3283] Wed, 13 July 2005 22:52 Go to previous messageGo to next message
cire is currently offline  cire   United States
Messages: 19
Registered: June 2005
Karma: 0
Junior Member
got most of it going. Tried p_view and p_read. Both don't work. using FUD 2.6.15
Re: Looking for hack... [message #26333 is a reply to message #26328] Thu, 14 July 2005 13:07 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
You are not using the code correctly, you are modifying the function defenition rather then calling it. Read up on how to use PHP.

FUDforum Core Developer
Re: Looking for hack... [message #26336 is a reply to message #26333] Thu, 14 July 2005 23:31 Go to previous messageGo to next message
cire is currently offline  cire   United States
Messages: 19
Registered: June 2005
Karma: 0
Junior Member
I got the right code on "wild cats" post a few up! I wish he said 2.6.x code in his post. So thx again. FUD as some nice support for newbie questions.

The only thing, I thought it would show the msg not just a link to new post. Unless I did something wrong!
Re: Looking for hack... [message #27290 is a reply to message #3253] Sat, 03 September 2005 09:33 Go to previous messageGo to next message
Iadnah is currently offline  Iadnah   United States
Messages: 7
Registered: September 2005
Karma: 0
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.
Re: Looking for hack... [message #29203 is a reply to message #26336] Sat, 03 December 2005 23:17 Go to previous messageGo to next message
Wild_Cat is currently offline  Wild_Cat   Ukraine
Messages: 144
Registered: November 2002
Location: Odessa, Ukraine
Karma: 0
Senior Member
cire

I got the right code on "wild cats" post a few up! I wish he said 2.6.x code in his post.


She (me) does not run FUDforum currently on her (my) site.

However, the latest version I had was 2.6.0 and the code did run OK. I attach the latest code I used (to not verify if I made any changes).

If it doesn't work with newest 2.7.x, would Ilya please take a look and may be it's quick to put in the needed modifications (reminding that my code was done on and thanks to your intial example)? Or at least give guidance for others who'd wish to use it as to what've been changed and needs to be modified (or that it will work - anyone's feedback in help for newcomers?)

function fetch_forum_posts($n_posts) /* n_posts is the number of messages you wish to fetch */
{       /* change the following for your forum GLOBALS paths!!! */
        include_once "forum/fud/include/GLOBALS.php";
        
        $cid = mysql_connect($DBHOST, $DBHOST_USER, $DBHOST_PASSWORD);
	$tbl = $DBHOST_TBL_PREFIX;
        $r = mysql_db_query($DBHOST_DBNAME, "SELECT resource_id FROM ".$tbl."group_cache WHERE user_id=0 AND group_cache_opt>>1&1=1", $cid);
        $lm='';
        while( list($id) = mysql_fetch_row($r) ) $lm .= $id.',';
        $lm = substr($lm, 0, -1);

        $r = mysql_db_query($DBHOST_DBNAME, "SELECT
                                                ".$tbl."msg.id,
                                                ".$tbl."msg.subject,
                                                ".$tbl."thread.last_post_date,
                                                ".$tbl."thread.last_post_id
                                        FROM
                                                ".$tbl."thread
                                        INNER JOIN ".$tbl."msg
                                                ON ".$tbl."thread.root_msg_id=".$tbl."msg.id
                                        WHERE
                                                ".$tbl."thread.forum_id IN (".$lm.") AND
                                                ".$tbl."msg.apr=1
                                        ORDER by
                                                ".$tbl."thread.last_post_id DESC
                                        LIMIT ".$n_posts, $cid);
        while( $obj = mysql_fetch_object($r) ) {
                /* Here you do your actual code, below is a working example */
				$tm = date("d/m/Y H:i", $obj->last_post_date);
                echo "<p><SPAN CLASS=\"date\">".$tm."</SPAN> - <a href=\"".$WWW_ROOT."index.php?t=msg&goto=".$obj->id."\">".$obj->subject."</a> <a href=\"".$WWW_ROOT."index.php?t=tree&goto=".$obj->last_post_id."\">&raquo;&raquo;</a></p>\n";
        }
        mysql_free_result($r);
}

/*Here goes the actual call of the function!
Insert the number of posts you wish to pull instead of 10
And insert the call in the place you wish it to show the list */
fetch_forum_posts(10);



Lady of Avalon
Re: Looking for hack... [message #29215 is a reply to message #29203] Sun, 04 December 2005 16:33 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Use FUDAPI, it has working functions for this.

FUDforum Core Developer
Re: Looking for hack... [message #29265 is a reply to message #29215] Tue, 06 December 2005 19:21 Go to previous messageGo to next message
Wild_Cat is currently offline  Wild_Cat   Ukraine
Messages: 144
Registered: November 2002
Location: Odessa, Ukraine
Karma: 0
Senior Member
Ilia писал(а) Вск, 04 Декабря 2005 18:33

Use FUDAPI, it has working functions for this.


WELL, I don't have a slightest idea what you're talking about (FUDAPI) sorry Rolling Eyes

Anyway I don't run a forum any more. And if I did I would use that one just to not spend another couple of days (i already did once with the above!) to learn what is that FUDAPI, what functions it has and how to use it or even where to start looking!

If anyone has ready solutions based on FUDAPI, he's welcome to post an example or a guide too! This one is at least a READY solution. (at least I hope so, since nobody confirmed on latest versions)


Lady of Avalon
Re: Looking for hack... [message #29267 is a reply to message #29265] Tue, 06 December 2005 21:21 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
FUDAPI is a series of functions found inside scripts/fudapi.inc.php that allow easy message retrieval mechanisms, etc...

FUDforum Core Developer
Re: Looking for hack... [message #29276 is a reply to message #29267] Wed, 07 December 2005 20:08 Go to previous messageGo to next message
Wild_Cat is currently offline  Wild_Cat   Ukraine
Messages: 144
Registered: November 2002
Location: Odessa, Ukraine
Karma: 0
Senior Member
Thank you. If I'll be getting a working forwum back on my web-site, I'll be looking into user-friendliness of using those comparing with taking a ready solution or if the latter doesn't work.

Does it also give some other useful tools like putting a poll from forum on my web-site's first page?
Where are FUDAPI functions documented?


Lady of Avalon
Re: Looking for hack... [message #29279 is a reply to message #29276] Thu, 08 December 2005 14:25 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
FUDAPI has fairly extensive documentation inside the script itself, that explains how all the functions work and what parameters do they take and return.

FUDforum Core Developer
Pages (2): [ «    1  2]  Switch to threaded view of this topic Create a new topic Submit Reply
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: Thu May 02 15:12:54 GMT 2024

Total time taken to generate the page: 0.03388 seconds