예제 #1
0
 public function login()
 {
     if ($this->vbulletin->options['dle_onoff'] && $this->vbulletin->options['dle_login'] && THIS_SCRIPT != 'register' && !defined('EXTERNAL_AUTH')) {
         $member_name = $this->vbulletin->GPC['vb_login_username'];
         $member_pass = $this->vbulletin->GPC['vb_login_password'];
         if (DLE_CHARSET && DLE_CHARSET != $this->vbulletin->userinfo['lang_charset']) {
             $member_name = iconv($this->vbulletin->userinfo['lang_charset'], DLE_CHARSET, $member_name);
             $member_pass = iconv($this->vbulletin->userinfo['lang_charset'], DLE_CHARSET, $member_pass);
         }
         $username_safe = $this->db->escape_string($member_name);
         $member_pass_md5 = $member_pass ? md5($member_pass) : $this->vbulletin->GPC['vb_login_md5password'];
         $this->_db_connect();
         $dleuser = $this->db->query_first("SELECT * FROM " . USERPREFIX . "_users WHERE name='{$username_safe}' AND password='******'");
         if (!$dleuser && $this->vbulletin->options['dle_login_create_account']) {
             $this->vbulletin->GPC['username'] = $this->vbulletin->GPC['vb_login_username'];
             $this->vbulletin->GPC['password'] = $this->vbulletin->GPC['vb_login_password'];
             $this->vbulletin->GPC['password_md5'] = $this->vbulletin->GPC['vb_login_password'] ? md5($this->vbulletin->GPC['vb_login_password']) : $this->vbulletin->GPC['vb_login_md5password'];
             $this->vbulletin->GPC['email'] = $this->vbulletin->userinfo['email'];
             $this->lock_connect = true;
             $this->CreateAccount();
             $this->lock_connect = false;
             $dleuser = $this->db->query_first("SELECT * FROM " . USERPREFIX . "_users WHERE name='{$username_safe}' AND password='******'");
         }
         if ($dleuser) {
             if (strpos($this->vbulletin->options['bburl'], $this->cookie_domain) === false) {
                 $this->_db_disconnect();
                 $data = base64_encode(serialize(array($dleuser['user_id'], $member_pass_md5, $this->vbulletin->session->vars['sessionhash'])));
                 $hash = md5($this->vbulletin->config['MasterServer']['password'] . $data . $this->vbulletin->config['Database']['dbname']);
                 $this->vbulletin->session->save();
                 $this->db->close();
                 $url = $this->vbulletin->options['homeurl'] . "?vbauth=" . urlencode($data) . "&hash=" . $hash;
                 header('Location:' . $url);
                 die("Вы были перенаправлены сюда <a href='{$url}'>" . $url . "</a>");
             } else {
                 if ($this->vbulletin->options['dle_hash']) {
                     $hash = md5(uniqid(time()));
                     $this->db->query_write('UPDATE ' . USERPREFIX . "_users SET hash='{$hash}' WHERE user_id=" . $dleuser['user_id']);
                     $this->setcookie('dle_hash', $hash, 365);
                 }
                 $this->setcookie("dle_user_id", $dleuser['user_id'], 365);
                 $this->setcookie("dle_password", $member_pass_md5, 365);
                 if (!session_id()) {
                     session_start();
                 }
                 $_SESSION['dle_user_id'] = $dleuser['user_id'];
                 $_SESSION['dle_password'] = $member_pass_md5;
                 $_SESSION['member_lasttime'] = $this->vbulletin->GPC['bblastvisit'];
             }
         }
         $this->_db_disconnect();
     }
 }
 /**
  * Closes the connection to both the read database server
  *
  * @return	integer
  */
 function close()
 {
     $parent = parent::close();
     return $parent and @$this->functions['close']($this->connection_slave);
 }
예제 #3
0
	/**
	* Closes the connection to both the read database server
	*
	* @return	integer
	*/
	function close()
	{
		$parent = parent::close();
		return ($parent AND @$this->functions['close']($this->connection_slave));
	}