626

(4 replies, posted in PunBB 1.3 troubleshooting)

on every post there is the time a date linkible to the post look:
http://supermag.exofire.net/topic1-how- … cepts.html

2008-03-10 17:35:19  this is linkible to this
http://supermag.exofire.net/post1.html#p1

627

(13 replies, posted in General discussion)

lame hosting .. fools

Mpok wrote:

<mode "non-constructive, but tho.." on> wink
If u want to have a full rewrite mod, just take it from PunBB 1.3, and put it on 1.2 branch.
It DOES work perfectly, as the implementation of url_rewriting is pretty good in 1.3 (thx devs, maybe just a little lack of localization's possibility in sef_friendly() function..).
It's a far better way (IMO) that trying to deal with old mods (which were good as the time they have been published, but now out of date).
</mode>

well the 1.3 is still in construction and it will be impossible to convert my old forum to 1.3 and there are no extensions of 1.3 right now ... at lease some one make a subforum extension ....


but cammon how much time it will take ... 10 15 min for a person who knows php ....

so can some one help me before i get mad and tell every one how bad punbb community is ... oohhhh ... i asking this 100 times ..

629

(13 replies, posted in General discussion)

why dont u buy a bitter hosting ... i.e or buy a resller so cheap: look: http://www.siteground.com/reseller_hosting.htm

As low as $42/yr per account
Fully-featured hosting services
Minimal initial investment
Resell at any price you like
Easy account management
24/7 technical assistance

Account Features:
750 GB web space
7500 GB traffic
Unlimited MySQL
FREE SiteBuilder
99.9% Uptime

Only for 42$ per year .... can any one compete ... which is 3.5$ per month

BEST Benefits for Resellers:
Low Prices for Great Profits
SiteGround Reseller Package will allow you to easily make profit on web hosting. As a SiteGround reseller you receive up to 50% discount for your hosting accounts and you can sell them at any price you want.
Automatic Account Activation
SiteGround Resellers can activate each account automaticly from the Reseller Area. Web Hosting accounts are activated immediately with few mouse clicks!
Easy Management of Accounts
SiteGround has developed easy management tools for its resellers. In your Reseller's Area you will be able to access the control functions for each of your accounts. You can activate, suspend, reactivate accounts, get expert technical support for your reseller package and much more.

See how easy it is to use our Reseller's Area here.


More about of Accounts
24/7 Friendly Tech Support
We serve all critical hosting issues in less than 15 minutes. Our Support team is online 24/7 and is ready to attend to any issue that may endanger your website accessibility.
Phone & Chat Sales Support
SiteGround sales assistants are available for you 24/7 via our sales phone numbers. Call us at 1 800 828 9231 toll free for US or at 1.347.892.2625 for International use.

750 GB Web Space
We provide you with 750 GB of disk space for your website. 750 GB is more than enough space for almost any kind of personal, business, organizational or other kind of website.

7500 GB Monthly Bandwidth
7500 GB monthly bandwidth is more than anyone offers for such a low price! This generous feature allows your website to grow freely and attract more and more visitors!

FREE SiteBuilder
The easiest website builder is included for FREE in the SiteGround hosting account. With its help you will be able to build a great-looking, fully-functional website in less than 30 minutes!
Fast Support Response

SiteGround average response time for critical service-related issues is below 15 minutes. We also provide fast and professional support for multiple other hosting related issues.

More about Support Response
99.9% Server Uptime

Low Prices for Great Profits
SiteGround Reseller Package will allow you to easily make profit on web hosting. As a SiteGround reseller you receive up to 50% discount for your hosting accounts and you can sell them at any price you want.
Automatic Account Activation
SiteGround Resellers can activate each account automaticly from the Reseller Area. Web Hosting accounts are activated immediately with few mouse clicks!
Easy Management of Accounts
SiteGround has developed easy management tools for its resellers. In your Reseller's Area you will be able to access the control functions for each of your accounts. You can activate, suspend, reactivate accounts, get expert technical support for your reseller package and much more.

See how easy it is to use our Reseller's Area here.

More about of Accounts
24/7 Friendly Tech Support
We serve all critical hosting issues in less than 15 minutes. Our Support team is online 24/7 and is ready to attend to any issue that may endanger your website accessibility.
Phone & Chat Sales Support

E-commerce Pack:
FREE Shopping Cart Software
Free shopping cart software is included in the SiteGround hosting plan. We will install OsCommerce (or CRELoaded - the upgraded osCommerce version), ZenCart or CubeCart for FREE on your account. This is a perfect opportunity to start your e-business.

More about FREE Shopping Cart Software
SSL Certificates
A Free Shared SSL certificate is included in the SiteGround hosting plan. You can also add a private SSL certificate to your account from your user's area.

More about SSL Certificates
Accept PayPal payments
With SiteGround E-commerce pack you will be able to easily accept PayPal payments with any of the Shopping cart tool we support.

More about Accept PayPal payments
Merchant Accounts
With SiteGround E-commerce pack you will easily choose the best merchant solution for your needs among the 4 most favorite merchant accounts providers 2CheckOut, PayPal, MerchantLogic and Worldpay!

More about Merchant Accounts
Site Traffic Statistics
SiteGround provides you with three different website statistics: Awstats, Webalizer and Analog stats. All of them include charts and graphs revealing useful information about the traffic your site generates. For example the number of hits, most visited pages, referral URLs and many more.

More about Site Traffic Statistics
Open PGP/GPG Encryption
Great security feature for your email communication! You may use it to send important Business information encrypted via email and to be sure that only people that are authorized will be able to read it.
E-mail Management:
UNLIMITED Email Accounts
You can have UNLIMITED FREE email accounts at your domain name - e.g. you@yourdomain.com.
Web-based Email Access
You can access your email accounts from any computer with an Internet connection. Our hosting plan includes the two most popular web-based mail clients: Horde and SquirrelMail.
SMTP, POP3 and IMAP Servers
On a SiteGround hosting account you can easily send and receive email messages via POP3 and SMTP protocols. The IMAP protocol is the perfect solution if you need your email account to be simultaneously accessible by multiple clients. With SiteGround you can use any email client, such as MS Outlook, Mozilla Thunderbird, Eudora, Pegasus mail and so on.
Forwarding, Aliases, Auto-replies
The forwarders and aliases allow you to forward emails received to any of your email accounts to another mailbox.

Auto Responders allow you to set automatic answers fro email accounts. For example, your customers can receive a confirmation that their inquiry has been received.


Catch-all Mailbox
Email messages, sent to non-existent addresses at your domain can be received in your Catch-all mailbox. Thus you will never lose an important message.
Mailing Lists Available
SiteGround provides phpList application, which allows you to create and manage mailing lists and send easily emails to multiple subscribers.

Website Management Tools:
CPanel Control Panel
You will be able to manage your hosting account with the help of the most popular web-based control panel – CPanel. With the help of its easy interface you will upload files, manage your email accounts, view your website statistics, park domains, manage FTP accounts, subdomains, databases, etc.
Fantastico Script Auto-installer
Fantastico auto-installer is included in the SiteGround hosting package! With its help you will be able to install many useful scripts on your account with only a few mouse clicks. The most popular installs included in Fantastico are Mambo, phpBB, OS Commerce, Coppermine Gallery and many more.
File Manager
With the help of a user-friendly interface you can easily manage all the files uploaded on your account from your CPanel
Password Protected Directories
This feature allows you to limit the access to certain directories for specified users only. For example you can easily create a members' area.
Password Management
You can easily change the password of your Customer Area.
Edit Mime Types
MIME types tell browsers how to handle specific extensions. You can alter or add new MIME types. MIME types are often used to handle new technologies as they appear. When WAP technology first appeared for example, we did not have these extensions set up on our servers. With the MIME types, however, each of our customers could set it up and begin serving WAP pages immediately.
Edit Apache Handlers
Apache handlers tell the server how to deal with web files that need to be processed on the server. For example, Apache is set up to process files with .pl extensions using Perl. However, if for some reason you also want to process files with .script extension using Perl, then you will have to set up a custom Apache handler for your site.
Cron Jobs
Cron jobs allow you to automate repetitive tasks on the server that hosts your web site. This is a powerful tool that allows you to take a hands-free approach to repetitive tasks. For example, you could add a cron job that automatically copies a MySQL database to a separate location on your site as a backup.
IP Banning/Filtering
The IP manager in the CPanel allows you to ban and filter IPs.
Redirect URL
The Redirect URL manager in the CPanel allows you to redirect any URL hosted on your account to opens another URL.
Server Side Includes (SSI)
SSI enables you to include parts of other sites in your site
Hot Link Protection
The CPanel allows you to protect your website content from HotLinking. HotLinking is when someone links a content from your website in a way that consumes your bandwidth.
Www and non-www Access
At SiteGround your website will be accessble, no matter if your visitors type its domain with or without WWW
More than 150 Scripts:
Mambo FREE Installation
SiteGround provides the best Mambo Hosting services form more information click here.

More about Mambo FREE Installation
Joomla FREE Installation
SiteGround provides the best Joomla Hosting services form more information click here.

More about Joomla FREE Installation
osCommerce FREE Installation
SiteGround provided the best osCommerce hosting services. For more information click here.

More about osCommerce FREE Installation
phpBB FREE Installation
SiteGround provided the best phpBB hosting services. For more information click here.

More about phpBB FREE Installation
WordPress FREE Installation
SiteGRound provides the best WordPress hosting services. For more infor click here.

More about WordPress FREE Installation
phpNuke FREE Installation
SiteGround provides the best phpNuke hosting services. For more info click here.

More about phpNuke FREE Installation
Moodle FREE Installation
SiteGround provides the best Moodle hosting services. For more info click here.

More about Moodle FREE Installation
Drupal FREE Installation
SiteGround provides the best Drupal Hosting services. For more info click here.

More about Drupal FREE Installation
MediaWiki FREE Installation
SiteGround provides the best MediaWiki hosting services. For more info click here.

More about MediaWiki FREE Installation
Web Calendar
Easy to install script that will include a Calendar to your website.
Ready-made CGI scripts
In the CPanel there are many CGI scripts that you can install with a few clicks. They include: Agora Shopping Cart, Advanced Guestbook, Java Clock Generator, Java Countdown Generator, Counter Generator, and more.
Custom CGI Scripts
You can add your own custom CGI scripts and execute them from your account.
Exclusive Professional Services
SiteGround provides affordable professional services for the applications and scripts used by its customers. These services include upgrades to latest version, integration of two different applications, adding of modules and components, etc.

More about Exclusive Professional Services

DataBase Management:
UNLIMITED MySQL/Postgre DBs
With SiteGround hosting package you can use UNLIMITED MySQL and Postgres databases. You can manage your databases in a few mouse clicks via the web-based control panel. You are able to add and remove DBs, change passwords, manage permissions and more.
phpMyAdmin and phpPgAdmin
The easiest systems for managing your MySQL and postGre Databases.
FTP Management:
UNLIMITED FTP accounts
With SiteGround you can create UNLIMITED FTP accounts with specific restrictions on what the different people connected to your website can upload and download. It is very easy to add and remove FTP accounts as well as to change their passwords.
Change FTP Login Message
'This feature allows you to change the login message.

Domains and Subdomains:
Affordable Domain Names
As a reseller you can register any of the top domain extensions .com, .net, .org, .biz, .us and .info for $10 only! This is a 33% discount from the regular price!
Unlimited Parked Domains
You can have multiple domain names pointing to your site. This is a great way to increase your online visibility.
Unlimited Subdomains
Our hosting plan includes unlimited free subdomains to allow more freedom for the organization of your site.
5 Addon Domains (extra fee applied)
The extremely affordable addon domain extra feature allows you to host up to 6 websites on your account.
Subdomains Redirects
All your subdomains or directories can redirect the visitor to a URL of your choice.
Emails for Subdomains
You can create mailboxes under your subdomains. For example mail@sub.domain.com
Statistics:
Awstats, Webalizer, Analog
SiteGround provides you with three different website statistics: Awstats, Webalizer and Analog stats. All of them include charts and graphs revealing useful information about the traffic your site generates. For example the number of hits, most visited pages, referral URLs and many more.
Subdomains Stats
Allows you to get information about your subdomains access history.
View Latest Visitors
This feature gives you information about the last 300 visitors who visited your site.
View Bandwidth Usage
With this feature you will never lose track of how much bandwidth your account uses.
View Error Log
Enables you to detect the errors your visitors encounter. Thus you can easily and quickly solve the problems.
Download a Raw Log File
Raw access logs contain all the recorded hit information that your site has received. You can set the Raw Log Manager to archive this information every month and/or delete the previous month's log at the end of every month.

Servers and Infrastructure:
Xeon 3060 2.4 GHz Conroe
The most innovative dual-core processor technology of the Xeon servers Conroe series guarantee the speed and the flawless functioning of your website.
Red Hat Enterprise Linux 4
SiteGround system administrators continuously optimize the servers' performance to achieve the highest levels of speed and security. We use one of the most stable operating systems - Red Hat Linux. Our servers are also equipped with all your website needs to operate properly - Apache, MySQL, PHP, mail server,etc.
Customized Apache Web Server
SiteGround system administrators have customized the Apache Web Server in order to achieve the highest levels of speed and security.
MySQL server Version 4
The MySQL is the most widely used Database system on Linux Servers.
Redundant Firewall
For maximum security of your web hosting accounts we use redundant firewall system.
Redundant Backbone Connections
Our servers are located at the best data-centers in USA (Dallas and Houston, Texas). To provide your website with the fastest possible data transfers we have a 100 Mbps internet connection to the most powerful backbone Internet providers in the USA
Redundant UPS Power Back-up
The UPS power Back-ups insure that your data will not be damaged in case of emergency power shortages.
24/7 Server Monitoring
SiteGround System Administrators has created a State -of-art system for 24/7 server performance monitoring to ensure extra security for your website.
24/7 Network Monitoring
SiteGround System Administrator team is constantly monitoring the network devices and infrastructure to protects it from various attacks.

Weekly Backups
You account information is backed up once a week on a different server from the one that hosts your primary account. This provides extra security for your data.
PHP & Multimedia Technology:
PHP 5.0, PHP 5.1 and PHP 5.2
SiteGround has a unique server setup that allows each customer to choose which version of the PHP to use for its account. The customer can even use different PHP versions for different directories in one and the same hosting account.

More about PHP 5.0, PHP 5.1 and PHP 5.2
Perl and Python Supported
Apart from PHP, Perl and Python are the other script languages you can use with your account.
Zend Optimizer, Safe Mod off
Zend Optimizer and Safe Mod off optimize the way PHP is handeled by the server.

GD library, ImageMagick, CURL, Zlib
Different galerry and php libraries.
Mod_rewrite, .htaccess
Mod_rewrite, .htaccess
Smarty Templates, php.ini
Helpful PHP technologies.
XML, HTML, XHTML, VRML, WAP
Our servers are compatible with XML, HTML, XHTML, VRML, WAP, WML
Macromedia Shockwave and Flash
Our servers are compatible with Macromedia products Shockwave and Flash.
Quicktime Compatible
Our servers are compatible with Quicktime.
MPEG, MP3, PDF, FLV
Our servers are compatible with MPEG, MP3, PDF and FLV file formats.

what is ur site and the latest version of megapun (megapun 5) has it ... updated your forum

xsdmx wrote:

SuperMag, how did you get "Re: hea guys .... sorry about..." working with Megapun? on the forums.php?

oh you mean Last post's subject on forum index: http://wiki.punres.org/Last_post%27s_su … orum_index

and guys can some one help me with this pllease:

SuperMAG wrote:

i fixed a few problems after 3 hrs of working on it ... but there are fiew major things that i cant understand ....

1- the redriects in viewtopic.php

+ these are two codes which needs to be changed ...

redirect(PUN_ROOT.'viewtopic.php?id='.$id, $lang_topic_rating['Topic rating increased']);
redirect(PUN_ROOT.'viewtopic.php?id='.$id, $lang_topic_rating['Topic rating decreased']);

what should i change these two codes so that it redirects to the sef url topic

+ when some one post a topic or post or delete a post or edit a post it redirects to the old urls ... how can i change that .. if any thing is required like edit.php file or delete.php file or post.php file then tell me i am ready ...

2- the most hardist bugs ... in forum.php .. the subforums urls are old urls while others are changed .. how can i change that ....

PLEASE SOME ONE HELP .... THANKS IN ADVANCE

i fixed a few problems after 3 hrs of working on it ... but there are fiew major things that i cant understand ....

1- the redriects in viewtopic.php

+ these are two codes which needs to be changed ...

redirect(PUN_ROOT.'viewtopic.php?id='.$id, $lang_topic_rating['Topic rating increased']);
redirect(PUN_ROOT.'viewtopic.php?id='.$id, $lang_topic_rating['Topic rating decreased']);

what should i change these two codes so that it redirects to the sef url topic

+ when some one post a topic or post or delete a post or edit a post it redirects to the old urls ... how can i change that .. if any thing is required like edit.php file or delete.php file or post.php file then tell me i am ready ...

2- the most hardist bugs ... in forum.php .. the subforums urls are old urls while others are changed .. how can i change that ....

PLEASE SOME ONE HELP .... THANKS IN ADVANCE

Smartys wrote:

Probably because of the fulltext index.

why does 1.2 have halftext index ... ha haha ha ... just kidding ....

elbekko wrote:

There are 10k more posts. If they're large posts, that can easily be done. UTF-8 might play a bit in there too.

what 10 k ... i see

1.2: in the first pic there are 335289 posts having 129.7 mb of db

1.3: and in the second there are 345613 posts having 218.0 mb of db ...

FBI wrote:
SuperMAG wrote:

you got to be kidding me .. 229 mb db .... what is ur site ... i use megapan which have more then 50 mods and i have 300 members + 3000 posts + 600 topics ...
and my site db is 1.XX mb only

Yes correct.
Here my phpmyadmin reports screenshoot smile

First are old databases from PunBB 1.2.x
http://img412.imageshack.us/img412/3923/oldxq9.th.gif


Second is newest 1.3 Beta after 2 weeks running
http://img412.imageshack.us/img412/6420/newqg0.th.gif

how come when you converted from 1.2 to 1.3 the posts size become double

FBI wrote:

Environment
Operating system: Linux
PHP: 4.4.7 - Show info
Accelerator: N/A

Database
MySQL 4.1.22-standard-log
Rows: 415067
Size: 229.62 MB

Currently most active user online is 500.
Normally, 100-200 online user at same time.

Statistic:
Member: 31636
Topics: 24496
Posts: 344150

at PunBB 1.2.x there is a huge cpu resources on Share Hosting. Sometimes they (host) complain smile
at PunBB 1.3 ... still watch. No report yet at last 2 weeks

you got to be kidding me .. 229 mb db .... what is ur site ... i use megapan which have more then 50 mods and i have 300 members + 3000 posts + 600 topics ...
and my site db is 1.XX mb only

MattF wrote:
SuperMAG wrote:

when i buy it i will begain big project

Wouldn't 'I'll be coercing everybody into helping me create my big project with a multitude of help threads' be a better description? big_smile

intresting ... but i didnt mension any thing about help ... besides the punbb 1.3 is still not ready yet ... i will use it as a main site ...

but u seemed intresting ... what is your big project

well what ever ... i am also using it as a test right know ...

still didnt buyed a domain for my site ... when i buy it i will begain big project

look at my signature of ProsGate

xsdmx wrote:

I second this, I need to figure out how to get that news link on the frontpage to rewrite, and get the profile correctly rewritten.

i already found out that ... just need to change the code in the above post to make it post the SEF url

Paul wrote:

The question doesn't really make sense since SMF, VB and phpBB have different feature sets. If I wanted a forum with an identical feature set as VB then I would buy a VB license. I can't see any point in modding one forum to be a clone of another.

The idea of starting with a forum without all the bells and whistles is to add only the extra features that you want and end up with something that exactly fits your requirements. If you actaully want all the bells and whistles it makes far more sense to select a script that already has them.

i am not looking for features ...

just suppose that identical feartures with those forum ...

i want to see which will be fast and secure ...

Punbb or them

elbekko wrote:

That depends on the quality of the modifications.

you mean how good modifications are ....

suppose they are as good as the other forums

well thanks for the tips guys ... but can i ask u a question ....

if we modded the punbb ... with all the same features as
SMF
VB
PhpBB

which will be faster

i am currently researching some thing which concerns all the forum softwares ....

i have heard all around the net about Queries which make the difference of speed etc ...

so i collected these information so that the developers of punbb can get some thing out of it ...

i will only include the Queries of main forum page ...


AEF 1.0.5
http://www.anelectron.com/board/
Queries: 10  |  Page Created In:0.519

this is the most surprizing of all ... i mean look at its mods ... they are like vbulletin but thier Queries are only 10 they are almost near punbb 1.3 beta .. i encurage the developers to look at thier source and see what tricks they used to make such low queries on rich featured forum ...



Punbb 1.3 beta
[ Generated in 0.018 seconds, 8 queries executed ] some time 7 ... which confuze me why these quries changes ...


can some one provede details of these forums including amount of queries in the main forum page
SMF
PHPBB
vBulletin
mybb
yabbb
smartbb

SuperMAG wrote:
MattF wrote:
<?php
define('PUN_ROOT', './');
require_once PUN_ROOT.'include/parser.php';
?>

that worked .. thanks alot ... but i got another problems ..

i improved the code furthur for my include/user/cb.php

look:

<?php
define('PUN_ROOT', './');
require_once PUN_ROOT.'include/parser.php';


// Load the chatbox.php and post.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/chatbox.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/post.php';

if ($pun_user['g_read_board'] == '0')
    message($lang_common['No view']);

?>

<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/chatbox.js"></script>

<div class="block">


 <h2>
    <span>
        <span class="conr" ><img style="display:none;" id="loading" name="loading" src="img/loading.gif" /></span>
    <?php echo $lang_chatbox['Chatbox'] ?> <span style="font-size:7px;vertical-align:super;"><?php if ($pun_config['o_show_version'] == '1') echo ' '.$pun_config['cb_pbb_version']; ?></span>
    </span>
  </h2>
    <div class="box">
        <div id="chatbox" class="inbox" style="overflow:auto;height:<?php echo $pun_config['cb_height'] ?>px;">
<?php

$cur_msg_txt = '';
$last_msg_time = '';
$count_id = array();

$result = $db->query('SELECT u.id, u.group_id, u.num_posts_chatbox, m.id AS m_id, m.poster_id, m.poster, m.poster_ip, m.poster_email, m.message, m.posted, g.g_id, g.g_title_chatbox FROM '.$db->prefix.'chatbox_msg AS m INNER JOIN '.$db->prefix.'users AS u ON u.id=m.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id ORDER BY m.posted DESC LIMIT '.$pun_config['cb_max_msg']) or error('Unable to fetch messages', __FILE__, __LINE__, $db->error());

$new_msg_time = false;
while ($cur_msg = $db->fetch_assoc($result)) {
    
    // Get newest timestamp
    if ($new_msg_time == false) {
        $last_msg_time = $cur_msg['posted'];
        $new_msg_time = true;
    }
    $cur_msg_txt = $pun_config['cb_space'].$cur_msg['g_title_chatbox'].$pun_config['cb_disposition'].$cur_msg_txt;
    
if ($cur_msg['g_id'] != PUN_GUEST)
        $cur_msg_txt = str_replace('<pun_username>', '<a href="profile.php?id='.$cur_msg['id'].'"><span style="color: '.$cur_msg['g_color'].'">'.pun_htmlspecialchars($cur_msg['poster']).'</span></a>', $cur_msg_txt);
    else
      $cur_msg_txt = str_replace('<pun_username>', pun_htmlspecialchars($cur_msg['poster']), $cur_msg_txt);

    $cur_msg_txt = str_replace('<pun_date>', format_time($cur_msg['posted']), $cur_msg_txt);
    
        if ($cur_msg['g_id'] != PUN_GUEST)
      $cur_msg_txt = str_replace('<pun_nbpost>', $cur_msg['num_posts_chatbox'], $cur_msg_txt);
    else
    {

      if (!isset($count_id[$cur_msg['poster']]))
      {
        $like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE';
        
        $count = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'chatbox_msg WHERE poster '.$like_command.' \''.$db->escape(str_replace('*', '%', $cur_msg['poster'])).'\'') or error('Unable to fetch user chatbox post count', __FILE__, __LINE__, $db->error());
        $num_post = $db->result($count);
        $count_id[$cur_msg['poster']] = $num_post;
      }
      else
        $num_post = $count_id[$cur_msg['poster']];

      $cur_msg_txt = str_replace('<pun_nbpost>', $num_post, $cur_msg_txt);
    }

    $cur_msg_txt = str_replace('<pun_nbpost_txt>', $lang_chatbox['Posts'], $cur_msg_txt);

        if ($pun_user['g_id'] < PUN_GUEST)
      {
      $cur_msg_admin = ' [ <a href="chatbox.php?del='.$cur_msg['m_id'].'">Delete</a> | <a href="chatbox.php?get_host='.$cur_msg['m_id'].'">'.$cur_msg['poster_ip'].'</a>';
      if ($cur_msg['poster_email'])
              $cur_msg_admin .= ' | <a href="mailto:'.$cur_msg['poster_email'].'">'.$lang_common['E-mail'].'</a> ]';
          else
            $cur_msg_admin .= ' ] ';
        }
    else
      $cur_msg_admin = '';

      $cur_msg_txt = str_replace('<pun_admin>', $cur_msg_admin, $cur_msg_txt);
      $cur_msg_txt = str_replace('<pun_message>', parse_message($cur_msg['message'], 0), $cur_msg_txt);

  }


