<?php
class userpay_parent
{
	var $user = array();
	var $view = 0;
	function userpay_parent()
	{
		$user = array(
			'uid'=>0,
			'point'=>0,
		);
		if(!isset($_COOKIE['qmecms_auth'])) $this->user = $user;
		else{
			$this->user = qbase::get_object('login')->checkSession();
			if(empty($this->user) || $this->user['uid'] == 0){
				qbase::get_object('login')->loginOut($this->user['uid']);
				$this->user = $user;
			}
		}
	}

	/*判断用户是否已经登录*/
	function hasLogin()
	{
		return $this->user['uid'] > 0;
	}

	/*更新用户的点数*/
	function changePoint($point)
	{
		if($this->view == 0) return ;
		if($point == 0) return false;
		qdb::query("update ".TABLEPRE."user_extend set point=point-{$point} where uid={$this->user['uid']} limit 1");
	}

	function checkValidity(){
		return false;
	}
}
?>