I did search for the answer,ameenullah.That's why i found the answer in my quote.I just want to know how to modify the code so that it can work in my site cos in my site,for password hashing,I used PASSWORD() function which is hashing function that came with mysql

Hello,I've tried to integrate my site and encounter pun_hash() function.Can I use my code inside this function so that I don't have to change all my site
I intend to use mysql function PASSWORD() to make password for users but it cause error when i tried to install punbb

function pun_hash($str)
    {
        /* if (function_exists('sha1'))    // Only in PHP 4.3.0+
            return sha1($str);
        else if (function_exists('mhash'))    // Only if Mhash library is loaded
            return bin2hex(mhash(MHASH_SHA1, $str));
        else
            return md5($str); */
                       return PASSWORD($str);
    }

can i just do that or should i add another code?it i should,can you write it for me?

Hi,i want to integrate punbb to my site so that my site has a forum
Now,my site already published and it have database for site's activity
I already install punBB to my server and then I'm confused.How can I use my existing user in punBB because it's 2 different database
And then I found someone's tips in this forum which look like this.I already tried it and it didn't work out.Can you please help me??

zalew wrote:

4 situations you must predict and solve the problem


1. user is logging from your site

in your login class, function, script, whatever, put after your operations this:

include("./forum/config.php");
include("./forum/include/functions.php");
setcookie($cookie_name, serialize(array($your_sent_login, pun_hash($your_sent_pass))), $expire, $cookie_path, $cookie_domain, $cookie_secure);

of course the forum directory path may be other in your case.
it sets the coookie for the forum.. as you can see, now when you logon on your site, the cookie is set and you're logged on the forum..


2. if the user logs on by forum

on the top of /includes/common.php put session_start();

in /login.php, find the lines below and put code before:

/ * your site login code in here, session data saving, maybe database update, etc... of course put it in a working way, don't blame the forum smile if it's included ok - it must work */
setcookie($cookie_name, serialize(array($db_username, $form_password_hash)), $expire, $cookie_path, $cookie_domain, $cookie_secure);
redirect($_POST['redirect_url'], $lang_login['Login redirect']);


3. user loggs out from your site

in your private  logging out code put this:

include("./forum/config.php");
include("./forum/include/functions.php");
setcookie($cookie_name, serialize(array('Guest', 'Guest')), time() + 31536000, $cookie_path, $cookie_domain, $cookie_secure);


4. user logging out from the forum

find these lines and put your logging out code

setcookie($cookie_name, serialize(array('Guest', 'Guest')), time() + 31536000, $cookie_path, $cookie_domain, $cookie_secure);
/* here your private logging out code */
redirect('index.php', $lang_login['Logout redirect'])