if (!$cur_msg_txt)
    echo $lang_chatbox['No Message'];
else
    echo "\t\t\t".$cur_msg_txt."\n";
?>


        </div>
    </div>








  <h2>
    <span>
    <script language="javascript">
    <!--
    // This checkbox is utterly useless, unless we have javascript enabled. As such, we won't display it until then.
    document.write('<span class="conr" style="width:150px;" ><?php echo $lang_chatbox['Autoscroll'] ?>: <input type="checkbox" id="autoscroll" value="" checked  tabindex="<?php echo $cur_index++ ?>" /></span>');

    // -->
    </script>
<?php
if ($pun_user['g_post_chatbox'] == '1') {
    $cur_index = 1;
?>
      <form id="post" method="post" name="formulaire" action="chatbox.php" onsubmit="send_message(); return false;">
         <input type="hidden" name="form_sent" value="1" />
         <input type="hidden" name="form_user" id="form_user" value="<?php echo (!$pun_user['is_guest']) ? pun_htmlspecialchars($pun_user['username']) : 'Guest'; ?>" />
<?php
    if ($pun_user['is_guest']) {
        $email_label = ($pun_config['p_force_guest_email'] == '1') ? '<strong>'.$lang_common['E-mail'].':</strong>' : $lang_common['E-mail'];
        $email_form_name = ($pun_config['p_force_guest_email'] == '1') ? 'req_email' : 'email';
        
        if($email_form_name = 'req_email')
            echo "\t".'<input type="hidden" name="email" id="email" value="" />'."\n";
        else
            echo "\t".'<input type="hidden" name="req_email" id="req_email" value="" />'."\n";
?>
          <strong><?php echo $lang_post['Guest name'] ?>:</strong> <input type="text" name="req_username" id="req_username" value="<?php if (isset($_POST['req_username'])) echo pun_htmlspecialchars($username); ?>" size="15" maxlength="25" tabindex="<?php echo $cur_index++ ?>" /> 
          <?php echo $email_label ?> <input type="text" name="<?php echo $email_form_name ?>" id="<?php echo $email_form_name ?>" value="<?php if (isset($_POST[$email_form_name])) echo pun_htmlspecialchars($email); ?>" size="15" maxlength="50" tabindex="<?php echo $cur_index++ ?>" /> 
<?php
    }
    else {
?>
          <input type="hidden" name="req_username" id="req_username" value="" /> 
          <input type="hidden" name="email" id="email" value="" /> 
          <input type="hidden" name="req_email" id="req_email" value="" /> 
<?php
    }
?>
         <strong><?php echo $lang_chatbox['Message'] ?>:</strong> <input type="text" name="req_message"  id="req_message" value="<?php if (isset($_POST['req_message'])) echo pun_htmlspecialchars($message); ?>" size="35" maxlength="<?php echo $pun_config['cb_msg_maxlength'] ?>"  tabindex="<?php echo $cur_index++ ?>" /> 
         <input type="submit" name="submit" value="Submit" accesskey="s" tabindex="<?php echo $cur_index++ ?>" />
    <script language="javascript">
    <!--
    document.formulaire.req_message.focus();
    // -->
    </script>
    </form>
<?php
}
else
    echo $lang_chatbox['No Post Permission'];
