?? ??????? ????????, ?? ????? ???????? ??????...

#!/usr/bin/perl -w

#
# Recount number of topics and posts in each forum (PunBB.org)
#
# Edit first 4 assignments to setup DB connection
#
# Sergej Pupykin (pupykins@gmail.com), 2006
#

$DBNAME="vsuforum"; # PunBB database
$USERNAME="root";   # DB user name
$PASSWORD="";       # DB password
$UPDATE = 1;        # If 0, then do not update DB - just print info.

use DBI;

$total_posts = 0;
$total_topics = 0;

$db = DBI->connect("dbi:mysql:$DBNAME", $USERNAME, $PASSWORD,
                  { RaiseError => 1, AutoCommit => 0 });

$qf = $db->prepare("select id from forums");
$qf->execute();

while( ($forum_id) = $qf->fetchrow_array() )
{
        $qt = $db->prepare("select id from topics where forum_id=$forum_id");
        $qt->execute();

        $sum_topics = 0;
        $sum_posts = 0;

        while( ($topic_id) = $qt->fetchrow_array() )
        {
                $sum_topics++;
                $qp = $db->prepare("select count(*) from posts where topic_id=$topic_id");
                $qp->execute();
                if( ($posts_count) = $qp->fetchrow_array() )
                {
                        $sum_posts += $posts_count;
                }
                $qp->finish();
        }
        $qt->finish();

        printf("%4d %4d %4d", $forum_id, $sum_topics, $sum_posts);
        $total_posts += $sum_posts;
        $total_topics += $sum_topics;

        if($UPDATE)
        {
            print " updating...\n";
                $qu = $db->prepare("update forums set num_topics=$sum_topics, num_posts=$sum_posts where id=$forum_id");
                $qu->execute();
                $qu->finish();
        }
        else
        {
                print "\n";
        }
}

$qf->finish();

$db->disconnect();

print "---------------\n";
printf("     %4d %4d\n", $total_topics, $total_posts);

if($UPDATE)
{
        print "PunBB database updated\n\n";
}

? ?????? ??????? ??????? ???????????? ???-?? ????????? ? ??? ? ?????? ??????. ? ????? ???-?? ????.

??????? ??????, ???? ?? ?????? ??????????? ??? ??? ??? ???????? ?????? SQL ??????? ???????

???????...

http://cb-1.ru/forum/
http://motovoronezh.ru/forum/
http://viking-moto.ru/forum/

4

(3 replies, posted in Feature requests)

My site can be accessed with both protocols. And I do not want to restrict users use only http or https...

5

(3 replies, posted in Feature requests)

Hello

I request to patch confirm_referrer function to check http/https protocols, not only www.domain.tld/domain.tld

for example:

function confirm_referrer($script)
{
        global $pun_config, $lang_common;
 
        $base_url = str_replace('www.', '', $pun_config['o_base_url']);
        $referer = str_replace('www.', '', (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''));
 
        $base_url = str_replace('https://', 'http://', $base_url);
        $referer = str_replace('https://', 'http://', $referer);
 
        if (!preg_match('#^'.preg_quote($base_url.'/'.$script, '#').'#i', $referer))
                message($lang_common['Bad referrer']);
}

6

(5 replies, posted in PunBB 1.2 bug reports)

SELECT *
FROM users
WHERE `username` = 'Guest'

gives following line

1      3      Guest      Guest             NULL      NULL      NULL      NULL      NULL      NULL      NULL      NULL      NULL      0      NULL      NULL      NULL      1      1      0      1      1      1      1      1      0      English      Oxygen      0      NULL      0      0.0.0.0      0      NULL      NULL      NULL

7

(5 replies, posted in PunBB 1.2 bug reports)

http://cb-1.ru/forum/userlist.php

forum with 50 users

8

(5 replies, posted in PunBB 1.2 bug reports)

Guest user presents in 'users' mysql table. But I can not see it in user list.

9

(5 replies, posted in PunBB 1.2 bug reports)

I have 50 registered users on my forum. But 'User list' page shows two pages. 50 users on the first page and empty second page. v1.2.6