i am being forced to convert smf now, which seems the correct way to go since i could not upgrade to punbb 1.3 because of utf8 problems which i cant really solve.

stats.punres will have a new number 1 forum soon.

Mr.Awesome wrote:

I've past this bug by doing a backup of tables, topics, posts and forums and import them back with some modification after the upgrade --> result http://futurama-france.fr/forum/index.php

could you please explain what you did in more details

i tried to do what has been said here but no success.

Or anyone have an idea how to import back with modification ?

could you please help me

my users are forcing me to open search.php again
it is impossible without limiting 2 million posts
i found i have to limit these querries and i found i have to do something like this link

>> SELECT points
>> FROM results
>> (
>>  SELECT count(*)
>>  FROM results as R
>>  WHERE R.person_id = results.person_id AND R.points > results.points
>> ) <3
>> ORDER BY person_id, points DESC

but cant do it, the lines i have to change is below

if ($show_as == 'topics')
                $result = $db->query('SELECT t.id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id IN('.implode(',', $search_ids).')'.$forum_sql.' GROUP BY t.id', true) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());

                $search_ids = array();
                while ($row = $db->fetch_row($result))
                    $search_ids[] = $row[0];


                $num_hits = count($search_ids);
                $result = $db->query('SELECT p.id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id IN('.implode(',', $search_ids).')'.$forum_sql, true) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());

                $search_ids = array();
                while ($row = $db->fetch_row($result))
                    $search_ids[] = $row[0];


                $num_hits = count($search_ids);


(19 replies, posted in News)

thank you so much for the devolopment

if ($show_as == 'posts')
            $substr_sql = ($db_type != 'sqlite') ? 'SUBSTRING' : 'SUBSTR';
            $sql = 'SELECT p.id AS pid, p.poster AS pposter, p.posted AS pposted, p.poster_id, '.$substr_sql.'(p.message, 1, 1000) AS message, t.id AS tid, t.poster, t.subject, t.question, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.forum_id, t.labels FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id WHERE p.id IN('.$search_results.') ORDER BY '.$sort_by_sql.'DESC LIMIT 50';
            //$sql = 'SELECT t.id AS tid, t.poster, t.subject, t.question, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.closed, t.forum_id FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id WHERE t.id IN('.$search_results.') GROUP BY t.id, t.poster, t.subject, t.question, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.closed, t.forum_id'.$group_by_sql.' ORDER BY '.$sort_by_sql;
            $sql = 'SELECT t.id AS tid, t.poster, t.subject, t.question, t.sticky, t.last_post, t.last_post_id, t.last_poster, t.num_replies, t.closed, t.forum_id, t.labels FROM '.$db->prefix.'topics AS t WHERE t.id IN('.$search_results.') ORDER BY '.$sort_by_sql.'DESC LIMIT 50';

and then i had to delete this line
$sql .= ' '.$sort_dir.' LIMIT '.$start_from.', '.$per_page;

well it did not optimize anything or searches i may be doing something wrong

thanks anyway.

thank you so much is there any solution for punbb 1.2 also ?

is it possible to limit search results

go in this url and see http://mypunbb.com/search.php?action=show_unanswered
it opens in 30 whole seconds

well in my own forum it is much worse

how can we limit search results for the first 50 topics for example

P.S. this is same in punbb 1.3 i should have posted this at bugs.

Anyone please help
thank you.


(3 replies, posted in Discussions)

after browsing many sites i have seen that there are many html wysiwyg editors for punbb

but there are very few bbcode wysiwyg editors

-Vbulletin's editor (very hard to understand code)
-http://www.anelectron.com (really good editor)
-http://www.phpkf.com/ site is turkish but the editor is extremely simple and usefull better than vbulletins

Is it possible someone would copy one of these editors for punbb and publish it at punres.
i have hoteditor as wysiwyg (bbcode) atm but i really hate it.

yes megapun style smile

if you could change punbb url system


jpcache would cache much lesser pages (caching every post is nonsense)

- My forum is not very big, i have downloaded many posts from other forums

- It is fast mostly because of jpcache , i am not making database connections for 1 day for guests when a page is viewed , i cache whole page (server side).

-When you have extern.php with many posts , extern.php starts to get very heavy to execute

-My host i like them ,pretty cheap and fast , it is even  a virtual host

-this is the mod that i have applied but it is a bit hard to merge it with subforums i even dont know which parts i changed myself i am very weak at php  http://www.punres.org/viewtopic.php?pid=24988

Main page modded


My extra features
-i am guessing i have the best html to BB convert (wysiwyg) editor on whole community which is modded by me from hoteditor
(hoteditor is normally broken really badly do not do it for your site, i edited code really alot)
-Multiple Moderator groups and global moderators
-Can merge whole forums or topics can chose whole topics with one click like in vbulletin
-I am cache ing my whole site which works really well with jpcache for only guests, which drops load really alot.
-Fixed many bugs in megapun. for decreased load. Removed some mods that i dont need and decreased querries
-Last posts with names on main page (found a method ,wiki.punbb method is broken alot)
-Had to disable search smile cause of many posts (this is a minus)
-Integrated a new url thing without help from .htaccess for seo
-Made a multiple sitemaps generator for google which i already sent to punres
-Removed extern.php Don't laugh you will have to do it also if your site gets bigger in posts.
-Logging moderators actions so if they do something evil i can see.
-Added some security to banning so mods dont ban each other, also prevented them to change other users passwords
-Some standart mods like message and reputation and poll
-Made SEO metatags which was really hard for me to do on viewtopic.php cause explanations here were broken.
-Added some more bbcode for videos avi flash even mp3
-Wrote a bot to download content from other forums ! (yes that is bad but i have some explanation which i dont want to talk about much)
-prevented viewtopic.php?pid= links to avoid duplicate content but that is under constructions since i changed whole url system.