?>
    </span>
  </h2>
</div>
<script language="javascript">
    // Begin getting messages
    var LastMsg = '<?php echo $last_msg_time; ?>';
    $('autoscroll').value = 'true';
    get_messages();
    checker = new PeriodicalExecuter(get_messages, <?php echo $pun_config['cb_ajax_refresh']; ?>);
</script>

look at this chat www.sportstv.co.cc/chatbox.php
and look at the index page chat ... www.sportstv.co.cc

1- the style is all curropted ... for guests ...
2- guest cant post after the sitting for guest are on ... it shows this error:

Error] - Today 00:35:20
Usernames must be at least 2 characters long. Please choose another (longer) username.

3- the user groups are all not colourfull but they are colourfull in the chatbox.php page

--------------------------------------------------------------------------------

here is my chatbox.php code:

<?php
/***********************************************************************

  Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)

  This file is part of PunBB.

  PunBB is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published
  by the Free Software Foundation; either version 2 of the License,
  or (at your option) any later version.

  PunBB is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  MA  02111-1307  USA

************************************************************************/

define('PUN_ALT4',1);
if (!defined('PUN_ROOT')) define('PUN_ROOT','./');


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

$lang_common['lang_encoding'] = 'utf-8';
header('Content-type: text/html; charset=utf-8');

if (!$pun_config['cb_pbb_version'])
    message('Poki BB Chatbox is not installed correctly. Please make sure you have launch install_mod.php');

if ($pun_user['g_read_board'] == '0')
    message($lang_common['No view']);

// Load the chatbox.php and post.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/chatbox.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/post.php';

// if it's ajax
if (isset($_GET['ajax']))
{

    // 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
    
    if ($_GET['action'] == 'add')
    {
        // Start with a clean slate
        $error = $pun_config['cb_space'].$pun_config['cb_ajax_errors'];
        $error = str_replace('<pun_error>', $lang_chatbox['Error Title'], $error);
        $error = str_replace('<pun_date>', format_time(time()), $error);
        
        //exit('error:chat'.str_replace('<pun_error_text>', parse_message($value, 0), $error));
    
        // Make sure form_user is correct
        if (($pun_user['is_guest'] && $_GET['form_user'] != 'Guest') || (!$pun_user['is_guest'] && $_GET['form_user'] != $pun_user['username']))
            exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_common['Bad request'], 0), $error));
        
        // Do we have permission to post?
        if ($pun_user['g_post_chatbox'] != '1')
            exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_chatbox['No Post Permission'], 0), $error));

        // Flood protection
        if (!$pun_user['is_guest'] && $pun_user['last_post_chatbox'] != '' && (time() - $pun_user['last_post_chatbox']) < $pun_user['g_post_flood_chatbox'])
            exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_post['Flood start'].' '.$pun_user['g_post_flood_chatbox'].' '.$lang_post['flood end'], 0), $error));
    
        if ($pun_user['is_guest'])
        {
$result = $db->query('SELECT u.id, u.group_id, u.num_posts_chatbox, m.id AS m_id, m.poster_id, m.poster, m.poster_ip, m.poster_email, m.message, m.posted, g.g_id, g.g_title_chatbox, g.g_color FROM '.$db->prefix.'chatbox_msg AS m INNER JOIN '.$db->prefix.'users AS u ON u.id=m.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id ORDER BY m.posted DESC LIMIT '.$pun_config['cb_max_msg']) or error('Unable to fetch messages', __FILE__, __LINE__, $db->error());
            $cur_post = $db->fetch_assoc($result);
            
            if ((time() - $cur_post['posted']) < $pun_user['g_post_flood_chatbox'])
                exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_post['Flood start'].' '.$pun_user['g_post_flood_chatbox'].' '.$lang_post['flood end'], 0), $error));
        }
        
        // If the user is logged in we get the username and e-mail from $pun_user
        if (!$pun_user['is_guest'])
        {
            $username = $pun_user['username'];
            $email = $pun_user['email'];
        }
        // Otherwise it should be in $_GET
        else
        {
            $username = trim($_GET['req_username']);
            $email = strtolower(trim(($pun_config['p_force_guest_email'] == '1') ? $_GET['req_email'] : $_GET['email']));
    
            // Load the register.php/profile.php language files
            require PUN_ROOT.'lang/'.$pun_user['language'].'/prof_reg.php';
            require PUN_ROOT.'lang/'.$pun_user['language'].'/register.php';
    
            // It's a guest, so we have to validate the username
            if (strlen($username) < 2)
                exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_prof_reg['Username too short'], 0), $error));
            else if (!strcasecmp($username, 'Guest') || !strcasecmp($username, $lang_common['Guest']))
                exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_prof_reg['Username guest'], 0), $error));
            else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $username))
                exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_prof_reg['Username IP'], 0), $error));
    
            if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false)
                exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_prof_reg['Username reserved chars'], 0), $error));
            if (preg_match('#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[quote=|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i', $username))
                exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_prof_reg['Username BBCode'], 0), $error));
    
            // Check username for any censored words
            $temp = censor_words($username);
            if ($temp != $username)
                exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_register['Username censor'], 0), $error));
    
            // Check that the username (or a too similar username) is not already registered
            $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE username=\''.$db->escape($username).'\' OR username=\''.$db->escape(preg_replace('/[^\w]/', '', $username)).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
            if ($db->num_rows($result))
            {
                $busy = $db->result($result);
                exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_register['Username dupe 1'].' '.pun_htmlspecialchars($busy).'. '.$lang_register['Username dupe 2'], 0), $error));
            }
    
            if ($pun_config['p_force_guest_email'] == '1' || $email != '')
            {
                require PUN_ROOT.'include/email.php';
                if (!is_valid_email($email))
                    exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_common['Invalid e-mail'], 0), $error));
            }            
            
        }
    
        // Clean up message from POST
        $message = str_replace('-|-', '+', pun_linebreaks(pun_trim($_GET['req_message'])));
        
        if ($message == '')
            exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_chatbox['Error No message'], 0), $error));
        else if (strlen($message) > $pun_config['cb_msg_maxlength'])
            exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_chatbox['Error Too long message'], 0), $error));
        else if ($pun_config['p_message_all_caps'] == '0' && strtoupper($message) == $message && $pun_user['g_id'] > PUN_MOD)
            $message = ucwords(strtolower($message));
    
        $errors = '';
        // Validate BBCode syntax
        if ($pun_config['p_message_bbcode'] == '1' && strpos($message, '[') !== false && strpos($message, ']') !== false)
            $message = preparse_bbcode($message, $errors);
            
        if ($errors != '')
        exit('error:chat'.str_replace('<pun_error_text>', parse_message($errors[0], 0), $error));


        $now = time();

        if (!$pun_user['is_guest'])
        {
            // Insert message
            $db->query('INSERT INTO '.$db->prefix.'chatbox_msg (poster, poster_id, poster_ip, message, posted) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', \''.$db->escape($message).'\', '.$now.')') or error('Unable to post message', __FILE__, __LINE__, $db->error());

            // Increment his/her chatbox post count
              $low_prio = ($db_type == 'mysql') ? 'LOW_PRIORITY ' : '';
              $db->query('UPDATE '.$low_prio.$db->prefix.'users SET num_posts_chatbox=num_posts_chatbox+1, last_post_chatbox='.$now.' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());

        }
        else
        {
            // Insert message
            $email_sql = ($pun_config['p_force_guest_email'] == '1' || $email != '') ? '\''.$email.'\'' : 'NULL';
            $db->query('INSERT INTO '.$db->prefix.'chatbox_msg (poster, poster_id, poster_ip, poster_email, message, posted) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', '.$email_sql.', \''.$db->escape($message).'\', '.$now.')') or error('Unable to post message', __FILE__, __LINE__, $db->error());
        }

        $count = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'chatbox_msg') or error('Unable to fetch chatbox post count', __FILE__, __LINE__, $db->error());
        $num_post = $db->result($count);
        
        $limit = ($num_post-$pun_config['cb_max_msg'] <= 0) ? 0 : $num_post-$pun_config['cb_max_msg'];
        
        
        $result = $db->query('SELECT id,posted FROM '.$db->prefix.'chatbox_msg ORDER BY posted ASC LIMIT '.$limit) or error('Unable to select post to delete', __FILE__, __LINE__, $db->error());
        while ($del_msg = $db->fetch_assoc($result))
        {
        $db->query('DELETE FROM '.$db->prefix.'chatbox_msg WHERE id = '.$del_msg['id'].' LIMIT 1') or error('Unable to delete post', __FILE__, __LINE__, $db->error());
        }
        
        $_GET['req_message'] = NULL;
    }

        $cur_msg_txt = '';
        $response = '';
        $count_id = array();

        $last_msg_time = intval($_GET['last_msg']);
        //$messages = $db->query('SELECT u.id, u.group_id, u.num_posts_chatbox, m.id AS m_id, m.poster_id, m.poster, m.poster_ip, m.poster_email, m.message, m.posted, g.g_id, g.g_title_chatbox FROM '.$db->prefix.'chatbox_msg AS m INNER JOIN '.$db->prefix.'users AS u ON u.id=m.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE m.posted > '.$last_msg_time.' ORDER BY m.posted DESC LIMIT '.$pun_config['cb_max_msg']) or error('Unable to fetch messages', __FILE__, __LINE__, $db->error());
        $messages = $db->query('SELECT u.id, u.group_id, u.num_posts_chatbox, m.id AS m_id, m.poster_id, m.poster, m.poster_ip, m.poster_email, m.message, m.posted, g.g_id, g.g_title_chatbox FROM '.$db->prefix.'chatbox_msg AS m INNER JOIN '.$db->prefix.'users AS u ON u.id=m.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE m.posted > '.$last_msg_time.' ORDER BY m.posted DESC LIMIT 0,50') or error('Unable to fetch messages', __FILE__, __LINE__, $db->error());

        $i = 0;
        while ($cur_msg = $db->fetch_assoc($messages))
        {    
        $i++;
        if ($i == 1)
        {
            // Get newest timestamp
            $response = $cur_msg['posted'];
        }
        $cur_msg_txt .= $pun_config['cb_space'].$cur_msg['g_title_chatbox'].$pun_config['cb_disposition'];
        
if ($cur_msg['g_id'] != PUN_GUEST)
        $cur_msg_txt = str_replace('<pun_username>', '<a href="profile.php?id='.$cur_msg['id'].'"><span style="color: '.$cur_msg['g_color'].'">'.pun_htmlspecialchars($cur_msg['poster']).'</span></a>', $cur_msg_txt);
    else
        $cur_msg_txt = str_replace('<pun_username>', pun_htmlspecialchars($cur_msg['poster']), $cur_msg_txt);
        
        $cur_msg_txt = str_replace('<pun_date>', format_time($cur_msg['posted']), $cur_msg_txt);
                
            if ($cur_msg['g_id'] != PUN_GUEST)
        $cur_msg_txt = str_replace('<pun_nbpost>', $cur_msg['num_posts_chatbox'], $cur_msg_txt);
        else
        {
        
        if (!isset($count_id[$cur_msg['poster']]))
        {
        $like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE';
        
        $count = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'chatbox_msg WHERE poster '.$like_command.' \''.$db->escape(str_replace('*', '%', $cur_msg['poster'])).'\'') or error('Unable to fetch user chatbox post count', __FILE__, __LINE__, $db->error());
        $num_post = $db->result($count);
        $count_id[$cur_msg['poster']] = $num_post;
        }
        else
        $num_post = $count_id[$cur_msg['poster']];
        
        $cur_msg_txt = str_replace('<pun_nbpost>', $num_post, $cur_msg_txt);
        }
        
        $cur_msg_txt = str_replace('<pun_nbpost_txt>', $lang_chatbox['Posts'], $cur_msg_txt);
        
            if ($pun_user['g_id'] < PUN_GUEST)
          {
        $cur_msg_admin = ' [ <a href="chatbox.php?del='.$cur_msg['m_id'].'">Delete</a> | <a href="chatbox.php?get_host='.$cur_msg['m_id'].'">'.$cur_msg['poster_ip'].'</a>';
        if ($cur_msg['poster_email'])
                $cur_msg_admin .= ' | <a href="mailto:'.$cur_msg['poster_email'].'">'.$lang_common['E-mail'].'</a> ]';
            else
              $cur_msg_admin .= ' ] ';
            }
        else
        $cur_msg_admin = '';
        
        $cur_msg_txt = str_replace('<pun_admin>', $cur_msg_admin, $cur_msg_txt);
        $cur_msg_txt = str_replace('<pun_message>', parse_message($cur_msg['message'], 0), $cur_msg_txt);
        
        $response .= $cur_msg_txt . "\n";
    }
    if (!$response)
        $response = $last_msg_time;
    
    $response = pun_trim($response);
    
    exit($response);

}

