extract topics from various forums

 
Post new topic   Reply to topic    Deceptive Logic Forum Index -> Tutorial help
View previous topic :: View next topic  
Author Message
santosh_iit32
newbie
newbie



Member No.: 90
Joined: 19 Nov 2006
Posts: 21
Location: India

PostPosted: Fri Dec 29, 2006 3:56 pm   Post subject: extract topics from various forums Reply with quote

How do i set up the tutorial so that i could extract from every forum and not just limited to one forum? i'm not able to get it done. it shows only one item from one specific forum?
Back to top
View user's profile Send private message
rc69
Site Admin
Site Admin



Member No.: 1
Joined: 05 Aug 2004
Posts: 152

PostPosted: Sat Dec 30, 2006 5:16 am   Post subject: Reply with quote

Well, i don't think you copied the code correctly then. As it stands right now, if you copy/paste the entire tutorial, it will select a total of 10 topics from every forum but the one that has an id value equal to 1.

Reading the comments in the tutorial will probably help you with your problem, but if not, could you possibly re-explain your problem or show me what code you are using?
PHP:

<?php /* To keep a forum secret (i.e. a mods only forum) find, AND t.forum_id != 1
and change 1 to the forums id (according to your database). To select a specific forum (i.e. news forum)
find AND t.forum_id != 1, and change it to t.forum_id = 1 (where 1 = the forums id) */
$result = mysql_query("SELECT DISTINCT t.topic_id, t.topic_title, t.topic_replies, u.user_id, u.username, s.post_text
FROM phpbb_posts p, phpbb_topics t, phpbb_users u, phpbb_posts_text s
WHERE p.topic_id = t.topic_id AND t.topic_poster = u.user_id AND t.topic_first_post_id = s.post_id AND t.forum_id != 1 AND u.user_id != -1
ORDER BY p.post_time DESC LIMIT 10"
); ?>


_________________
Current user reading this: Anonymous


Mind the gap.
Back to top
View user's profile Send private message Visit poster's website
santosh_iit32
newbie
newbie



Member No.: 90
Joined: 19 Nov 2006
Posts: 21
Location: India

PostPosted: Sat Dec 30, 2006 3:07 pm   Post subject: Reply with quote

exactly the same code as shown in the website! I get only one topic from one of the many forums!

Code:

# Database info, or include a config.php file
$db_host = 'localhost'; # Change to your host
$db_user = 'anonymous'; # Change to your user name
$db_password = ''; # Change to your password
$db_name = 'forum'; # Change to your db name

mysql_connect($db_host,$db_user,$db_password) or die(mysql_error());
mysql_select_db($db_name) or die(mysql_error());

/* To keep a forum secret (i.e. a mods only forum) find, AND t.forum_id != 1
   and change 1 to the forums id (according to your database). To select a specific forum (i.e. news forum)
   find AND t.forum_id != 1, and change it to t.forum_id = 1 (where 1 = the forums id) */
