Fandom

Scratchpad

PhpBB Code Doc:Sample Page

216,200pages on
this wiki
Add New Page
Discuss this page0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

The title is incorrect due to technical limitation. PhpBB should be phpBB.

Please note that this wiki is unofficial(community effort) and have no relation with phpBB group

This is a sample page of the proposed wiki.

phpBB functions quick reference

This page will contain an exhaustive list of functions that appear in phpBB2.1/3 , and each entry consists of the usage, a short description, and simple examples. Feel free to add, correct, and edit things!


gen_rand_string

Usage : gen_rand_string($num_chars)

Description : Return a random alphanumeric(Limitation: there are no small letters) string of length $num_chars, using time as seed for the random number generator.

Example :

$suggested_password = gen_rand_string(14);
echo $suggested_password; // sample output 'EKS973NVOS0EQ1'

get_userdata

Usage : get_userdata($user)

Description : Return the row with user_id $user or username $user in table phpbb_users. Return false if failed.

Example :

$data = get_userdata(4); // $data will contain the row with user_id 4
$data = get_userdata(John); // $data will contain the row with username John

request_var

Usage : request_var($var_name, $default [, $multibyte = false])

Description : Return $var_name that is passed through GET or POST. Return $default if the requested variable does not exist or the type of $var_name(not the type of the variable's name, but type of the content of variable) conflict with that of $default(array versus non-array). Also notice the result will get converted to be the same type as $default.

Example :

Suppose the url called is test.php?id=2654001&name=Jimmy

echo request_var('id', "0"); // output '2654001'
echo request_var('password', "nothing"); // output 'nothing'

set_config

Usage : set_config($config_name, $config_value [, $is_dynamic = false])

Description : In table phpbb_config, update the row with config_name $config_name to have config_value as $config_value. It will create this row if it doesn't exist.

Example :

set_config(allow_bbcode, 1); // set the row with config_name "allow_bbcode" to have config_value as 1

set_var

Usage : set_var(&$result, $var, $type [,$multibyte = false])

Description : Set $result to be $var of type $type. If type is string, it will replace linebreaks, special characters, backslashes, and remove excess space at the start or the end.

Example :

set_var($score, 36.1, "int");
echo $score; // outputs '36'
set_var($message, '   Hello \r, world', "string");
echo $message; // output 'Hello \n, world'

unique_id

Usage : unique_id()

Description : Return a more random unique id, using time as seed.

Example : (Help needed in determining the length of output)

$id = unique_id();
echo $id; // sample output

Also on Fandom

Random wikia