SIM0010.php
3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?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");
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='".$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
//デバッグ
//echo("gid:".$gid." gpw:".$gpw." useq:".$useq." upw:".$upw." <br>" );
//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('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');
?>