// This particular function doesn't require forum-based moderator access. It can be used
// by all moderators and admins.

if (isset($_GET['del']))
{
    if ($pun_user['g_id'] > PUN_MOD)
        message($lang_common['No permission']);

        $id = intval($_GET['del']);
        if ($id < 1)
            message($lang_common['Bad request']);


$result = $db->query('Delete From '.$db->prefix.'chatbox_msg WHERE id='.$id.'') or error('Unable to fetch post IP address', __FILE__, __LINE__, $db->error()); 
}


if (isset($_GET['get_host']))
{
    if ($pun_user['g_id'] > PUN_MOD)
        message($lang_common['No permission']);

    // Is get_host an IP address or a post ID?
    if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $_GET['get_host']))
        $ip = $_GET['get_host'];
    else
    {
        $get_host = intval($_GET['get_host']);
        if ($get_host < 1)
            message($lang_common['Bad request']);

        $result = $db->query('SELECT poster_ip FROM '.$db->prefix.'chatbox_msg WHERE id='.$get_host) or error('Unable to fetch post IP address', __FILE__, __LINE__, $db->error());
        if (!$db->num_rows($result))
            message($lang_common['Bad request']);

        $ip = $db->result($result);
    }

    message('The IP address is: '.$ip.'<br />The host name is: '.@gethostbyaddr($ip).'<br /><br /><a href="admin_users.php?show_users='.$ip.'">Show more users for this IP</a>');
}

$page_title = pun_htmlspecialchars($lang_chatbox['Page_title']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';

if ($pun_user['g_read_chatbox'] != '1')
  message($lang_chatbox['No Read Permission']);

// Did someone just hit "Submit"?
if (isset($_POST['form_sent']))
{

    // Make sure form_user is correct
    if (($pun_user['is_guest'] && $_POST['form_user'] != 'Guest') || (!$pun_user['is_guest'] && $_POST['form_user'] != $pun_user['username']))
        message($lang_common['Bad request']);

  // Do we have permission to post?
  if ($pun_user['g_post_chatbox'] != '1')
    message($lang_chatbox['No Post Permission']);

  // Start with a clean slate
  $errors = array();

    // Flood protection
    if (!$pun_user['is_guest'] && $pun_user['last_post_chatbox'] != '' && (time() - $pun_user['last_post_chatbox']) < $pun_user['g_post_flood_chatbox'])
        $errors[] = $lang_post['Flood start'].' '.$pun_user['g_post_flood_chatbox'].' '.$lang_post['flood end'];

  if ($pun_user['is_guest'])
  {
    $result = $db->query('SELECT id, poster_ip, posted FROM '.$db->prefix.'chatbox_msg WHERE poster_ip=\''.get_remote_address().'\' ORDER BY posted DESC LIMIT 1') or error('Unable to fetch messages for flood protection', __FILE__, __LINE__, $db->error());
    $cur_post = $db->fetch_assoc($result);

    if ((time() - $cur_post['posted']) < $pun_user['g_post_flood_chatbox'])
          $errors[] = $lang_post['Flood start'].' '.$pun_user['g_post_flood_chatbox'].' '.$lang_post['flood end'];
  }

  // If the user is logged in we get the username and e-mail from $pun_user
    if (!$pun_user['is_guest'])
    {
        $username = $pun_user['username'];
        $email = $pun_user['email'];
    }

    // Otherwise it should be in $_POST
    else
    {
        $username = trim($_POST['req_username']);
        $email = strtolower(trim(($pun_config['p_force_guest_email'] == '1') ? $_POST['req_email'] : $_POST['email']));

        // Load the register.php/profile.php language files
        require PUN_ROOT.'lang/'.$pun_user['language'].'/prof_reg.php';
        require PUN_ROOT.'lang/'.$pun_user['language'].'/register.php';

        // It's a guest, so we have to validate the username
        if (strlen($username) < 2)
            $errors[] = $lang_prof_reg['Username too short'];
        else if (!strcasecmp($username, 'Guest') || !strcasecmp($username, $lang_common['Guest']))
            $errors[] = $lang_prof_reg['Username guest'];
        else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $username))
            $errors[] = $lang_prof_reg['Username IP'];

        if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false)
            $errors[] = $lang_prof_reg['Username reserved chars'];
        if (preg_match('#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[quote=|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i', $username))
            $errors[] = $lang_prof_reg['Username BBCode'];

        // Check username for any censored words
        $temp = censor_words($username);
        if ($temp != $username)
            $errors[] = $lang_register['Username censor'];

        // Check that the username (or a too similar username) is not already registered
        $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE username=\''.$db->escape($username).'\' OR username=\''.$db->escape(preg_replace('/[^\w]/', '', $username)).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
        if ($db->num_rows($result))
        {
            $busy = $db->result($result);
            $errors[] = $lang_register['Username dupe 1'].' '.pun_htmlspecialchars($busy).'. '.$lang_register['Username dupe 2'];
        }

        if ($pun_config['p_force_guest_email'] == '1' || $email != '')
        {
            require PUN_ROOT.'include/email.php';
            if (!is_valid_email($email))
                $errors[] = $lang_common['Invalid e-mail'];
        }
    }

    // Clean up message from POST
    $message = pun_linebreaks(pun_trim($_POST['req_message']));

    if ($message == '')
        $errors[] = $lang_chatbox['Error No message'];
    else if (strlen($message) > $pun_config['cb_msg_maxlength'])
        $errors[] = $lang_chatbox['Error Too long message'];
    else if ($pun_config['p_message_all_caps'] == '0' && strtoupper($message) == $message && $pun_user['g_id'] > PUN_MOD)
        $message = ucwords(strtolower($message));

    // Validate BBCode syntax
    if ($pun_config['p_message_bbcode'] == '1' && strpos($message, '[') !== false && strpos($message, ']') !== false)
    {
        $message = preparse_bbcode($message, $errors);
    }

    // Did everything go according to plan?
    if (empty($errors))
    {
    $now = time();

        if (!$pun_user['is_guest'])
        {
            // Insert message
            $db->query('INSERT INTO '.$db->prefix.'chatbox_msg (poster, poster_id, poster_ip, message, posted) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', \''.$db->escape($message).'\', '.$now.')') or error('Unable to post message', __FILE__, __LINE__, $db->error());

          // Increment his/her chatbox post count
              $low_prio = ($db_type == 'mysql') ? 'LOW_PRIORITY ' : '';
              $db->query('UPDATE '.$low_prio.$db->prefix.'users SET num_posts_chatbox=num_posts_chatbox+1, last_post_chatbox='.$now.' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());

        }
        else
        {
            // Insert message
            $email_sql = ($pun_config['p_force_guest_email'] == '1' || $email != '') ? '\''.$email.'\'' : 'NULL';
            $db->query('INSERT INTO '.$db->prefix.'chatbox_msg (poster, poster_id, poster_ip, poster_email, message, posted) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', '.$email_sql.', \''.$db->escape($message).'\', '.$now.')') or error('Unable to post message', __FILE__, __LINE__, $db->error());
        }

    $count = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'chatbox_msg') or error('Unable to fetch chatbox post count', __FILE__, __LINE__, $db->error());
    $num_post = $db->result($count);

    $limit = ($num_post-$pun_config['cb_max_msg'] <= 0) ? 0 : $num_post-$pun_config['cb_max_msg'];


    $result = $db->query('SELECT id,posted FROM '.$db->prefix.'chatbox_msg ORDER BY posted ASC LIMIT '.$limit) or error('Unable to select post to delete', __FILE__, __LINE__, $db->error());
    while ($del_msg = $db->fetch_assoc($result))
    {
      $db->query('DELETE FROM '.$db->prefix.'chatbox_msg WHERE id = '.$del_msg['id'].' LIMIT 1') or error('Unable to delete post', __FILE__, __LINE__, $db->error());
    }

      $_POST['req_message'] = NULL;
  }

}

