My ISP have had a fit because apparently I'm "abusing" the MySQL server, with the following query:

| 75818 | my_username | localhost | my_databasename | Query | 12639 | Opening tables | SELECT u.*, g.*, o.logged FROM punbb_users AS u INNER JOIN punbb_groups AS g ON u.group_id=g.g_id LE |

Can somebody please help me identify whether this is a legit punbb 1.2 query?
If so where it's driven from?

I must admit my version of punbb is out of date.
I'm going to get my account suspended if I don't rectify this "abuse", arghh!

All help appreciated.

--Alan

SORRY. I screwed up.

I went back and discovered that previously I'd disabled the call to the database layer in extern.php, as well as to config.php.
I did this as an over-reaction to errors that I was getting due to calling functions.php twice (which I have now disabled).

Big apologies and thanks to elbekko, Smartys and Rickard for your help.
This hasn't been a fruitless exercise for me, I've learned how to use db objects, and not to be so heavy handed with comment tags!

Alan

I get the error when I try to include extern.php

I include the PHP stuff first:

// Include PunBB stuff
    define('PUN_ROOT', 'messageboard/');
    require PUN_ROOT.'include/common.php';
    define('PUN_TURN_OFF_MAINT', 1);
    define('PUN_QUIET_VISIT', 1);

Then include my scripts, which use $db2. Then I include extern.php

Essentially I think that the current database is being switched to my db (as defined by $db2), so when the punbb (extern) code tries to run, it's simply pointing at the wrong database. In other words, punbb relies on the author not switching php/mysql to another database, whether explicitly or implicitly.

I can't believe I'm the only person to come across this. Surely other people are integrating punbb into their pages along with their own scripts?

Any ideas? (Thanks for your help so far)

Alan

*anotherdb being my database that I'd connected to using $db2

$db2 = new DBLayer($dbx_host, $dbx_username, $dbx_password, $dbx_name, $dbx_prefix, $px_connect);

I then call it with:

                    $result = $db2->query($strsql) or error('Unable to fetch topic list', __FILE__, __LINE__, $db2->error());

                    // If there are records returned
                    if ($db2->num_rows($result))
                        {
                            while ($row = $db2->fetch_assoc($result))
                            {
                            }
                        }

Which all works fine. The problem comes when the page then calls extern.php which gives:

PunBB reported: Unable to fetch group info

Database reported: Table 'anotherdb.punbb_groups' doesn't exist (Errno: 1146)

I'm assuming that somewhere in here (include\mysql.php):

    function query($sql, $unbuffered = false)
    {
        if (defined('PUN_SHOW_QUERIES'))
            $q_start = get_microtime();

        if ($unbuffered)
            $this->query_result = @mysql_unbuffered_query($sql, $this->link_id);
        else
            $this->query_result = @mysql_query($sql, $this->link_id);

        if ($this->query_result)
        {
            if (defined('PUN_SHOW_QUERIES'))
                $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));

            ++$this->num_queries;

            return $this->query_result;
        }
        else
        {
            if (defined('PUN_SHOW_QUERIES'))
                $this->saved_queries[] = array($sql, 0);

            return false;
        }
    }

I'll need to put:

mysql_select_db($db_name, $db)

Am I going to have to modify the mysql code in punbb so that the database is switched before every query?
Seems like an inelegant solution but if someone could help me with that I'd appreciate it.


Alan

Hmm

This doesn't seem to have solved my problem.

I'm essentially calling several scripts to build my page, some of my own and some punbb related (extern.php).
When extern.php is called, it returns this error:

PunBB reported: Unable to fetch group info

Database reported: Table 'anotherdb.punbb_groups' doesn't exist (Errno: 1146)

Which I know means it (MySQL) is looking at the wrong database (anotherdb).

This is despite me setting up a second db object, called $db2 and using that to access my database in my own scripts. I don't have any mysql_select_db commands in my scripts!

All help/ideas appreciated.

Thanks.

I get the rest, but what is:  $p_connect ??

Thanks

Alan

