Create Account
Sign In

Add multiply admins for forum

To create and answer topics, you must to be logged.
Pages: 1
Author Message
knoblys
03/11/2014 at 19:17:17
knoblys
Member
Hello, im using your php forum for my website, but i want more then 1 admin on the site, how do i change it? This is the following PHP code in config.php

//Username of the Administrator
$admin='knoblys';



Meru
30/12/2014 at 08:49:12
Meru
Member
Instead of using a static string, we can use an array and a function to grab use multiple administrators.

$admins = array("user1", "user2");
function is_admin($username, $array) {
foreach($array as $name) {
if($name == $username) {
return true;
}
}
return false;
}

Now, instead of using:
$_SESSION['username'] == $admin We can use:
is_admin($_SESSION['username'], $admins)

Pages: 1