<?php
/********************************************************************
 *                              DirCMS管理员操作类
 *                            ----------------------
 *   begin                : 2010/5/23
 *   copyright            : (C) 2009 DirCMS.cn
 *   email                : uuturn@126.com
 *
 *   $Id: admin.class,v 1.0.0 2010-12-12  M Exp $
 ********************************************************************/
class admin
{
	public $msg;
	public $_userid=0;
	private $db;
	private $table;
	private $table_session;

	function __construct()
	{
		global $db;
		$this->db=$db;
		$this->table=DB_PRE.'admin';
		$this->table_session=DB_PRE.'session';
	}

	function admin()  //2010-12-12 修复一处函数名错误的问题
    {
    	$this->__construct();
    }

	function get($userid=0)
	{
		if($userid)$this->_userid=intval($userid);
		$r=$this->db->fetch_one("SELECT * FROM $this->table WHERE memberid='$this->_userid'");
		return $r;
	}

	function is_multilogin($userid)
	{
		$userid=intval($userid);
		$r=$this->db->fetch_one("SELECT `ip` FROM `$this->table_session` WHERE `userid`=$userid");
		return ($r && $r['ip']!=IP);
	}

}
?>