SIM0010.php 4.31 KB
<?PHP 
//*****************************************************************************
//* プログラム名:ユーザログイン
//* プログラムID:SIM0010.php
//* 機能        :グループログインチェック+ユーザログイン画面
//*****************************************************************************
header("Content-type: text/html; charset=EUC-JP");
include("./inc/session_start.inc");
include("./inc/dbcon_group.inc");
include('./inc/smarty.conf');
include('./inc/const.inc');

if(trim($_POST["gid"]) != "" && trim($_POST["gpw"]) != ""){
	$gid = trim($_POST["gid"]);
	$gpw = trim($_POST["gpw"]);
}else{

	header("Location:".$DEFARR[1]);
	exit;
}

$strSQLGroup="SELECT * From group_inf where group_id='".$gid."' and group_pw='".$gpw."'";
$objRecGroup = pg_exec($strSQLGroup);
if($objRecGroup==false){
	echo("SQL実行に失敗しました(SELECT)");
	exit;
}
session_unregister("PHP_DB_NAME");	
session_unregister("PHP_GROUP_NAME");
session_unregister("PHP_GROUP_ID");
session_unregister("PHP_USE_FUNC");

if(pg_numrows($objRecGroup) > 0){
	$objGroup = pg_fetch_object($objRecGroup, 0);
	$PHP_DB_NAME = $objGroup->db_name;
	$PHP_GROUP_NAME = $objGroup->group_name;
	$regiDate = $objGroup->regi_date;
	$PHP_GROUP_ID = $gid;

	$PHP_USE_FUNC = $objGroup->use_func; //20100510 use_func判定

	session_register("PHP_DB_NAME");	
	session_register("PHP_GROUP_NAME");
	session_register("PHP_GROUP_ID");
	session_register("PHP_USE_FUNC");

	//クッキーセット
	setcookie("cookie_GroupID",$gid,time() + 604800);
	setcookie("cookie_GroupPW",$gpw,time() + 604800);

}else{
	if ($_POST["backurl"] == hp) { 
		header("Location:".$DEFARR[1]);
	}else{
		header("Location:./index.php?err=1");
	}
	exit;
}
//担当者情報
$strSQLTanto="SELECT * From register_info where group_id='".$gid."'";
$objRecTanto = pg_exec($strSQLTanto);
if($objRecTanto==false){
	echo("SQL実行に失敗しました(SELECT)");
	exit;
}
session_unregister("PHP_TANTO_NAME");
session_unregister("PHP_TANTO_MAIL");
session_unregister("PHP_LIMIT_FLAG");
$PHP_LIMIT_FLAG="";
if(pg_numrows($objRecTanto) > 0){
	$objTanto = pg_fetch_object($objRecTanto, 0);
	$PHP_TANTO_NAME = $objTanto->tanto_name;
	$PHP_TANTO_MAIL = $objTanto->tanto_mail;
	$PHP_REGIST_FLAG = $objTanto->regist_flg;

/*	無料化により、期限チェックを外しました
	$limitMonth = date("Y/m/d",mktime(0, 0, 0, intval(date("m",strtotime($regiDate)))+1, date("d",strtotime($regiDate)), date("Y",strtotime($regiDate))));
	$todayMonth = date("Y/m/d");
	if($todayMonth >= $limitMonth && $PHP_REGIST_FLAG != 1){
		//echo "期限オーバー";
		$PHP_LIMIT_FLAG = "NG";
	}
*/
	session_register("PHP_TANTO_NAME");	
	session_register("PHP_TANTO_MAIL");	
	session_register("PHP_LIMIT_FLAG");	
	session_register("PHP_REGIST_FLAG");	
}

//最終ログイン時間
$lastDate = date("Y/m/d H:i:s");

$strSQLGroup="UPDATE group_inf SET last_login = '". $lastDate ."' WHERE group_id='".$gid."' AND group_pw='".$gpw."'";
$objRecGroup = pg_exec($strSQLGroup);
if($objRecGroup==false){
	echo("SQL実行に失敗しました(SELECT)");
	exit;
}


//ユーザリスト
include("./inc/dbcon.inc");
$strSQL = "select * from user_inf order by disp_rank";
$objRec = pg_exec($strSQL);
if($objRec==false){
	echo("SQL実行に失敗しました(SELECT)");
	exit;
}
$userCMB = "";
for ($intCnt = 0; $intCnt < pg_numrows($objRec); $intCnt++) {
	$objUser = pg_fetch_object($objRec, $intCnt);
	$userCMB .= '<option value="'.$objUser->user_seq.'"';
	if(($objUser->user_seq == $_COOKIE["cookie_user_cd"])){
		 $userCMB .= " selected"; 
	}
	$userCMB .= '>'.$objUser->user_namekj."</option>";
}


//HTMLヘッダの書き出し
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<html>
<head>
	<meta http-equiv="content-type" content="text/html; cahrset=euc-jp">
	<meta http-equiv="content-style-type" content="text/css">
	<meta name="robots" content="noindex, nofollow">
	<title><?PHP  echo($PHP_SYSNAME); ?></title>
	<link rel="stylesheet" href="./templates/SIMlite.css" type="text/css" />
</head>
<?PHP 


//[0]システムURL、[1]HP URL、[2]マニュアルURL、[3]MTC HP URL、[4]マスタメールアドレス、
//[5]期間区分名、[6]大区分名、[7]小区分名、[8]支出名、[9]収入名、[10]消費税率(文字型)
$o_smarty->assign('DEFARR',$DEFARR);

$o_smarty->assign('PHP_SYSNAME',$PHP_SYSNAME);
$o_smarty->assign('PHP_GROUP_NAME',$PHP_GROUP_NAME);
$o_smarty->assign('userCMB',$userCMB);
$o_smarty->assign('gid',$gid);
$o_smarty->assign('gpw',$gpw);
$o_smarty->display('SIM0010.tpl');
?>