/** * Authenticates the user * * @param string $username * @param string $domain * @param string $password * * @access public * @return boolean */ public function Logon($username, $domain, $password) { global $db, $usertable, $userlist, $base_where, $base_from, $base_from_where, $table, $domain_id; ZLog::Write(LOGLEVEL_DEBUG, 'PhpAddr::Logon()' . $username); $_POST['user'] = $username; $_POST['pass'] = $password; $_COOKIE['uin'] = ""; $this->_user = $username; $this->_phpaddr = new PhpAddr(); $db = $this->_phpaddr->connect(); //1 $userlist['admin']['pass'] = "******"; //1 $userlist['admin']['role'] = "root"; $this->_login = AuthLoginFactory::getBestLogin(); if ($this->_login->hasRoles()) { $domain_id = $this->_login->getUser()->getDomain(); $base_where = "{$table}.domain_id = {$domain_id} "; $base_where .= "AND {$table}.deprecated is null "; $base_from_where = "{$base_from} WHERE {$base_where} "; return true; } else { return false; } }
// // header('Content-type: text/html; charset=utf-8'); mysql_query("set character set utf8;"); mysql_query("SET NAMES `utf8`"); // Bug: #139 - Strict mode problem mysql_query("SET SQL_MODE = 'STRICT_TRANS_TABLES';"); mysql_query("SET SQL_MODE = 'MYSQL40';"); include "login.inc.php"; include "version.inc.php"; // Apply the table prefix, if available $table = $table_prefix . $table; $month_lookup = $table_prefix . $month_lookup; $table_groups = $table_prefix . $table_groups; $table_grp_adr = $table_prefix . $table_grp_adr; $usertable = $table_prefix . $usertable; $login = AuthLoginFactory::getBestLogin(); if (!isset($required_roles)) { $required_roles = array(); } if (!$login->hasRoles($required_roles)) { include "include/format.inc.php"; echo "<title>" . ucfmsg("ADDRESS_BOOK") . "</title>"; include "include/login.inc.html"; die; } else { // Get domain $user = $login->getUser(); $username = $user->getName(); $domain_id = $user->getDomain(); // Check "read only" of user $read_only = $read_only || $user->hasRole("readonly");