<?

// session_include.php 에 include getenv("DOCUMENT_ROOT")."/include/dbapp_class.php"; 해주어야 함

	// $opt : add
	// $lgactionmenu : CUSTOMER, OIL, REPORT, FORECAST, CONFIG
	// $lgactionsub : EDIT, VIEW, DELETE, CREATE
	// $lguserid : User ID
	// $lgtext : All query
	// $lgno : Unique No (Customer ID, ...)
	
	function addLog ($opt, $lgactionmenu, $lgactionsub, $lguserid, $lgtext, $lgno) {

		$jdb = new JDB();
	
		if ($opt == "add") {

			$columns = array();
			$values = array();
						
			unset ($columns);
			unset ($values);
			
			if ($lguserid == "") $userid = $_SESSION['ss_ID'];
			else $userid = $lguserid;
			
			$ipaddr = $_SERVER["REMOTE_ADDR"];
			$createddate = date("YmdHis");

			$columns[] = "log_userid";
			$columns[] = "log_ip";
			$columns[] = "log_createddate";
			$columns[] = "log_no";
			$columns[] = "log_actionmenu";
			$columns[] = "log_actionsub";
			$columns[] = "log_text";

			
			$values[] = $userid;
			$values[] = $ipaddr;
			$values[] = $createddate;
			$values[] = $lgno;
			$values[] = $lgactionmenu;
			$values[] = $lgactionsub;
			$values[] = str_replace("\\", "", $lgtext);

			
			$jdb->iQuery("tbl_log", $columns, $values);
			
			return "ok";

		}
	}
?>