// If there are errors, we display them
if (!empty($errors))
{

?>
<div id="posterror" class="block">
    <h2><span><?php echo $lang_post['Post errors'] ?></span></h2>
    <div class="box">
        <div class="inbox">
            <p><?php echo $lang_post['Post errors info'] ?></p>
            <ul>
<?php

    while (list(, $cur_error) = each($errors))
        echo "\t\t\t\t".'<li><strong>'.$cur_error.'</strong></li>'."\n";
?>
            </ul>
        </div>
    </div>
</div>

<?php

}

?>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/chatbox.js"></script>
<div class="block">
  <h2>
    <span>
<span class="conr" ><img alt="" style="display:none;" id="loading" name="loading" src="img/loading.gif" /></span>
    
<?php echo $lang_chatbox['Chatbox'] ?></span>
  </h2>
    <div class="box">
        <div id="chatbox" class="inbox" style="overflow:auto;height:<?php echo $pun_config['cb_height'] ?>px;">
<?php

$cur_msg_txt = '';
$last_msg_time = '';
$count_id = array();

$result = $db->query('SELECT u.id, u.group_id, u.num_posts_chatbox, m.id AS m_id, m.poster_id, m.poster, m.poster_ip, m.poster_email, m.message, m.posted, g.g_id, g.g_title_chatbox, g.g_color FROM '.$db->prefix.'chatbox_msg AS m INNER JOIN '.$db->prefix.'users AS u ON u.id=m.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id ORDER BY m.posted DESC LIMIT '.$pun_config['cb_max_msg']) or error('Unable to fetch messages', __FILE__, __LINE__, $db->error());
$i = 0;
while ($cur_msg = $db->fetch_assoc($result))
  {
    $i++;
    if ($i == 1)
    {
        // Get newest timestamp
        $last_msg_time = $cur_msg['posted'];
    }
    $cur_msg_txt = $pun_config['cb_space'].$cur_msg['g_title_chatbox'].$pun_config['cb_disposition'].$cur_msg_txt;

if ($cur_msg['g_id'] != PUN_GUEST)
        $cur_msg_txt = str_replace('<pun_username>', '<a href="profile.php?id='.$cur_msg['id'].'"><span style="color: '.$cur_msg['g_color'].'">'.pun_htmlspecialchars($cur_msg['poster']).'</span></a>', $cur_msg_txt);
    else
      $cur_msg_txt = str_replace('<pun_username>', pun_htmlspecialchars($cur_msg['poster']), $cur_msg_txt);

    $cur_msg_txt = str_replace('<pun_date>', format_time($cur_msg['posted']), $cur_msg_txt);
    
        if ($cur_msg['g_id'] != PUN_GUEST)
      $cur_msg_txt = str_replace('<pun_nbpost>', $cur_msg['num_posts_chatbox'], $cur_msg_txt);
    else
    {

      if (!isset($count_id[$cur_msg['poster']]))
      {
        $like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE';
        
        $count = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'chatbox_msg WHERE poster '.$like_command.' \''.$db->escape(str_replace('*', '%', $cur_msg['poster'])).'\'') or error('Unable to fetch user chatbox post count', __FILE__, __LINE__, $db->error());
        $num_post = $db->result($count);
        $count_id[$cur_msg['poster']] = $num_post;
      }
      else
        $num_post = $count_id[$cur_msg['poster']];

      $cur_msg_txt = str_replace('<pun_nbpost>', $num_post, $cur_msg_txt);
    }

    $cur_msg_txt = str_replace('<pun_nbpost_txt>', $lang_chatbox['Posts'], $cur_msg_txt);

        if ($pun_user['g_id'] < PUN_GUEST)
      {
      $cur_msg_admin = ' [ <a href="chatbox.php?del='.$cur_msg['m_id'].'">Delete</a> | <a href="chatbox.php?get_host='.$cur_msg['m_id'].'">'.$cur_msg['poster_ip'].'</a>';
      if ($cur_msg['poster_email'])
              $cur_msg_admin .= ' | <a href="mailto:'.$cur_msg['poster_email'].'">'.$lang_common['E-mail'].'</a> ]';
          else
            $cur_msg_admin .= ' ] ';
        }
    else
      $cur_msg_admin = '';

      $cur_msg_txt = str_replace('<pun_admin>', $cur_msg_admin, $cur_msg_txt);
      $cur_msg_txt = str_replace('<pun_message>', parse_message($cur_msg['message'], 0), $cur_msg_txt);

  }
if (!$cur_msg_txt)
  echo $lang_chatbox['No Message'];
else
  echo "\t\t\t".$cur_msg_txt."\n";
?>
        </div>
    </div>

    
<?php
if ($pun_user['g_post_chatbox'] == '1')
  {
    $cur_index = 1;
  ?>
            <form id="post" method="post" name="post" action="chatbox.php">

         <input type="hidden" name="form_sent" value="1" />
         <input type="hidden" name="form_user" id="form_user" value="<?php echo (!$pun_user['is_guest']) ? pun_htmlspecialchars($pun_user['username']) : 'Guest'; ?>" />
<?php

if ($pun_user['is_guest'])
{
    $email_label = ($pun_config['p_force_guest_email'] == '1') ? '<strong>'.$lang_common['E-mail'].':</strong>' : $lang_common['E-mail'];
    $email_form_name = ($pun_config['p_force_guest_email'] == '1') ? 'req_email' : 'email';

    if($email_form_name = 'req_email')
        echo "\t".'<input type="hidden" name="email" id="email" value="" />'."\n";
    else
        echo "\t".'<input type="hidden" name="req_email" id="req_email" value="" />'."\n";

?>
          <strong><?php echo $lang_post['Guest name'] ?>:</strong><br /><input class="textbox" type="text" name="req_username" id="req_username" value="<?php if (isset($_POST['req_username'])) echo pun_htmlspecialchars($username); ?>" size="20" maxlength="25" tabindex="<?php echo $cur_index++ ?>" /> 
          <?php echo $email_label ?> <input class="textbox" type="text" name="<?php echo $email_form_name ?>" id="<?php echo $email_form_name ?>" value="<?php if (isset($_POST[$email_form_name])) echo pun_htmlspecialchars($email); ?>" size="20" maxlength="50" tabindex="<?php echo $cur_index++ ?>" /><br /> 
<?php

}
else
{
?>
          <input type="hidden" name="req_username" id="req_username" value="" /> 
          <input type="hidden" name="email" id="email" value="" /> 
          <input type="hidden" name="req_email" id="req_email" value="" />

<?php

}

?><br />
<div id="posterror2" class="block">
    <h2><span><?php echo $lang_common['Message'] ?></span></h2>
    <div class="box">
        <div style="padding: 10px 15px 10px 10px;" class="inbox">
                        <textarea name="req_message" id="req_message" class="textbox" rows="20" style="width: 100%;" tabindex="<?php echo $cur_index++ ?>"><?php echo isset($_POST['req_message']) ? pun_htmlspecialchars($message) : (isset($quote) ? $quote : ''); ?></textarea><br />
<?php /* punToolBar */
if (file_exists(PUN_ROOT.'cache/cache_puntoolbar.php')) {
    include PUN_ROOT.'cache/cache_puntoolbar.php';
} else {
    require_once PUN_ROOT.'include/cache_puntoolbar.php';
    generate_ptb_cache();
    require PUN_ROOT.'cache/cache_puntoolbar.php';
}
?>
             <br /><strong><?php echo $lang_chatbox['Message'] ?>:</strong> 
 
             <input class="button" type="submit" name="submit" value="<?php echo $lang_chatbox['Btn Send'] ?>" accesskey="s" tabindex="<?php echo $cur_index++ ?>" />
</div></div></div>
    <div style="padding: 5px;" class="box">
<script type="text/javascript" language="javascript">
    <!--
    // This button is utterly useless, unless we have javascript enabled. As such, we won't display it until then.
    document.write('<?php echo $lang_chatbox['Autoscroll'] ?>: <input type="checkbox" id="autoscroll" value="" checked  tabindex="<?php echo $cur_index++ ?>" />');

document.getElementById("post").req_message.focus();

    // -->
    </script></div>
    </form>
  <?php
  }
else
  echo $lang_chatbox['No Post Permission'];
?>
</div>

<script type="text/javascript" language="javascript">
    // Begin getting messages
    var LastMsg = '<?php echo $last_msg_time; ?>';
    $('autoscroll').value = 'true';
    get_messages();
    checker = new PeriodicalExecuter(get_messages, <?php echo $pun_config['cb_ajax_refresh']; ?>);
</script>

<?php

require PUN_ROOT.'footer.php';

so any idea to correct all the problems

THANKS Aloot for all the people who has helped and tried to help ...

any one can help

ok i chagnged my mind ... lets do it step by step ...

first step .... i want to correct things in the main page i . e www.sportstv.co.cc

here is main page problems ...

1- the title of the evey news is still lead to the old link ... i mean
http://img209.imageshack.us/img209/1608/bug1le5.jpg

i know where the problem is but dont know how to solve it ....
in index.php find this:

            <td style="border: 0px; padding: 0px 10px 7px 7px;"><span class="news-icon"><a class="news_subject" href="viewtopic.php?id=<?php echo $cur_post['id']; ?>"><?php echo $cur_post['subject']; ?></a></span></td>

so what i change in that code ...

MattF wrote:
<?php
define('PUN_ROOT', './');
require_once PUN_ROOT.'include/parser.php';
?>

that worked .. thanks alot ... but i got another problems ..

i improved the code furthur for my include/user/cb.php

look:

<?php
define('PUN_ROOT', './');
require_once PUN_ROOT.'include/parser.php';


// Load the chatbox.php and post.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/chatbox.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/post.php';

if ($pun_user['g_read_board'] == '0')
    message($lang_common['No view']);

?>

<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/chatbox.js"></script>

<div class="block">


 <h2>
    <span>
        <span class="conr" ><img style="display:none;" id="loading" name="loading" src="img/loading.gif" /></span>
    <?php echo $lang_chatbox['Chatbox'] ?> <span style="font-size:7px;vertical-align:super;"><?php if ($pun_config['o_show_version'] == '1') echo ' '.$pun_config['cb_pbb_version']; ?></span>
    </span>
  </h2>
    <div class="box">
        <div id="chatbox" class="inbox" style="overflow:auto;height:<?php echo $pun_config['cb_height'] ?>px;">
<?php

$cur_msg_txt = '';
$last_msg_time = '';
$count_id = array();

$result = $db->query('SELECT u.id, u.group_id, u.num_posts_chatbox, m.id AS m_id, m.poster_id, m.poster, m.poster_ip, m.poster_email, m.message, m.posted, g.g_id, g.g_title_chatbox FROM '.$db->prefix.'chatbox_msg AS m INNER JOIN '.$db->prefix.'users AS u ON u.id=m.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id ORDER BY m.posted DESC LIMIT '.$pun_config['cb_max_msg']) or error('Unable to fetch messages', __FILE__, __LINE__, $db->error());

