index.php 2.55 KB
<?PHP 
//*****************************************************************************
//* プログラム名:グループログイン
//* プログラムID:index.php
//* 機能        :グループログイン
//*****************************************************************************
header("Content-type: text/html; charset=EUC-JP");
include("./inc/session_start.inc");

$cookGroupID = $_COOKIE["cookie_GroupID"];
$cookGroupPW = $_COOKIE["cookie_GroupPW"];

include('./inc/smarty.conf');
include('./inc/const.inc');
include("./inc/dbcon_group.inc");

//デモログイン
$strSQLGroup="SELECT * From group_inf where group_id='demo' and group_pw='demo'";
$objRecGroup = pg_exec($strSQLGroup);
if($objRecGroup==false){
	echo("SQL実行に失敗しました(SELECT)");
	exit;
}
session_unregister("PHP_DB_NAME");	
session_unregister("PHP_GROUP_NAME");

if(pg_numrows($objRecGroup) > 0){
	$objGroup = pg_fetch_object($objRecGroup, 0);
	$PHP_DB_NAME = $objGroup->db_name;
	$PHP_GROUP_NAME = $objGroup->group_name;
	session_register("PHP_DB_NAME");	
	session_register("PHP_GROUP_NAME");

	//クッキーセット
	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;
}

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

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


//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>総合資金管理システム【はやぶさ君】</title>
	<link rel="stylesheet" href="./templates/SIMlite.css" type="text/css" />
	<script language="javascript"><!--
	function trans(){
			document.frm.action = "SIM0011.php";
			document.frm.method="POST";
			document.frm.submit();
	}
	//-->
	</script>
</head>
<?PHP 

//define
//[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('cookGroupID',$cookGroupID);
$o_smarty->assign('cookGroupPW',$cookGroupPW);
$o_smarty->display('./index.tpl');

?>