Link to home
Start Free TrialLog in
Avatar of Member_2_5230414
Member_2_5230414

asked on

how to call a class properly

How would i call the following class??

<?php
class vBulletinUser{
	public static function login($username, $remember_me = false){
		chdir(VB_ROOT_PATH);
		require_once('./global.php');
		require_once(DIR . '/includes/functions_login.php');
		global $vbulletin,$vbphrase;
		$remember_me = $remember_me ? true : false;	//force to true or false value
		$vbulletin->userinfo = $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids, 
			username, password, salt FROM ".TABLE_PREFIX."user WHERE username = '".
			$vbulletin->db->escape_string(htmlspecialchars_uni($username))."'");
			
		if ($vbulletin->userinfo){
			process_new_login($vbulletin->GPC['logintype'], $remember_me, $vbulletin->GPC['cssprefs']);
			exec_shut_down();
			return true;
		}
		return false;
	}
}

new vBulletinUser();
?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It's not PHP4 because it's 'static', and there weren't static methods back then.
You call it like this:
VBulletinUser::login('UserName', TRUE);

Open in new window

seems like there are different meanings to the word "properly"...