Global variables

Below is a list of global variables which can be found within any FluxBB script (i.e. are set when include/common.php is included). The most used and important ones are probably $db, $pun_user and $pun_config.

Configuration variables

The below variables are defined by the admin within config.php during installation. Usually they should not be needed once the database connection has been set up and the users cookie has been authenticated.


The type of database being used by FluxBB. Valid values are mysql, mysqli_innodb, mysqli, mysqli_innodb, pgsql or sqlite.


The hostname or IP address (and port if non-standard) of the database server being used.


The name of the database being used.


The username required to access the database.


The password required to access the database.


The table prefix used within the database (to allow multiple FluxBB installs within one database). This can also (and should be) accessed using $db→prefix, for more information see the Database layer page.

The name of the cookie which FluxBB uses to keep track of a users session.

Used to seed the password hash stored within the users cookie.

Core variables

The variables below are the most important global variables within FluxBB.


The $db variable is an instance of the Database layer, used for communicating with the underlying database. For more information please see the Database layer page.


The $pun_user variable is an associative array which holds information (taken from the users and groups database tables) about the current logged in user (or guest).

As well as the information from the users and groups tables it also holds a few other values:

loggedA UNIX timestamp representing the time the user logged in.
idleIf the user is idle or not (i.e. their last visit was more than o_timeout_online seconds ago, but less than o_timeout_visit seconds ago).
is_guestA boolean value, true if the current user is a guest and false if they are a logged in user.
is_admmodA boolean value, true if the current user is a moderator or administrator.
$result = $db->query('SELECT u.*, g.*, o.logged, o.idle FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON u.group_id=g.g_id LEFT JOIN '.$db->prefix.'online AS o ON WHERE'.intval($cookie['user_id'])) or error('Unable to fetch user information', __FILE__, __LINE__, $db->error());
$pun_user = $db->fetch_assoc($result);
$pun_user['is_guest'] = false;
$pun_user['is_admmod'] = $pun_user['g_id'] == PUN_ADMIN || $pun_user['g_moderator'] == '1';


The $pun_config variable holds an associative array with the contents of the config database table. Please note that to save querying the database on every page load this variable is cached, simply updating the database will not cause the cache to refresh.