$new_msg_time = false;
while ($cur_msg = $db->fetch_assoc($result)) {
    
    // Get newest timestamp
    if ($new_msg_time == false) {
        $last_msg_time = $cur_msg['posted'];
        $new_msg_time = true;
    }
    $cur_msg_txt = $pun_config['cb_space'].$cur_msg['g_title_chatbox'].$pun_config['cb_disposition'].$cur_msg_txt;
    
if ($cur_msg['g_id'] != PUN_GUEST)
        $cur_msg_txt = str_replace('<pun_username>', '<a href="profile.php?id='.$cur_msg['id'].'"><span style="color: '.$cur_msg['g_color'].'">'.pun_htmlspecialchars($cur_msg['poster']).'</span></a>', $cur_msg_txt);
    else
      $cur_msg_txt = str_replace('<pun_username>', pun_htmlspecialchars($cur_msg['poster']), $cur_msg_txt);

    $cur_msg_txt = str_replace('<pun_date>', format_time($cur_msg['posted']), $cur_msg_txt);
    
        if ($cur_msg['g_id'] != PUN_GUEST)
      $cur_msg_txt = str_replace('<pun_nbpost>', $cur_msg['num_posts_chatbox'], $cur_msg_txt);
    else
    {

      if (!isset($count_id[$cur_msg['poster']]))
      {
        $like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE';
        
        $count = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'chatbox_msg WHERE poster '.$like_command.' \''.$db->escape(str_replace('*', '%', $cur_msg['poster'])).'\'') or error('Unable to fetch user chatbox post count', __FILE__, __LINE__, $db->error());
        $num_post = $db->result($count);
        $count_id[$cur_msg['poster']] = $num_post;
      }
      else
        $num_post = $count_id[$cur_msg['poster']];

      $cur_msg_txt = str_replace('<pun_nbpost>', $num_post, $cur_msg_txt);
    }

    $cur_msg_txt = str_replace('<pun_nbpost_txt>', $lang_chatbox['Posts'], $cur_msg_txt);

        if ($pun_user['g_id'] < PUN_GUEST)
      {
      $cur_msg_admin = ' [ <a href="chatbox.php?del='.$cur_msg['m_id'].'">Delete</a> | <a href="chatbox.php?get_host='.$cur_msg['m_id'].'">'.$cur_msg['poster_ip'].'</a>';
      if ($cur_msg['poster_email'])
              $cur_msg_admin .= ' | <a href="mailto:'.$cur_msg['poster_email'].'">'.$lang_common['E-mail'].'</a> ]';
          else
            $cur_msg_admin .= ' ] ';
        }
    else
      $cur_msg_admin = '';

      $cur_msg_txt = str_replace('<pun_admin>', $cur_msg_admin, $cur_msg_txt);
      $cur_msg_txt = str_replace('<pun_message>', parse_message($cur_msg['message'], 0), $cur_msg_txt);

  }


if (!$cur_msg_txt)
    echo $lang_chatbox['No Message'];
else
    echo "\t\t\t".$cur_msg_txt."\n";
?>


        </div>
    </div>








  <h2>
    <span>
    <script language="javascript">
    <!--
    // This checkbox is utterly useless, unless we have javascript enabled. As such, we won't display it until then.
    document.write('<span class="conr" style="width:150px;" ><?php echo $lang_chatbox['Autoscroll'] ?>: <input type="checkbox" id="autoscroll" value="" checked  tabindex="<?php echo $cur_index++ ?>" /></span>');

    // -->
    </script>
<?php
if ($pun_user['g_post_chatbox'] == '1') {
    $cur_index = 1;
?>
      <form id="post" method="post" name="formulaire" action="chatbox.php" onsubmit="send_message(); return false;">
         <input type="hidden" name="form_sent" value="1" />
         <input type="hidden" name="form_user" id="form_user" value="<?php echo (!$pun_user['is_guest']) ? pun_htmlspecialchars($pun_user['username']) : 'Guest'; ?>" />
<?php
    if ($pun_user['is_guest']) {
        $email_label = ($pun_config['p_force_guest_email'] == '1') ? '<strong>'.$lang_common['E-mail'].':</strong>' : $lang_common['E-mail'];
        $email_form_name = ($pun_config['p_force_guest_email'] == '1') ? 'req_email' : 'email';
        
        if($email_form_name = 'req_email')
            echo "\t".'<input type="hidden" name="email" id="email" value="" />'."\n";
        else
            echo "\t".'<input type="hidden" name="req_email" id="req_email" value="" />'."\n";
?>
          <strong><?php echo $lang_post['Guest name'] ?>:</strong> <input type="text" name="req_username" id="req_username" value="<?php if (isset($_POST['req_username'])) echo pun_htmlspecialchars($username); ?>" size="15" maxlength="25" tabindex="<?php echo $cur_index++ ?>" /> 
          <?php echo $email_label ?> <input type="text" name="<?php echo $email_form_name ?>" id="<?php echo $email_form_name ?>" value="<?php if (isset($_POST[$email_form_name])) echo pun_htmlspecialchars($email); ?>" size="15" maxlength="50" tabindex="<?php echo $cur_index++ ?>" /> 
<?php
    }
    else {
?>
          <input type="hidden" name="req_username" id="req_username" value="" /> 
          <input type="hidden" name="email" id="email" value="" /> 
          <input type="hidden" name="req_email" id="req_email" value="" /> 
<?php
    }
?>
         <strong><?php echo $lang_chatbox['Message'] ?>:</strong> <input type="text" name="req_message"  id="req_message" value="<?php if (isset($_POST['req_message'])) echo pun_htmlspecialchars($message); ?>" size="35" maxlength="<?php echo $pun_config['cb_msg_maxlength'] ?>"  tabindex="<?php echo $cur_index++ ?>" /> 
         <input type="submit" name="submit" value="Submit" accesskey="s" tabindex="<?php echo $cur_index++ ?>" />
    <script language="javascript">
    <!--
    document.formulaire.req_message.focus();
    // -->
    </script>
    </form>
<?php
}
else
    echo $lang_chatbox['No Post Permission'];
?>
    </span>
  </h2>
</div>
<script language="javascript">
    // Begin getting messages
    var LastMsg = '<?php echo $last_msg_time; ?>';
    $('autoscroll').value = 'true';
    get_messages();
    checker = new PeriodicalExecuter(get_messages, <?php echo $pun_config['cb_ajax_refresh']; ?>);
</script>

look at this chat www.sportstv.co.cc/chatbox.php
and look at the index page chat ... www.sportstv.co.cc

1- the style is all curropted ... for guests ...
2- guest cant post after the sitting for guest are on ... it shows this error:

Error] - Today 00:35:20
Usernames must be at least 2 characters long. Please choose another (longer) username.

3- the user groups are all not colourfull but they are colourfull in the chatbox.php page

--------------------------------------------------------------------------------

here is my chatbox.php code:

<?php
/***********************************************************************

  Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)

  This file is part of PunBB.

  PunBB is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published
  by the Free Software Foundation; either version 2 of the License,
  or (at your option) any later version.

  PunBB is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  MA  02111-1307  USA

************************************************************************/

define('PUN_ALT4',1);
if (!defined('PUN_ROOT')) define('PUN_ROOT','./');


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

$lang_common['lang_encoding'] = 'utf-8';
header('Content-type: text/html; charset=utf-8');

if (!$pun_config['cb_pbb_version'])
    message('Poki BB Chatbox is not installed correctly. Please make sure you have launch install_mod.php');

if ($pun_user['g_read_board'] == '0')
    message($lang_common['No view']);

// Load the chatbox.php and post.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/chatbox.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/post.php';