How do I that?
(sorry I'm going to be a n00b for the 1st ten years!)

Ok, that makes sense.

Here's the code I use to connect to the other database:

                $connection = mysql_connect ($hostname, $username, $password) or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ($databasename);

                if (!($result2 = @ mysql_query($strsql2, $connection))) die("Error " . mysql_errno(  ) . " : " . mysql_error(  ));

Am I stepping on punbb's toes with the $connection name?
Otherwise, how can I switch PHP/MySQL back to the right connection?

Thanks for the super-quick reply BTW!!

--Alan

Hi

I'm creating pages that dip in and out of punBB and my own scripts, the subsequent punbb related scripts are failing thus..

PunBB reported: Unable to fetch group info

Database reported: Table '****.punbb_groups' doesn't exist (Errno: 1146)

(Where **** is the other database I've been querying.)

Is it that I've managed to change the $db->prefix variable?!
or is it that the punbb mysql db code doesn't explicitly state it with each query and thus mysql is just using the last one used?
Is there a workaround?

All help appreciated.

--Alan

Ropli wrote:

I managed to get the new fields done myself aswell as a view counter on each profile.

Ropli

How did you add the new fields?
Did you add options to the profile page?

I'm trying to add a yes/no field to profiles, with a radio button (and associated processing) in the profile page.
Any tips/ideas/code?

Thanks

--Alan

15

(11 replies, posted in PunBB 1.2 discussion)

pogenwurst wrote:

It's printed in the footer when debug mode is enabled (but it doesn't log it, if that's what you want).

Thanks, I thought I'd seen it somewhere.
I did mean a mod to record it somewhere.
The danger of course is that a recording mod puts even more strain on the server!

--Alan

16

(27 replies, posted in PunBB 1.2 troubleshooting)

Is this IE7 fix now part of 1.2.15 ?

--Alan

17

(11 replies, posted in PunBB 1.2 discussion)

Is there a simple way of outputting time it takes a server to render a punbb page?
It might be a useful mod to make (I might have a go).

The number of concurrent users, number of searches, page views etc. will all contribute, but in my experience (I do IT capacity for a living) it's very hard to model that without resorting to a complex simulation for each setup and usage profile which will be different for every site.

As your server/setup reaches capacity, the average page render time will increase, and that's what you want to keep down to a level acceptable to users. Ideally you'll also not want to stretch your setup to the point where you couldn't carry out admin functions like backups etc.

--Alan

I find Editplus to be good.
Un-fussy and straightforward with good syntax highlighting.

(It's just a glorified text editor though)

--Alan

*don't flame me*

Are sub-forums going to be part of 1.3 as standard?
(pretty important to my site!)

--Alan

20

(13 replies, posted in PunBB 1.2 troubleshooting)

Ok fair enough!

Is there an extern equivalent that will just output a single post?
Something that does all the parsing/security/etc. but outputs just 1 post? (given the post id of course)

--Alan

21

(13 replies, posted in PunBB 1.2 troubleshooting)

Use a URL include?

Yeah I used to but I found that I was getting performance issues and my host suggested hard-coding the parameters in. As I understand it, using URL includes puts a lot more load on the server.

Now that I know what to comment out it's not so bad. It does seem to be a flaw with extern.php that you can only use it once in a page because of the repeated calls to parse/dblayer etc. Is there a way of detecting whether a function has already be defined and thus not call for those includes again?

Maybe a small global array in which you store details of which functions have already been defined?

--Alan

22

(13 replies, posted in PunBB 1.2 troubleshooting)

I'm using extern.php which includes:

require PUN_ROOT.'include/parser.php';

I call the script a couple of times on my front page and apparently PHP 4.4.6 is fussy (to the point of fatal error) when it tries to redefine existing functions. This only became a problem when my hosts upgraded!

Unless.. Is there a PHP configuration option to make it not fuss?

Is there a more elegant solution than making several copies of extern.php and commenting the call out in all but the first one to be called?

--Alan

23

(2 replies, posted in PunBB 1.2 discussion)

I'm not sure if the 1.3 developers have settled on artwork yet, but I just discovered these and thought they may come in handy as a set of icons/smilies etc.

http://tango.freedesktop.org/Tango_Icon_Library

They seem to be being used across open-source software projects and fit nicely with windows and linux.

--Alan

24

(1 replies, posted in PunBB 1.2 discussion)

Thought this might be interesting for separating navigation stuff and content on forums.

For over a decade, search engines have supported standards allowing you to prevent pages from being spidered or included within a search index. Today, Yahoo now supports a new twist -- a way to flag that part of your page shouldn't be included in an index. It's called the robots-nocontent tag.

http://searchengineland.com/070502-132315.php

--Alan

25

(13 replies, posted in PunBB 1.2 troubleshooting)

My hosts recently upgraded to PHP 4.4.6 and apparently this version is fussy about re-declaring functions.

Do all PunBB pages call include/common.php ??

If so, I could just stick this in it..

require PUN_ROOT.'include/dblayer/common_db.php';

No?

--Alan