Very nice tool (hdiff) and very user-friendly usage on the punbb-site cool

Very good ! Thank you very much !

Hi,

i'm already running punbb 1.2.10 on our site. The forum works very good. I made several changes in several scripts for automatically registering users to our punbb forum when they register on our site - and automatically log them in/out to punbb when logging in/out on our site. Because of stress when going online, i didn't save nowhere what scripts i changed, so i can't just copy the new version 1.2.12 to our punbb-forum - i need to know what scripts have been changed since 1.2.10, so i can check if there are modifications from me in that script. Do you have such a detailed changelog ? Did the database structure change since 1.2.10 ?

4

(18 replies, posted in PunBB 1.2 troubleshooting)

Smartys wrote:

Without seeing the code, I can't really help you

Hmm, it's not much code:

# punbb login

require ('conf/conf.php');
require ('punbb/config.php');
require ('punbb/include/functions.php');

mysql_connect ($DB_HOST, $DB_USER, $DB_PASSWORD);
mysql_select_db ('PUNBB');
$result_pun = mysql_query("select id from users where username = '" . trim ($_POST['testerlogin']) . "'");
$row_pun    = mysql_fetch_array ($result_pun);    
pun_setcookie ($row_pun['id'], pun_hash(trim($_POST['password'])), time() + 86400);

# end of punbb login

Nothing complicated, i don't thing that will be helpful for you...

Smartys wrote:

Well, except to tell you that you should change usage of the DB abstraction class to mysql_query (assuming you're using MySQL) since that seems to be a problem with you for whatever reason (did you define $db somewhere in your code?)

I have my own DAO-classes (by Dao-Pattern), but like you see i did it classical for the begin. I am not using $db anywhere (wrote that already somehwere above), really strange.

Nevertheless, you were right. I didn't see that the serialized data in the pun-cookie are all variables from config.php, so i thought i would have to search them all over the script. At the end it's just determining users id for setting the cookie. hmm

5

(18 replies, posted in PunBB 1.2 troubleshooting)

login.php works, but again the same shit ! Keyword global has not really effect, the referenced variables in $GLOBALS are empty ! I had to edit function pun_setcookie in functions.php with "include ('punbb/config.php');" to include the config cookie variables, but i required punbb/config.php just before !?

Why doesn't it cause a problem because of redefining constant PUN !?

6

(18 replies, posted in PunBB 1.2 troubleshooting)

Ok, i'll try that (will take...20 minutes ?), i'm sure there will be problems.

7

(18 replies, posted in PunBB 1.2 troubleshooting)

Tried to refer $db via function parameters in check_cookie and then in set_default_user, the error now is
'There is no valid language pack '' installed. Please reinstall a language of that name.'

Seems 'global' has no effect in my code !?

Checked that, making print_r($db) one line before the call of check_cookie, the correct object is printed, making print_r($GLOBALS) in line two of check_cookie (after global $db, ...), i get

...
    [db] => 
    [pun_config] => 
    [cookie_name] => 
    [cookie_seed] => 
...

The variables are registered, but empty !?

8

(18 replies, posted in PunBB 1.2 troubleshooting)

Because you're attempting to require a page that was expecting a user to be accessing it?

Accessing it directly or including it on the accessed site is not a big difference.

I read register.php an login.php, they include common.php and call functions from functions.php, i overflew all that stuff because i don't have the time to really analyize the code (would write a simple forum in that time), and i saw it's NOT that easy, because it's not structured by a known criteria (like model-view-controller or similar), so i tried to do it quick and dirty. Where's the problem admitting that punbb is not the universal super-forum for every concern (espacially not for my 'quick and dirty' need) ?

Back to the problem:

Including login.php, I get an error 'function call on non-object' on line 110 on functions.php
line 110: $db->query in set_default_user
set_default_user is called in function check_cookie some lines above
check_cookie is called in common.php which again is included in login.php respectively in register.php

with 'global $db' in set_default_user the out-of-function reference of $db should be used, $db is definately called in common.php, before the call of set_default_user, and a print_r of it gives me

dblayer Object
(
    [prefix] => 
    [link_id] => Resource id #33
    [query_result] => 
    [saved_queries] => Array
        (
        )

    [num_queries] => 0
)

A line later the method startTransaction is called in from that object, without error. But, making print_r in the functions where $db is defined global, i don't get the object !? I never use global, maybe i don't understand it - or is it possible to deactivate it in php.ini without getting warnings from the interpreter ?

9

(18 replies, posted in PunBB 1.2 troubleshooting)

Smartys wrote:

All a function would do is help people who want to be lazy...

That's the sence of functions, api's, oop, frameworks, programming languages, computers and nearly everything in the IT.

Yes, integration should be trivial, an because punbb doesn't use its own sessions, for me it seemed to be very suitable for integrating it into my session-based site. So, if it's that easy, why a simple require doesn't work ?

Smartys wrote:

Err, why not simply look at the code and replicate what it does?

I don't have the time. Easy means for me integratable in 1-2 hours. Nevertheless, thankyou for helping me.

10

(18 replies, posted in PunBB 1.2 troubleshooting)

He he.

Ok, i wanted to link both, i'll try if it works with linking the login, then i could register manually.

I'm just wondering that isn't a problem that occurs whery often. Maybe someone - i don't have the time :-) - should add 3 functions to functions.php: extern_register(...), extern_login(...) and extern_logout(...).

11

(18 replies, posted in PunBB 1.2 troubleshooting)

Smartys wrote:

riki: Why not simply do another insert statement to add the user to the PunBB database?

Because i don't know what is happening before and after (cookies-setting etc.) and I don't want to follow all that code.

Smartys wrote:

And as for why set_default_user is called, it's to allow forum permissions and such to be set for guest users

For 'guest users' after I registered succesfully ?

12

(18 replies, posted in PunBB 1.2 troubleshooting)

Hi,

the site where my forum occurs can only by accessed by members. I don't want them then to register again in punbb. After i didn't find something like a single-site-login interface or how to for that i tried it quick an dirty by simply calling the punbb-registration-routine when a member registers to my site (whith removing the redirect headers):

# manipulate GET and POST to simulate punbb registration

$_GET['action']         = 'register';
$_POST['form_sent']     = 1;
$_POST['req_username']  = $testerData['username'];
$_POST['req_password1'] = $testerData['password1'];
$_POST['req_password2'] = $testerData['password1'];
$_POST['req_email1']    = $testerData['email'];
$_POST['register']      = 'Register'; # button

chdir ('./punbb');   
require_once ('register.php');
chdir ('../');
   
# *** END of punbb registration ***

Fatal error: Call to a member function on a non-object in /srv/www/htdocs/betatest/punbb/include/functions.php on line 110
Line 110: $result = $db->query('SE.... do'nt have the variable $db in my own code anywhere
version 1.2.10

Idea for the reason or a better way to solve my issue as fast as possible ?

And further, why is the function set_default_user (for guests) called ?

Connorhd wrote:

PunBB doesn't use sessions, and integrating your site into PunBB is probably easier.

So, how do you check the sessions ?

That looks more like integrating my website into punbb, not integrating punbb into my website. Further, not one word about sessions !?

Hi,

i'm glad that i've found PunBB (searched a secure forum and just took the one from www.hardened-php.net as they provide php security issues on their side).

I have a site, where the user needs to login or get access to the special area, which includes the forum. Now, off course i don't want a user to login twice, in my site AND to the forum. So, what are the Session-Variables i have to set after a successfull login to MY site (not to the forum), or where can i found the code related to my request ? What information does the cookie contain ?

And further: where can i change the color from blue to red ? :-)