KeyDefault valueDescription
o_cur_version“1.4.9”*The current version of FluxBB that is installed.
o_database_revision“1”*The current revision of the database structure.
o_searchindex_revision“1”*The current revision of the search index engine. During an update if this increments all posts will be indexed again.
o_parser_revision“1”*The current revision of the parser. During an update, if this increments all posts will be preparsed again.
o_board_title“My FluxBB forum”*The title of the forum.
o_board_desc“Unfortunately no one can be told what FluxBB is - you have to see it for yourself.”*A short description of the forum, usually displayed below the board title.
o_default_timezone“0”The default time zone (offset from UTC).
o_time_format“H:i:s”The default time format string (see the PHP date function).
o_date_format“Y-m-d”The default date format string (see the PHP date function).
o_timeout_visit“1800”Number of seconds a user must be idle before his/hers last visit data is updated (primarily affects new message indicators).
o_timeout_online“300”Number of seconds a user must be idle before being removed from the online users list.
o_redirect_delay“1”How many seconds to wait when redirecting to a new page (usually a confirmation message is shown so it shouldn't be done instantly).
o_show_version“0”Show the FluxBB version number in the footer?
o_show_user_info“1”Show users information (such as location, registration date, contact link, etc…) with their posts?
o_show_post_count“1”Show users post count?
o_signatures“1”Enable the use of signatures?
o_smilies“1”Enable the use of smilies?
o_smilies_sig“1”Allow the user of smilies inside users signatures?
o_make_links“1”Automatically convert URLs in posts to links?
o_default_lang“English”The default language pack to be used.
o_default_style“Air”*The default style to be used.
o_default_user_group“4”The ID of the group which members should be in when they first register. Usually this is PUN_MEMBER.
o_topic_review“15”The number of last posts to show when writing a reply to a post.
o_disp_topics_default“30”The amount of topics that should be displayed per page by default.
o_disp_posts_default“25”The amount of posts that should be displayed per page by default.
o_indent_num_spaces“4”The amount of spaces to turn each tab into within code boxes.
o_quote_depth“3”The maximum amount of quotes that can be nested inside each other.
o_quickpost“1”Enable the use of the quickpost box?
o_users_online“1”Display a list of users currently on-line on the index page?
o_censoring“0”Enable the use of censoring?
o_show_dot“0”Show a mark next to topics in which the user has already replied?
o_topic_views“1”Enable the counting of views each topic receives?
o_quickjump“1”Enable the quickjump menu to quickly change between boards?
o_gzip“0”GZip the generated HTML?
o_additional_navlinks“”A list of links that should be added to the forum navigation.
o_report_method“0”How should reports be displayed? 0 = Internal, 1 = By email, 2 = Both internal and by email.
o_regs_report“0”Should new registrations be emailed to the mailing list (see o_mailing_list)?
o_default_email_setting“1”What should the default email setting be for newly registered users? 0 = Display email address, 1 = Hide email address but allow form emails, 2 = Hide email address and disallow form emails.
o_mailing_list“”A comma separated list of email addresses to which reports should be delivered.
o_avatars“1”Enable the use of users avatars?
o_avatars_dir“img/avatars”The (relative) path of the directory where users avatars should be stored.
o_avatars_width“60”The maximum width (in pixels) that a users avatar may be.
o_avatars_height“60”The maximum height (in pixels) that a users avatar may be.
o_avatars_size“20480”The maximum size (in bytes) that a users avatar may be.
o_search_all_forums“1”Allow users to search all forums at once?
o_base_url*The base URL of the forum (without the trailing slash)
o_admin_email“”*The email address of the forum administrator.
o_webmaster_email“”*The email address from which emails sent should be addressed.
o_topic_subscriptions“1”Allow users to subscribe to topics (receive an email when someone makes a reply)?
o_forum_subscriptions“1”Allow users to subscribe to forums (receive an email when someone makes a new topic)?
o_smtp_hostNULLThe hostname or IP address of the SMTP server you wish to use (only if you do not want to use the internal PHP mail function).
o_smtp_userNULLThe username for the SMTP server, if one is required.
o_smtp_passNULLThe password for the SMTP server, if one is required.
o_smtp_ssl“0”Does the SMTP server require SSL?
o_regs_allow“1”Allow new users to register?
o_regs_verify“0”Verify new registrations by sending a verification email to their email address?
o_announcement“0”Display an announcement? This shows the announcement message set in o_announcement_message in an announcement box on every forum page.
o_announcement_message“Enter your announcement here.”An announcement message to show on every forum page when announcements are enabled.
o_rules“0”Enable the use of forum rules?
o_rules_message“Enter your rules here.”The rules for your forum. This field may contain HTML.
o_maintenance“0”Enable maintenance mode? This prevents anyone who isn't an administrator from using the board.
o_maintenance_message“The forums are temporarily down for maintenance. Please try again in a few minutes.<br /><br />/Administrator”A message to be displayed to anyone attempting to use the board when maintenance mode is enabled.
o_default_dst“0”The default DST offset, either 1 or 0.
o_feed_type“2”The type of syndication feed to use. 0 = None, 1 = RSS, 2 = Atom.
o_feed_ttl“0”The duration (in minutes) to cache certain feed pages.
p_message_bbcode“1”Enable the use of bbcode within posts?
p_message_img_tag“1”Enable the use of image tags within posts?
p_message_all_caps“1”Allow users to post a message containing all capitals?
p_subject_all_caps“1”Allow users to post a message with the subject containing all capitals?
p_sig_all_caps“1”Allow users to have a signature made up of all capitals?
p_sig_bbcode“1”Enable the use of bbcode within signatures?
p_sig_img_tag“0”Enable the use of image tags within signatures?
p_sig_length“400”The maximum length of a users signature (in characters).
p_sig_lines“4”The maximum number of lines a users signature may contain.
p_allow_banned_email“1”Allow users to register with a banned email address? If enabled the registration will be allowed but an alert will be sent to the mailing list (see o_mailing_list).
p_allow_dupe_email“0”Allow users to register with an email address that is already being used? If enabled an alert will be sent to the mailing list (see o_mailing_list) when a duplicate is detected.
p_force_guest_email“1”Require guests to supply an email address when posting?

* These values depend on the information given during installation of FluxBB, so do not have a default as such.

// Get the forum config from the DB
$result = $db->query('SELECT * FROM '.$db->prefix.'config', true) or error('Unable to fetch forum config', __FILE__, __LINE__, $db->error());
while ($cur_config_item = $db->fetch_row($result))
	$pun_config[$cur_config_item[0]] = $cur_config_item[1];


The $pun_bans variable is an array of currently active bans which should be enforced, taken from the bans database table. Like the $pun_config variable it is also cached.

// Get the ban list from the DB
$result = $db->query('SELECT * FROM '.$db->prefix.'bans', true) or error('Unable to fetch ban list', __FILE__, __LINE__, $db->error());
while ($cur_ban = $db->fetch_assoc($result))
	$pun_bans[] = $cur_ban;

Other variables

The below variables are available globally, but are generally there for just one specific purpose.


The time the script was started (in microseconds). This is used when debug is enabled to calculate the script generation time.

$pun_start = get_microtime();


An array of various time formats that users can choose from.

$forum_time_formats = array($pun_config['o_time_format'], 'H:i:s', 'H:i', 'g:i:s a', 'g:i a');


An array of various date formats that users can choose from.

$forum_date_formats = array($pun_config['o_date_format'], 'Y-m-d', 'Y-d-m', 'd-m-Y', 'm-d-Y', 'M j Y', 'jS M Y');