// if it's ajax
if (isset($_GET['ajax']))
{

    // 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
    
    if ($_GET['action'] == 'add')
    {
        // Start with a clean slate
        $error = $pun_config['cb_space'].$pun_config['cb_ajax_errors'];
        $error = str_replace('<pun_error>', $lang_chatbox['Error Title'], $error);
        $error = str_replace('<pun_date>', format_time(time()), $error);
        
        //exit('error:chat'.str_replace('<pun_error_text>', parse_message($value, 0), $error));
    
        // Make sure form_user is correct
        if (($pun_user['is_guest'] && $_GET['form_user'] != 'Guest') || (!$pun_user['is_guest'] && $_GET['form_user'] != $pun_user['username']))
            exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_common['Bad request'], 0), $error));
        
        // Do we have permission to post?
        if ($pun_user['g_post_chatbox'] != '1')
            exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_chatbox['No Post Permission'], 0), $error));

        // Flood protection
        if (!$pun_user['is_guest'] && $pun_user['last_post_chatbox'] != '' && (time() - $pun_user['last_post_chatbox']) < $pun_user['g_post_flood_chatbox'])
            exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_post['Flood start'].' '.$pun_user['g_post_flood_chatbox'].' '.$lang_post['flood end'], 0), $error));
    
        if ($pun_user['is_guest'])
        {
$result = $db->query('SELECT u.id, u.group_id, u.num_posts_chatbox, m.id AS m_id, m.poster_id, m.poster, m.poster_ip, m.poster_email, m.message, m.posted, g.g_id, g.g_title_chatbox, g.g_color FROM '.$db->prefix.'chatbox_msg AS m INNER JOIN '.$db->prefix.'users AS u ON u.id=m.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id ORDER BY m.posted DESC LIMIT '.$pun_config['cb_max_msg']) or error('Unable to fetch messages', __FILE__, __LINE__, $db->error());
            $cur_post = $db->fetch_assoc($result);
            
            if ((time() - $cur_post['posted']) < $pun_user['g_post_flood_chatbox'])
                exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_post['Flood start'].' '.$pun_user['g_post_flood_chatbox'].' '.$lang_post['flood end'], 0), $error));
        }
        
        // If the user is logged in we get the username and e-mail from $pun_user
        if (!$pun_user['is_guest'])
        {
            $username = $pun_user['username'];
            $email = $pun_user['email'];
        }
        // Otherwise it should be in $_GET
        else
        {
            $username = trim($_GET['req_username']);
            $email = strtolower(trim(($pun_config['p_force_guest_email'] == '1') ? $_GET['req_email'] : $_GET['email']));
    
            // Load the register.php/profile.php language files
            require PUN_ROOT.'lang/'.$pun_user['language'].'/prof_reg.php';
            require PUN_ROOT.'lang/'.$pun_user['language'].'/register.php';
    
            // It's a guest, so we have to validate the username
            if (strlen($username) < 2)
                exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_prof_reg['Username too short'], 0), $error));
            else if (!strcasecmp($username, 'Guest') || !strcasecmp($username, $lang_common['Guest']))
                exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_prof_reg['Username guest'], 0), $error));
            else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $username))
                exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_prof_reg['Username IP'], 0), $error));
    
            if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false)
                exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_prof_reg['Username reserved chars'], 0), $error));
            if (preg_match('#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[quote=|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i', $username))
                exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_prof_reg['Username BBCode'], 0), $error));
    
            // Check username for any censored words
            $temp = censor_words($username);
            if ($temp != $username)
                exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_register['Username censor'], 0), $error));
    
            // Check that the username (or a too similar username) is not already registered
            $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE username=\''.$db->escape($username).'\' OR username=\''.$db->escape(preg_replace('/[^\w]/', '', $username)).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
            if ($db->num_rows($result))
            {
                $busy = $db->result($result);
                exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_register['Username dupe 1'].' '.pun_htmlspecialchars($busy).'. '.$lang_register['Username dupe 2'], 0), $error));
            }
    
            if ($pun_config['p_force_guest_email'] == '1' || $email != '')
            {
                require PUN_ROOT.'include/email.php';
                if (!is_valid_email($email))
                    exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_common['Invalid e-mail'], 0), $error));
            }            
            
        }
    
        // Clean up message from POST
        $message = str_replace('-|-', '+', pun_linebreaks(pun_trim($_GET['req_message'])));
        
        if ($message == '')
            exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_chatbox['Error No message'], 0), $error));
        else if (strlen($message) > $pun_config['cb_msg_maxlength'])
            exit('error:chat'.str_replace('<pun_error_text>', parse_message($lang_chatbox['Error Too long message'], 0), $error));
        else if ($pun_config['p_message_all_caps'] == '0' && strtoupper($message) == $message && $pun_user['g_id'] > PUN_MOD)
            $message = ucwords(strtolower($message));
    
        $errors = '';
        // Validate BBCode syntax
        if ($pun_config['p_message_bbcode'] == '1' && strpos($message, '[') !== false && strpos($message, ']') !== false)
            $message = preparse_bbcode($message, $errors);
            
        if ($errors != '')
        exit('error:chat'.str_replace('<pun_error_text>', parse_message($errors[0], 0), $error));


        $now = time();

        if (!$pun_user['is_guest'])
        {
            // Insert message
            $db->query('INSERT INTO '.$db->prefix.'chatbox_msg (poster, poster_id, poster_ip, message, posted) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', \''.$db->escape($message).'\', '.$now.')') or error('Unable to post message', __FILE__, __LINE__, $db->error());

            // Increment his/her chatbox post count
              $low_prio = ($db_type == 'mysql') ? 'LOW_PRIORITY ' : '';
              $db->query('UPDATE '.$low_prio.$db->prefix.'users SET num_posts_chatbox=num_posts_chatbox+1, last_post_chatbox='.$now.' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());

        }
        else
        {
            // Insert message
            $email_sql = ($pun_config['p_force_guest_email'] == '1' || $email != '') ? '\''.$email.'\'' : 'NULL';
            $db->query('INSERT INTO '.$db->prefix.'chatbox_msg (poster, poster_id, poster_ip, poster_email, message, posted) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', '.$email_sql.', \''.$db->escape($message).'\', '.$now.')') or error('Unable to post message', __FILE__, __LINE__, $db->error());
        }

        $count = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'chatbox_msg') or error('Unable to fetch chatbox post count', __FILE__, __LINE__, $db->error());
        $num_post = $db->result($count);
        
        $limit = ($num_post-$pun_config['cb_max_msg'] <= 0) ? 0 : $num_post-$pun_config['cb_max_msg'];
        
        
        $result = $db->query('SELECT id,posted FROM '.$db->prefix.'chatbox_msg ORDER BY posted ASC LIMIT '.$limit) or error('Unable to select post to delete', __FILE__, __LINE__, $db->error());
        while ($del_msg = $db->fetch_assoc($result))
        {
        $db->query('DELETE FROM '.$db->prefix.'chatbox_msg WHERE id = '.$del_msg['id'].' LIMIT 1') or error('Unable to delete post', __FILE__, __LINE__, $db->error());
        }
        
        $_GET['req_message'] = NULL;
    }

        $cur_msg_txt = '';
        $response = '';
        $count_id = array();

        $last_msg_time = intval($_GET['last_msg']);
        //$messages = $db->query('SELECT u.id, u.group_id, u.num_posts_chatbox, m.id AS m_id, m.poster_id, m.poster, m.poster_ip, m.poster_email, m.message, m.posted, g.g_id, g.g_title_chatbox FROM '.$db->prefix.'chatbox_msg AS m INNER JOIN '.$db->prefix.'users AS u ON u.id=m.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE m.posted > '.$last_msg_time.' ORDER BY m.posted DESC LIMIT '.$pun_config['cb_max_msg']) or error('Unable to fetch messages', __FILE__, __LINE__, $db->error());
        $messages = $db->query('SELECT u.id, u.group_id, u.num_posts_chatbox, m.id AS m_id, m.poster_id, m.poster, m.poster_ip, m.poster_email, m.message, m.posted, g.g_id, g.g_title_chatbox FROM '.$db->prefix.'chatbox_msg AS m INNER JOIN '.$db->prefix.'users AS u ON u.id=m.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id WHERE m.posted > '.$last_msg_time.' ORDER BY m.posted DESC LIMIT 0,50') or error('Unable to fetch messages', __FILE__, __LINE__, $db->error());

        $i = 0;
        while ($cur_msg = $db->fetch_assoc($messages))
        {    
        $i++;
        if ($i == 1)
        {
            // Get newest timestamp
            $response = $cur_msg['posted'];
        }
        $cur_msg_txt .= $pun_config['cb_space'].$cur_msg['g_title_chatbox'].$pun_config['cb_disposition'];
        
if ($cur_msg['g_id'] != PUN_GUEST)
        $cur_msg_txt = str_replace('<pun_username>', '<a href="profile.php?id='.$cur_msg['id'].'"><span style="color: '.$cur_msg['g_color'].'">'.pun_htmlspecialchars($cur_msg['poster']).'</span></a>', $cur_msg_txt);
    else
        $cur_msg_txt = str_replace('<pun_username>', pun_htmlspecialchars($cur_msg['poster']), $cur_msg_txt);
        
        $cur_msg_txt = str_replace('<pun_date>', format_time($cur_msg['posted']), $cur_msg_txt);
                
            if ($cur_msg['g_id'] != PUN_GUEST)
        $cur_msg_txt = str_replace('<pun_nbpost>', $cur_msg['num_posts_chatbox'], $cur_msg_txt);
        else
        {
        
        if (!isset($count_id[$cur_msg['poster']]))
        {
        $like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE';
        
        $count = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'chatbox_msg WHERE poster '.$like_command.' \''.$db->escape(str_replace('*', '%', $cur_msg['poster'])).'\'') or error('Unable to fetch user chatbox post count', __FILE__, __LINE__, $db->error());
        $num_post = $db->result($count);
        $count_id[$cur_msg['poster']] = $num_post;
        }
        else
        $num_post = $count_id[$cur_msg['poster']];
        
        $cur_msg_txt = str_replace('<pun_nbpost>', $num_post, $cur_msg_txt);
        }
        
        $cur_msg_txt = str_replace('<pun_nbpost_txt>', $lang_chatbox['Posts'], $cur_msg_txt);
        
            if ($pun_user['g_id'] < PUN_GUEST)
          {
        $cur_msg_admin = ' [ <a href="chatbox.php?del='.$cur_msg['m_id'].'">Delete</a> | <a href="chatbox.php?get_host='.$cur_msg['m_id'].'">'.$cur_msg['poster_ip'].'</a>';
        if ($cur_msg['poster_email'])
                $cur_msg_admin .= ' | <a href="mailto:'.$cur_msg['poster_email'].'">'.$lang_common['E-mail'].'</a> ]';
            else
              $cur_msg_admin .= ' ] ';
            }
        else
        $cur_msg_admin = '';
        
        $cur_msg_txt = str_replace('<pun_admin>', $cur_msg_admin, $cur_msg_txt);
        $cur_msg_txt = str_replace('<pun_message>', parse_message($cur_msg['message'], 0), $cur_msg_txt);
        
        $response .= $cur_msg_txt . "\n";
    }
    if (!$response)
        $response = $last_msg_time;
    
    $response = pun_trim($response);
    
    exit($response);

}

// This particular function doesn't require forum-based moderator access. It can be used
// by all moderators and admins.

if (isset($_GET['del']))
{
    if ($pun_user['g_id'] > PUN_MOD)
        message($lang_common['No permission']);

        $id = intval($_GET['del']);
        if ($id < 1)
            message($lang_common['Bad request']);


$result = $db->query('Delete From '.$db->prefix.'chatbox_msg WHERE id='.$id.'') or error('Unable to fetch post IP address', __FILE__, __LINE__, $db->error()); 
}


if (isset($_GET['get_host']))
{
    if ($pun_user['g_id'] > PUN_MOD)
        message($lang_common['No permission']);

    // Is get_host an IP address or a post ID?
    if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $_GET['get_host']))
        $ip = $_GET['get_host'];
    else
    {
        $get_host = intval($_GET['get_host']);
        if ($get_host < 1)
            message($lang_common['Bad request']);

        $result = $db->query('SELECT poster_ip FROM '.$db->prefix.'chatbox_msg WHERE id='.$get_host) or error('Unable to fetch post IP address', __FILE__, __LINE__, $db->error());
        if (!$db->num_rows($result))
            message($lang_common['Bad request']);

        $ip = $db->result($result);
    }

    message('The IP address is: '.$ip.'<br />The host name is: '.@gethostbyaddr($ip).'<br /><br /><a href="admin_users.php?show_users='.$ip.'">Show more users for this IP</a>');
}

$page_title = pun_htmlspecialchars($lang_chatbox['Page_title']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';

if ($pun_user['g_read_chatbox'] != '1')
  message($lang_chatbox['No Read Permission']);

// Did someone just hit "Submit"?
if (isset($_POST['form_sent']))
{

    // Make sure form_user is correct
    if (($pun_user['is_guest'] && $_POST['form_user'] != 'Guest') || (!$pun_user['is_guest'] && $_POST['form_user'] != $pun_user['username']))
        message($lang_common['Bad request']);

  // Do we have permission to post?
  if ($pun_user['g_post_chatbox'] != '1')
    message($lang_chatbox['No Post Permission']);

  // Start with a clean slate
  $errors = array();

    // Flood protection
    if (!$pun_user['is_guest'] && $pun_user['last_post_chatbox'] != '' && (time() - $pun_user['last_post_chatbox']) < $pun_user['g_post_flood_chatbox'])
        $errors[] = $lang_post['Flood start'].' '.$pun_user['g_post_flood_chatbox'].' '.$lang_post['flood end'];

  if ($pun_user['is_guest'])
  {
    $result = $db->query('SELECT id, poster_ip, posted FROM '.$db->prefix.'chatbox_msg WHERE poster_ip=\''.get_remote_address().'\' ORDER BY posted DESC LIMIT 1') or error('Unable to fetch messages for flood protection', __FILE__, __LINE__, $db->error());
    $cur_post = $db->fetch_assoc($result);

    if ((time() - $cur_post['posted']) < $pun_user['g_post_flood_chatbox'])
          $errors[] = $lang_post['Flood start'].' '.$pun_user['g_post_flood_chatbox'].' '.$lang_post['flood end'];
  }

  // If the user is logged in we get the username and e-mail from $pun_user
    if (!$pun_user['is_guest'])
    {
        $username = $pun_user['username'];
        $email = $pun_user['email'];
    }

    // Otherwise it should be in $_POST
    else
    {
        $username = trim($_POST['req_username']);
        $email = strtolower(trim(($pun_config['p_force_guest_email'] == '1') ? $_POST['req_email'] : $_POST['email']));

        // Load the register.php/profile.php language files
        require PUN_ROOT.'lang/'.$pun_user['language'].'/prof_reg.php';
        require PUN_ROOT.'lang/'.$pun_user['language'].'/register.php';

        // It's a guest, so we have to validate the username
        if (strlen($username) < 2)
            $errors[] = $lang_prof_reg['Username too short'];
        else if (!strcasecmp($username, 'Guest') || !strcasecmp($username, $lang_common['Guest']))
            $errors[] = $lang_prof_reg['Username guest'];
        else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $username))
            $errors[] = $lang_prof_reg['Username IP'];

        if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false)
            $errors[] = $lang_prof_reg['Username reserved chars'];
        if (preg_match('#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[quote=|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]#i', $username))
            $errors[] = $lang_prof_reg['Username BBCode'];

        // Check username for any censored words
        $temp = censor_words($username);
        if ($temp != $username)
            $errors[] = $lang_register['Username censor'];

        // Check that the username (or a too similar username) is not already registered
        $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE username=\''.$db->escape($username).'\' OR username=\''.$db->escape(preg_replace('/[^\w]/', '', $username)).'\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
        if ($db->num_rows($result))
        {
            $busy = $db->result($result);
            $errors[] = $lang_register['Username dupe 1'].' '.pun_htmlspecialchars($busy).'. '.$lang_register['Username dupe 2'];
        }

        if ($pun_config['p_force_guest_email'] == '1' || $email != '')
        {
            require PUN_ROOT.'include/email.php';
            if (!is_valid_email($email))
                $errors[] = $lang_common['Invalid e-mail'];
        }
    }

    // Clean up message from POST
    $message = pun_linebreaks(pun_trim($_POST['req_message']));

    if ($message == '')
        $errors[] = $lang_chatbox['Error No message'];
    else if (strlen($message) > $pun_config['cb_msg_maxlength'])
        $errors[] = $lang_chatbox['Error Too long message'];
    else if ($pun_config['p_message_all_caps'] == '0' && strtoupper($message) == $message && $pun_user['g_id'] > PUN_MOD)
        $message = ucwords(strtolower($message));

    // Validate BBCode syntax
    if ($pun_config['p_message_bbcode'] == '1' && strpos($message, '[') !== false && strpos($message, ']') !== false)
    {
        $message = preparse_bbcode($message, $errors);
    }

    // Did everything go according to plan?
    if (empty($errors))
    {
    $now = time();

        if (!$pun_user['is_guest'])
        {
            // Insert message
            $db->query('INSERT INTO '.$db->prefix.'chatbox_msg (poster, poster_id, poster_ip, message, posted) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', \''.$db->escape($message).'\', '.$now.')') or error('Unable to post message', __FILE__, __LINE__, $db->error());

          // Increment his/her chatbox post count
              $low_prio = ($db_type == 'mysql') ? 'LOW_PRIORITY ' : '';
              $db->query('UPDATE '.$low_prio.$db->prefix.'users SET num_posts_chatbox=num_posts_chatbox+1, last_post_chatbox='.$now.' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());

        }
        else
        {
            // Insert message
            $email_sql = ($pun_config['p_force_guest_email'] == '1' || $email != '') ? '\''.$email.'\'' : 'NULL';
            $db->query('INSERT INTO '.$db->prefix.'chatbox_msg (poster, poster_id, poster_ip, poster_email, message, posted) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', '.$email_sql.', \''.$db->escape($message).'\', '.$now.')') or error('Unable to post message', __FILE__, __LINE__, $db->error());
        }

    $count = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'chatbox_msg') or error('Unable to fetch chatbox post count', __FILE__, __LINE__, $db->error());
    $num_post = $db->result($count);

    $limit = ($num_post-$pun_config['cb_max_msg'] <= 0) ? 0 : $num_post-$pun_config['cb_max_msg'];


    $result = $db->query('SELECT id,posted FROM '.$db->prefix.'chatbox_msg ORDER BY posted ASC LIMIT '.$limit) or error('Unable to select post to delete', __FILE__, __LINE__, $db->error());
    while ($del_msg = $db->fetch_assoc($result))
    {
      $db->query('DELETE FROM '.$db->prefix.'chatbox_msg WHERE id = '.$del_msg['id'].' LIMIT 1') or error('Unable to delete post', __FILE__, __LINE__, $db->error());
    }

      $_POST['req_message'] = NULL;
  }

}