$result = mysql_query("SELECT DISTINCT t.topic_id, t.topic_title, t.topic_replies, u.user_id, u.username, s.post_text
FROM phpbb_posts p, phpbb_topics t, phpbb_users u, phpbb_posts_text s
WHERE p.topic_id = t.topic_id AND t.topic_poster = u.user_id AND t.topic_first_post_id = s.post_id AND t.forum_id != 1 AND

u.user_id != -1
ORDER BY p.post_time DESC LIMIT 10");

/* This function is used to limit the amount of text displayed, as well as replace any bbcode.
   it also converts any new lines (enters/returns), to an acctual break for people to see
   if you want bbcode displayed, remove the $text = preg_replace... line.
   This is only needed if you want to post the body text of a post */
function text($text, $limit){
    $text = str_replace("\n", "<br>", $text);
    $text = preg_replace("#\[(.*?)\].*?\[/(\\1)\]#si", "<i>[bbcode]</i>", $text);
    if(strlen($text)>$limit){
        $text = substr($text, 0, $limit);
        $text = substr($text, 0, -(strlen(strrchr($text, ' '))))."...";
    }
    return $text;
}

while($r=mysql_fetch_array($result)){
/* Change 100, to the number of characters you want to show.
   If you didn't keep the above text() function, then change the following line to:
   $text = $r['post_text']; */
$text = text($r['post_text'], 100);

/* To change the display, edit this.
   Also change both the <a> tags to the correct path to your forums, leave the part after /forum/ the same */
echo "<a href=\"/forum/viewtopic.php?t={$r['topic_id']}\" target=\"_blank\">{$r['topic_title']}</a><br>
by: <a href=\"/forum/profile.php?mode=viewprofile&u={$r['user_id']}\" target=\"_blank\">{$r['username']}</a><br>
$text
<div align=\"right\">Replies: {$r['topic_replies']}</div>
<hr>";
}
?>


I'm not getting through it. please help me.[/code] <? has been removed as I'm having some problem posting the full code.
Back to top
View user's profile Send private message
rc69
Site Admin
Site Admin



Member No.: 1
Joined: 05 Aug 2004
Posts: 152

PostPosted: Sat Dec 30, 2006 10:32 pm   Post subject: Reply with quote

Code:
SELECT DISTINCT t.topic_id, t.topic_title, t.topic_replies, u.user_id, u.username, s.post_text
FROM phpbb_posts p, phpbb_topics t, phpbb_users u, phpbb_posts_text s
WHERE t.topic_poster = u.user_id AND t.topic_first_post_id = s.post_id AND t.forum_id != 1 AND u.user_id != -1
ORDER BY t.topic_time DESC LIMIT 10

Try the above for the SQL query. If that doesn't work, then i don't know what to do. I've used the exact script from the tutorial since i made it and have never had any problems with it not select the proper amount of topics.
_________________
Current user reading this: Anonymous


Mind the gap.


Last edited by rc69 on Sun Dec 31, 2006 7:41 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
santosh_iit32
newbie
newbie



Member No.: 90
Joined: 19 Nov 2006
Posts: 21
Location: India

PostPosted: Sun Dec 31, 2006 6:11 am   Post subject: Reply with quote

that shows 2 forums!! I can't seem to understand? I see only two forums displayed when i changed the the code u gave!
Back to top
View user's profile Send private message
rc69
Site Admin
Site Admin



Member No.: 1
Joined: 05 Aug 2004
Posts: 152

PostPosted: Sun Dec 31, 2006 7:42 pm   Post subject: Reply with quote

The only other thing i can think of is that all of your posts are by guests. I have that set up to not display posts by non-registered users. But again, if that didn't fix the problem, i don't know what will.
_________________
Current user reading this: Anonymous


Mind the gap.
Back to top
View user's profile Send private message Visit poster's website
santosh_iit32
newbie
newbie



Member No.: 90
Joined: 19 Nov 2006
Posts: 21
Location: India

PostPosted: Mon Jan 01, 2007 2:29 am   Post subject: Reply with quote

thank you for the reply. may be something went wrong with the server!! dont really know.

I have decided to use another script which I posted in another section of this board. I apprecaite your help so far. Thank you so much.
Back to top
View user's profile Send private message
santosh_iit32
newbie
newbie



Member No.: 90
Joined: 19 Nov 2006
Posts: 21
Location: India

PostPosted: Wed Jan 17, 2007 3:02 am   Post subject: Reply with quote

something has to be done with this spamming.
Back to top
View user's profile Send private message
rc69
Site Admin
Site Admin



Member No.: 1
Joined: 05 Aug 2004
Posts: 152

PostPosted: Wed Jan 17, 2007 7:01 pm   Post subject: Reply with quote

It's phpBB, i've done everything i know of to stop it, but even visual confirmation isn't working so i don't know what else to do.
_________________
Current user reading this: Anonymous


Mind the gap.
Back to top
View user's profile Send private message Visit poster's website
santosh_iit32
newbie
newbie



Member No.: 90
Joined: 19 Nov 2006
Posts: 21
Location: India

PostPosted: Thu Jan 18, 2007 4:38 am   Post subject: Reply with quote

lolz... everyone seems to be struggling with it. hehehe

i have
1. registered members only
2. visual confirmation on signup
3. visual confirmation on first posting
4. email validation
5. setup robots.txt

but still spamming exists Sad(... everyone is strugglin... i guess so are the spammers ehehe
Back to top
View user's profile Send private message
rc69
Site Admin
Site Admin



Member No.: 1
Joined: 05 Aug 2004
Posts: 152

PostPosted: Thu Jan 18, 2007 6:31 am   Post subject: Reply with quote

Spammers aren't struggling. If they were then only a select few would see the problem.

I have reasons for allowing guests to post, but even still, spammers manage to register and post. I have robots.txt, .htaccess, and ip bans, but nothing is working.
_________________
Current user reading this: Anonymous


Mind the gap.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Deceptive Logic Forum Index -> Tutorial help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group