move_reg.php 3.45 KB
<?php
header("Content-type: text/html; charset=EUC-JP");

//セッション開始
include("./include/session_start.inc");

//重複チェック
include("./include/dbcon_group.inc");
$strSQL = "select * from mst_group where db_name = '".$db_name."' or group_id = '".$group_id."' or folder_name = '".$folder_name."'";
$objRec = pg_exec($strSQL);
if(pg_numrows($objRec) > 0){
	echo "グループID、フォルダ名、DB名のどれかが既に使われています";
	exit;
}

//ユーザDB更新
$database = $db_name;
include("./include/dbcon.inc");

//メニュー再生成
if(count($menu_del) > 0){
	//まずけす
	for($i=0;$i<count($menu_del);$i++){
		$arr = split("/", $menu_del[$i]);
		$strSQL = "delete from sub_menu_tbl where main_index = ".$arr[0]." and index_no = ".$arr[1];
		$objRec = pg_exec($strSQL);
	}
	//サブメニューインデックス再生成
	for($i=1;$i<=5;$i++){
		$strSQL = "select index_no from sub_menu_tbl where main_index = ".$i." order by index_no";
		$objRec = pg_exec($strSQL);
		$MainNum[$i] = pg_numrows($objRec);
		$indexArr = array();
		if($MainNum[$i] > 0){
			for($j=0;$j<=$MainNum[$i];$j++){
				$objfetch = pg_fetch_object($objRec, $j);
				$indexArr[$j] = $objfetch->index_no;
			}
		}
		if($MainNum[$i] > 0){
			for($j=0;$j<=count($indexArr);$j++){
				$strSQL = "update sub_menu_tbl set index_no = ".($j+1)." where main_index = ".$i." and index_no = ".$indexArr[$j];
				$objRec = pg_exec($strSQL);
			}
		}
		//ついでにメインの個数変更
		$strSQL = "update main_menu_tbl set sub_menu_num = ".$MainNum[$i]." where index_no = ".$i;
		$objRec = pg_exec($strSQL);
	}
	
}

//管理テーブル
include("./include/dbcon_group.inc");
//ひっす
$strSQL = "insert into mst_group ";
$strSQL .= "(group_id, group_pass, db_name, folder_name, group_name, mode_flg, mobile_flg) ";
$strSQL .= "values('".$group_id."', '".$group_pass."', '".$db_name."', '".$folder_name."', '".$group_name."', ".$mode_flg.", ".$mobile_flg.") ";
$objRec = pg_exec($strSQL);
//まっくす
$strSQL = "insert into maxuser_tbl ";
$strSQL .= "(group_id, max_count, max_size) ";
$strSQL .= "values('".$folder_name."', ".$max_count.", ".$max_size.") ";
$objRec = pg_exec($strSQL);

$strSQLIns  = "Insert Into mst_keiyaku ";
$strSQLIns .= "(group_id,keiyaku_date,keiyaku_plan,pay_plan,keizoku_nm,pay_date)";
$strSQLIns .= " VALUES ";
$strSQLIns .= "('".$folder_name."',";
$strSQLIns .= "'".$keiyaku_date."',";
$strSQLIns .= "'".$keiyaku_plan."',";
$strSQLIns .= "'".$pay_plan."',";
$strSQLIns .= "'".$keizoku_nm."',";
$strSQLIns .= "'".$pay_date."')";
$objRecIns = pg_exec($strSQLIns);

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-JP">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="stylesheet" type="text/css" href="basefont.css">
<TITLE>E-グルPro 超管理画面</TITLE>
</HEAD>
<body>
<form name="frm" method="post" action="move_reg2.php">
■管理者社員選択
<br><br>
<select name="syain">姓名(PW)
<?php
//社員取得
include("./include/dbcon.inc");
$strSQL = "select syain_cd, password, name_kj_sei, name_kj_mei from syain_tbl where del_flg = true order by disp_rank";
$objRec = pg_exec($strSQL);
for($i=0;$i<pg_numrows($objRec);$i++){
	$objfetch = pg_fetch_object($objRec, $i);
?>
<option value="<?php echo $objfetch->syain_cd; ?>"><?php echo $objfetch->name_kj_sei.$objfetch->name_kj_mei."(".$objfetch->password.")"; ?></option>
<?php
}
?>
</select>
<br>
<br>
<input type="hidden" name="db_name" value="<?php echo $db_name; ?>">
<input type="submit" value="登録実行!!">
</form>