Topic: Powerportal & PunBB integration
Best regards,
Sorry for my english!
I am using CMS (powerportal 1.3.b) and I want to integrate PunBB to it! But there is problem, i dont know how to make user login.. (how to integrate user login from pp1.3 to punbb)..
I can make registration but users still have to login separately...
This is class for user authorization:
class user_authorization {
function set_username($user) {
$this->username = $user;
$this->username = trim($this->username);
$this->username = str_replace(' ', '', $this->username);
}
function set_password($pass) {
$this->password = $pass;
}
function set_login_cookies($remember) {
if($remember) {
setcookie('username', $this->username, time()+60*60*24*30, '/');
setcookie('password', $this->password, time()+60*60*24*30, '/');
} else {
setcookie('username', $this->username, -1, '/');
setcookie('password', $this->password, -1, '/');
}
}
function validate() {
global $db;
if(!empty($this->username) && !empty($this->password)) {
$user_row = $db->fetch_row("SELECT * FROM users WHERE username = '$this->username' AND password = '$this->password'");
$username_db = $user_row['username'];
$password_db = $user_row['password'];
if(strcasecmp($this->username, $username_db) == 0 && strcasecmp($this->password, $password_db) == 0 && !empty($this->username) && !empty($this->password)) {
$this->user_id = $user_row['id'];
$this->logged_in = 1;
$this->username_format = $user_row['username_format'];
$row_super_admin = $db->fetch_row("SELECT * FROM groups_users WHERE name = 'Super Administrator' AND user_id = '$this->user_id'");
if(empty($row_super_admin['0'])) {
$this->super_admin = 0;
$result_admin_mods = $db->query("SELECT * FROM modules_admin ORDER BY module ASC");
while($row_admin_mods = $db->fetch_array($result_admin_mods)) {
$groups_admin = $db->fetch_row("SELECT groups FROM modules_admin WHERE id = '" . $row_admin_mods['id'] . "'");
$groups_admin = $groups_admin['0'];
$groups_admin_array = explode(':', $groups_admin);
$x = 0;
while(!empty($groups_admin_array[$x])) {
$user_groups = $db->fetch_row("SELECT * FROM users WHERE id = '$this->user_id'");
$user_groups = $user_groups['groups'];
$user_groups_array = explode(':', $user_groups);
if(in_array($groups_admin_array[$x], $user_groups_array)) {
$this->admin = 1;
}
$x++;
}
}
if(empty($this->admin)) {
$this->admin = 0;
}
} else {
$this->admin = 1;
$this->super_admin = 1;
}
return 1;
} else {
$this->super_admin = 0;
$this->logged_in = 0;
$this->user_id = '1';
$this->admin = 0;
return 0;
}
} else {
$this->super_admin = 0;
$this->logged_in = 0;
$this->user_id = '1';
$this->admin = 0;
return 0;
}
}
function validation_mode() {
global $user, $pass, $remember, $HTTP_COOKIE_VARS;
$pass = md5($pass);
if(!empty($user) && !empty($pass)) {
$this->set_username($user);
$this->set_password($pass);
if($this->validate()) {
$this->set_login_cookies($remember);
}
} else {
$this->set_username($HTTP_COOKIE_VARS['username']);
$this->set_password($HTTP_COOKIE_VARS['password']);
$this->validate();
}
}
}
$user_authorization = new user_authorization;
$user_authorization->validation_mode();
$user_id = $user_authorization->user_id;
$admin = $user_authorization->admin;
$super_admin = $user_authorization->super_admin;
$username = $user_authorization->username;
$username_format = $user_authorization->username_format;
$logged_in = $user_authorization->logged_in;
Powerportal can be found at this url : http://powerportal.sourceforge.net/file … ributions/
Can you help me please?