// If there are errors, we display them
if (!empty($errors))
{

?>
<div id="posterror" class="block">
    <h2><span><?php echo $lang_post['Post errors'] ?></span></h2>
    <div class="box">
        <div class="inbox">
            <p><?php echo $lang_post['Post errors info'] ?></p>
            <ul>
<?php

    while (list(, $cur_error) = each($errors))
        echo "\t\t\t\t".'<li><strong>'.$cur_error.'</strong></li>'."\n";
?>
            </ul>
        </div>
    </div>
</div>

<?php

}

?>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/chatbox.js"></script>
<div class="block">
  <h2>
    <span>
<span class="conr" ><img alt="" style="display:none;" id="loading" name="loading" src="img/loading.gif" /></span>
    
<?php echo $lang_chatbox['Chatbox'] ?></span>
  </h2>
    <div class="box">
        <div id="chatbox" class="inbox" style="overflow:auto;height:<?php echo $pun_config['cb_height'] ?>px;">
<?php

$cur_msg_txt = '';
$last_msg_time = '';
$count_id = array();

$result = $db->query('SELECT u.id, u.group_id, u.num_posts_chatbox, m.id AS m_id, m.poster_id, m.poster, m.poster_ip, m.poster_email, m.message, m.posted, g.g_id, g.g_title_chatbox, g.g_color FROM '.$db->prefix.'chatbox_msg AS m INNER JOIN '.$db->prefix.'users AS u ON u.id=m.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id ORDER BY m.posted DESC LIMIT '.$pun_config['cb_max_msg']) or error('Unable to fetch messages', __FILE__, __LINE__, $db->error());
$i = 0;
while ($cur_msg = $db->fetch_assoc($result))
  {
    $i++;
    if ($i == 1)
    {
        // Get newest timestamp
        $last_msg_time = $cur_msg['posted'];
    }
    $cur_msg_txt = $pun_config['cb_space'].$cur_msg['g_title_chatbox'].$pun_config['cb_disposition'].$cur_msg_txt;

if ($cur_msg['g_id'] != PUN_GUEST)
        $cur_msg_txt = str_replace('<pun_username>', '<a href="profile.php?id='.$cur_msg['id'].'"><span style="color: '.$cur_msg['g_color'].'">'.pun_htmlspecialchars($cur_msg['poster']).'</span></a>', $cur_msg_txt);
    else
      $cur_msg_txt = str_replace('<pun_username>', pun_htmlspecialchars($cur_msg['poster']), $cur_msg_txt);

    $cur_msg_txt = str_replace('<pun_date>', format_time($cur_msg['posted']), $cur_msg_txt);
    
        if ($cur_msg['g_id'] != PUN_GUEST)
      $cur_msg_txt = str_replace('<pun_nbpost>', $cur_msg['num_posts_chatbox'], $cur_msg_txt);
    else
    {

      if (!isset($count_id[$cur_msg['poster']]))
      {
        $like_command = ($db_type == 'pgsql') ? 'ILIKE' : 'LIKE';
        
        $count = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'chatbox_msg WHERE poster '.$like_command.' \''.$db->escape(str_replace('*', '%', $cur_msg['poster'])).'\'') or error('Unable to fetch user chatbox post count', __FILE__, __LINE__, $db->error());
        $num_post = $db->result($count);
        $count_id[$cur_msg['poster']] = $num_post;
      }
      else
        $num_post = $count_id[$cur_msg['poster']];

      $cur_msg_txt = str_replace('<pun_nbpost>', $num_post, $cur_msg_txt);
    }

    $cur_msg_txt = str_replace('<pun_nbpost_txt>', $lang_chatbox['Posts'], $cur_msg_txt);

        if ($pun_user['g_id'] < PUN_GUEST)
      {
      $cur_msg_admin = ' [ <a href="chatbox.php?del='.$cur_msg['m_id'].'">Delete</a> | <a href="chatbox.php?get_host='.$cur_msg['m_id'].'">'.$cur_msg['poster_ip'].'</a>';
      if ($cur_msg['poster_email'])
              $cur_msg_admin .= ' | <a href="mailto:'.$cur_msg['poster_email'].'">'.$lang_common['E-mail'].'</a> ]';
          else
            $cur_msg_admin .= ' ] ';
        }
    else
      $cur_msg_admin = '';

      $cur_msg_txt = str_replace('<pun_admin>', $cur_msg_admin, $cur_msg_txt);
      $cur_msg_txt = str_replace('<pun_message>', parse_message($cur_msg['message'], 0), $cur_msg_txt);

  }
if (!$cur_msg_txt)
  echo $lang_chatbox['No Message'];
else
  echo "\t\t\t".$cur_msg_txt."\n";
?>
        </div>
    </div>

    
<?php
if ($pun_user['g_post_chatbox'] == '1')
  {
    $cur_index = 1;
  ?>
            <form id="post" method="post" name="post" action="chatbox.php">

         <input type="hidden" name="form_sent" value="1" />
         <input type="hidden" name="form_user" id="form_user" value="<?php echo (!$pun_user['is_guest']) ? pun_htmlspecialchars($pun_user['username']) : 'Guest'; ?>" />
<?php

if ($pun_user['is_guest'])
{
    $email_label = ($pun_config['p_force_guest_email'] == '1') ? '<strong>'.$lang_common['E-mail'].':</strong>' : $lang_common['E-mail'];
    $email_form_name = ($pun_config['p_force_guest_email'] == '1') ? 'req_email' : 'email';

    if($email_form_name = 'req_email')
        echo "\t".'<input type="hidden" name="email" id="email" value="" />'."\n";
    else
        echo "\t".'<input type="hidden" name="req_email" id="req_email" value="" />'."\n";

?>
          <strong><?php echo $lang_post['Guest name'] ?>:</strong><br /><input class="textbox" type="text" name="req_username" id="req_username" value="<?php if (isset($_POST['req_username'])) echo pun_htmlspecialchars($username); ?>" size="20" maxlength="25" tabindex="<?php echo $cur_index++ ?>" /> 
          <?php echo $email_label ?> <input class="textbox" type="text" name="<?php echo $email_form_name ?>" id="<?php echo $email_form_name ?>" value="<?php if (isset($_POST[$email_form_name])) echo pun_htmlspecialchars($email); ?>" size="20" maxlength="50" tabindex="<?php echo $cur_index++ ?>" /><br /> 
<?php

}
else
{
?>
          <input type="hidden" name="req_username" id="req_username" value="" /> 
          <input type="hidden" name="email" id="email" value="" /> 
          <input type="hidden" name="req_email" id="req_email" value="" />

<?php

}

?><br />
<div id="posterror2" class="block">
    <h2><span><?php echo $lang_common['Message'] ?></span></h2>
    <div class="box">
        <div style="padding: 10px 15px 10px 10px;" class="inbox">
                        <textarea name="req_message" id="req_message" class="textbox" rows="20" style="width: 100%;" tabindex="<?php echo $cur_index++ ?>"><?php echo isset($_POST['req_message']) ? pun_htmlspecialchars($message) : (isset($quote) ? $quote : ''); ?></textarea><br />
<?php /* punToolBar */
if (file_exists(PUN_ROOT.'cache/cache_puntoolbar.php')) {
    include PUN_ROOT.'cache/cache_puntoolbar.php';
} else {
    require_once PUN_ROOT.'include/cache_puntoolbar.php';
    generate_ptb_cache();
    require PUN_ROOT.'cache/cache_puntoolbar.php';
}
?>
             <br /><strong><?php echo $lang_chatbox['Message'] ?>:</strong> 
 
             <input class="button" type="submit" name="submit" value="<?php echo $lang_chatbox['Btn Send'] ?>" accesskey="s" tabindex="<?php echo $cur_index++ ?>" />
</div></div></div>
    <div style="padding: 5px;" class="box">
<script type="text/javascript" language="javascript">
    <!--
    // This button is utterly useless, unless we have javascript enabled. As such, we won't display it until then.
    document.write('<?php echo $lang_chatbox['Autoscroll'] ?>: <input type="checkbox" id="autoscroll" value="" checked  tabindex="<?php echo $cur_index++ ?>" />');

document.getElementById("post").req_message.focus();

    // -->
    </script></div>
    </form>
  <?php
  }
else
  echo $lang_chatbox['No Post Permission'];
?>
</div>

<script type="text/javascript" language="javascript">
    // Begin getting messages
    var LastMsg = '<?php echo $last_msg_time; ?>';
    $('autoscroll').value = 'true';
    get_messages();
    checker = new PeriodicalExecuter(get_messages, <?php echo $pun_config['cb_ajax_refresh']; ?>);
</script>

<?php

require PUN_ROOT.'footer.php';

so any idea to correct all the problems

THANKS Aloot for all the people who has helped and tried to help ...

648

(8 replies, posted in PunBB 1.3 troubleshooting)

intedinmamma wrote:

Wouldn't it be prettier if the BBcode were stripped out?

yes that will be perfered

kierownik wrote:

then change the ../ to ./ so it points to the root of the punbb installation.

now it shows this


Warning: require_once(./parser.php) [function.require-once]: failed to open stream: No such file or directory in /home/supermag/public_html/include/user/cb.php on line 3

Fatal error: require_once() [function.require]: Failed opening required './parser.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/supermag/public_html/include/user/cb.php on line 3

.... man this is not good ....

if any one need any kind of access ... i am ready ...

650

(119 replies, posted in PunBB 1.3 extensions)

daris wrote:

there is still some thing wrong with the page look the difference
http://supermag.exofire.net/page1-Free-Hosting.html
http://supermag.wsnw.net/page.php?id=4

It looks correctly with Incandescent style tongue

you are right but not that much correct ...

the html dosent count enter space

--- space ---

Like this

it counts  <p> </p> as a space

----------------------------------------------------------------------------------------------

other thing that are still to be corrected ...

and also another bug found ... when you change the page name ... the old url of the page still works ... i mean ...
i changed the example page to Free Hosting ... but look
http://supermag.exofire.net/page1-Free-Hosting.html
http://supermag.exofire.net/page1-example-page.html
same page ... when the page name is change the url of the page should be change and old url should not work

and also can you put the page title in the top of ie page title

i mean look like this
Example page - Punbb - Internet Exploar




and also can you please make this linkible to the created page:
Delete | Edit  (((HTML Encrypt)))

daris wrote:
Admin/edit page or preview page?

i dont see any preview page ... but it will be great if you linked the page like
Delete | Edit  (((Example page))) make it linkible to it page

THANKS ... YOU DONE A GREAT WORK TO PUNBB 1.3