<?php
 /**
 *      [QKSHOP] (C) QIKEWEB Inc.
 *      This is NOT a freeware, use is subject to license terms
 */

class BaseModel{
	protected $db;
	function __construct(){
		global $db;
		$this->db = $db;
	}
	function checkLogin(){
		if(!isset($_SESSION['userId']) || !isset($_SESSION['loginName']) || $_SESSION['userId']=="" || $_SESSION['loginName']==""){
			$inajax = getgpc("inajax","P");
			if($inajax==1){
				exit('{"success":false,"message":"您还没有登录，请先登录网站","type":1,"data":"nologin"}');
			}else{
			header("Location:/user/login\n");
			}
		}
	}
	function checkAdmin(){
		if(!isset($_SESSION['adminId']) || !isset($_SESSION['adminName']) || $_SESSION['adminId']=="" || $_SESSION['adminName']==""){
			header("Location:/user/login\n");
		}
	}
}
?>