<?php
/**
* Functions to deal with PHPGEN system..
*
* PHPGEN is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PHPGEN is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PHPGEN; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @copyright EasySoft R&D Team (C) 2006
* @author Chunsheng Wang <hide@address.com>
* @link http://www.phpgen.com
* @package Include
* @version $Id: FuncGEN.php,v 1.5 2006/08/17 13:52:56 wangcs Exp $
*/
/**
* Judge valid user.
*
* @author Chunsheng Wang <hide@address.com>
* @global array the config array.
* @global object the object of ADO class created in Init.php.
* @global object the object of Javascript class created in Init.php.
* @param string $UserName the user name used to login FCG system.
* @param string $Password the user password used to login FCG system.
*/
function genJudgeUser($UserName = "",$Password = "")
{
require_once("Users.php");
global $MyJS;
if(!empty($UserName) and !empty($Password))
{
$UserInfo = $_USERS[$UserName];
if(!$UserInfo or $UserInfo["Password"] != $Password)
{
$MyJS->goto($_CFG["BaseURL"] . "Member/Login.php");
exit;
}
else
{
$_SESSION["UserName"] = $UserName;
$_SESSION["IsAdmin"] = $UserInfo["IsAdmin"];
$_SESSION["UserLang"] = "ZH_CN";
return true;
}
}
if(empty($_SESSION["UserName"]))
{
$MyJS->goto($_CFG["BaseURL"] . "Member/Login.php", "top");
exit;
}
}
/**
* Return the full path of the user's home dir.
*
* @author Chunsheng Wang <hide@address.com>
* @param string $UserName the user name used to login FCG system.
* @return string $Password the full path of the user's home dir.
*/
function genGetUserHome($UserName)
{
global $_CFG;
return $_CFG["SysRoot"] . $_CFG["UserHome"] . substr($_SESSION["UserName"], 0, 1) . "/" . $_SESSION["UserName"] . "/";
}
/**
* Init the user home dir.
*
* @author Chunsheng Wang <hide@address.com>
* @param string $UserName the user name used to login FCG system.
*/
function genInitUserHome($UserName)
{
$UserHome = genGetUserHome($UserName);
!file_exists($UserHome) ? sysMkdir($UserHome) : "";
}
?>