THE only problem is
google is too slow to index me even with my seo ed urls
i might have done something wrong.

this is what i did after setting up jpcache and succeed

and this is the tutorial i could not succeed for php cache lite
http://kevin.vanzonneveld.net/techblog/ … ache_lite/

this is my method to do things
after uploading files and making correct jpcache path things
i do this for the each files i want to cache (index.php viewforum.php viewtopic.php even search.php and userlist.php)

after require PUN_ROOT.'include/common.php';

if ($pun_user['is_guest']) {
} else {

and my header.php is (only the header part)

if ($pun_user['is_guest']) {

// Send no-cache headers
header('Expires: Thu, 21 Jul 1977 07:30:00 GMT');    // When yours truly first set eyes on this world! :)
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');        // For HTTP/1.0 compability

else if (!$pun_user['is_guest'])  {
header("Date: ".gmdate("D, d M Y H:i:s", time())." GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s", time())." GMT");;
header("Expires: ".gmdate("D, d M Y H:i:s", time() + 5)." GMT"); 
header("Cache-Control: public,must-revalidate,max-age=5"); 

$if_modified_since = preg_replace('/;.*$/', '', $HTTP_IF_MODIFIED_SINCE);

$mtime = time() + 5;
$gmdate_mod = gmdate('D, d M Y H:i:s', $mtime) . ' GMT';

if ($if_modified_since == $gmdate_mod) {
    header("HTTP/1.0 304 Not Modified");
//header("Last-Modified: $gmdate_mod");


oh one more thing i am not gzip ing pages from punbb options i did it from .htaccess
i am not sure if this works if i gzip from punbb options.

i tested it works great ,drops load really alot. I want to see this as a default punbb option

read details at

May be you should integrate this to punbb 1.3
when i cache the forum with jpcache 1 day for guests my load avarage dropped from 1.5 to 0.3 on peak hour
and somehow it is still counting guests (i wrote the jpcache line after /include/common.php)
it had gzip problems but it is working just fine after i played with header.php a bit
i could give the code here if interested.

and since my php is weak
i dont know if it could be dropped with PHP Cache_Lite for members even more

translate from french smile for punbb 1.2.20



(5 replies, posted in Discussions)

i am already doing this
it is easy
the forumid and topicid and postid
should not intersect you have to make iterations in 1 of the boards
how  to make iterations ? example is below i am not sure the table names are correct you have to confirm it.
UPDATE forum
SET forumid=forumid+1289;

UPDATE thread
SET threadid=threadid+450000;
UPDATE thread
SET forumid=forumid+1289;

  UPDATE post
SET postid=postid+2400000;
SET threadid=threadid+450000;

you will have to create new forums matching  forum id on your 2nd forum which you are closeing

mysqldump -u dbuser -p[pwd] --no-create-db --no-create-info database2nd > database_backup.sql
mysql -u dbuser -p[pwd]  database1st < database_backup.sql

tested this jpcache for guests
results are incredible lightning fast no mysql using (no load ) pages.
somehow it is still counting my visitors smile

tried PHP Cache_Lite for registered users for only main page
i dont have enough php knowledge could not do it yet.


(76 replies, posted in PunBB 1.3 extensions)

i made a multiple sitemap creator for punbb 1.2.x for more than 50k urls

does this also do it?
feel free to change my code and apply here if it can.

 // Do we have permission to edit this post?
-if (($pun_user['g_edit_posts'] == '0' ||
-    $cur_post['poster_id'] != $pun_user['id'] ||
+if (((($pun_user['g_edit_posts'] == '0' ||
+    $cur_post['poster_id'] != $pun_user['id']) &&
+    (time() - $cur_post['post_posted']) > 300) ||
     $cur_post['closed'] == '1') &&
     message($lang_common['No permission']);

the above code is wrong

// Do we have permission to edit this post?
if (($pun_user['g_edit_posts'] == '0' ||
    $cur_post['poster_id'] != $pun_user['id'] ||
    $cur_post['closed'] == '1' ||
    time() > ($cur_post['post_posted'] + 600)) &&
    message($lang_common['No permission1']);

is working

there is a topic on punbb fr that solves this just search on google


(105 replies, posted in General discussion)

i found the solution
subforum do not do any load
if you also apply this mod on it (thats if you can)


note:the instructions on wiki page "last topic on index" makes a heavy load


(105 replies, posted in General discussion)

merging subforum with "last post on forum index" is
very heavy work for punBB
index.php execute times get bigger each day while your forum gets bigger
which makes punbb impossible to work with

this is the part that makes heavy load

$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.redirect_url, f.moderators, f.num_topics, f.num_posts, .....

the load comes from last posts if anyone can optimize it
it will be usefull

looking for a hero to make this hack work in punBB 1.2.20  smile
it does not work for latest versions. Can someone write a tutorial again
in my opinion everyone using 1.2 needs this
and there is no other seo hack like this one