MIL004_m.php 5.65 KB
<?php 
//*****************************************************************************
//* 
//* プログラム名:Webメール(携帯電話)
//* プログラムID:MIL004_m.php
//* 機能        :メール受信詳細画面
//* 作成者      :
//* 
//*****************************************************************************

	header("Content-type: text/html; charset=Shift_JIS");

	function mime_split($data) {
		$part = split("\r\n\r\n", $data, 2);
		$part[1] = ereg_replace("\r\n[\t ]+", " ", $part[1]);

		return $part;
	}

	/* 文字コードコンバートJIS→SJIS */
	function convert($str) {
		if (function_exists('mb_convert_encoding')) {
			return mb_convert_encoding($str, "SJIS", "JIS,SJIS");
		} elseif (function_exists('JcodeConvert')) {
		return JcodeConvert($str, 0, 2);
	}
		return true;
	}

	include("include_m/STRING.inc");

	//*** 広告 ***//
	include("include_m/Advertisement.inc");

	//*** 共通処理 ***//
	include("include_m/CommonProcess.inc");

	$mail_id=subRetURI($_GET['mail_id']);
	
function subRetURI($prmStr){

	$prmStr = str_replace("EgruProPlus", "+", $prmStr);
	$prmStr = str_replace("EgruProAnp", "&", $prmStr);
	$prmStr = str_replace("EgruProPer", "%", $prmStr);
	$prmStr = str_replace("EgruProNum", "#", $prmStr);
	$prmStr = str_replace("EgruProSing", "'", $prmStr);
	$prmStr = str_replace("EgruProDoub", '"', $prmStr);		
	$prmStr = str_replace("EgruProDoll", "$", $prmStr);		
	$prmStr = str_replace("EgruProhyph", "-", $prmStr);		
	return $prmStr;	
}

	//*** webメール***
	$strMenuSQL = "SELECT name FROM sub_menu_TBL WHERE url = 'MIL001.php'";
	$rsRecset = pg_exec($strMenuSQL);
	$PHP_TITLE_NAME=mb_convert_encoding(pg_result($rsRecset,0,"name"), "SJIS", "EUC-JP");

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<TITLE>E-グルPro(<?php  echo $PHP_TITLE_NAME; ?>)</TITLE>
</HEAD>
<BODY>
<form>
<center>
<?php  echo $PHP_TITLE_NAME; ?><br>
<?php  echo $strName; ?>
<HR width="100%">
<?php  echo $koukokuTEL; ?>
</center>
<?php 
	//メニュー表示
	include("include_m/CommonMenuReturn.inc");
?>
<br><a href="MIL003_m.php?<?php  echo $PHP_Argument ?>&intPage=<?php  echo $intPage ?>"accesskey="1"><?php  echo Get_Num("1"); ?>受信メール一覧へ</a>
<HR width="100%">
<?php 
	//*** 関数表示 ***//
	require_once "include_m/jcode.phps";
	require_once "include_m/MIL001_m.inc";
	require_once "include_m/MIL002_m.inc";

	//*** 既読フラグ更新 ***//
	$strSQLall = "Update mail_get_tbl SET kind_flg=1 ".
							 "Where syain_cd='$PHP_SYAIN_CD' and mail_id='".str_replace("'", "''", $mail_id)."'";
	$objRecall = pg_exec($strSQLall);
	if($objRecall==false){
		echo("SQL実行に失敗しました(SELECT)");
		exit;
	}

	//*** 受信メッセージ取得 ***//
	$strSQLall = "Select mail_id,get_date,header,subject,comment,mail_size,kind_flg,temp_flg from mail_get_tbl ".
							 "Where syain_cd='$PHP_SYAIN_CD' and mail_id='".str_replace("'", "''", $mail_id)."'";
	$objRecall = pg_exec($strSQLall);
	if($objRecall==false){
		echo("SQL実行に失敗しました(SELECT)");
		exit;
	}

	//曜日配列
	$youbi=array("日","月","火","水","木","金","土");

	$objData = pg_fetch_object($objRecall, 0);
echo "<input type=hidden value=".$strSQLall.">";

	//	echo "【受信日】";
	$getDate=mb_convert_encoding( $objData->get_date, "SJIS", "EUC-JP" );
	$str_year=substr($getDate,0,4);
	$str_mon=substr($getDate,4,2);
	$str_day=substr($getDate,6,2);
	$str_hour=substr($getDate,8,2);
	$str_min=substr($getDate,10,2);
	$intYoubi=date("w", mktime (0,0,0,$str_mon,$str_day,$str_year));
	$strDate=$str_year."/".$str_mon."/".$str_day."(".$youbi[$intYoubi].")".$str_hour.":".$str_min;
	echo $strDate."<br>";
	echo '<HR width="100%">';

	//ヘッダー取得
	$header_list = parse_header(mb_convert_encoding($objData->header, "SJIS", "EUC-JP" ));
	//	$header_view[] = array('subject', '件名');
	//	$header_view[] = array('from', '送信者');
	//	$header_view[] = array('to', '宛先');
	//	$header_view[] = array('cc', 'Cc');
	//	$header_view_num = count($header_view);
		$header_view[] = array('subject', '');
		$header_view[] = array('from', '');
		$header_view[] = array('to', '');
		$header_view[] = array('cc', '');
		$header_view_num = count($header_view);

	//*** 件名・送信者・宛先・CC表示 ***//
	for ($i = 0; $i < $header_view_num; ++$i) {
		if (!isset($header_list[$header_view[$i][0]])) {
			continue;
		}
		//echo "【".$header_view[$i][1]."】";
		if (($header_view[$i][0]!="to") && ($header_view[$i][0]!="cc")){
				if ($header_list[$header_view[$i][0]]==''){
					echo '(no subject)';
				}else{
					if($i==0){
						echo mb_convert_encoding($objData->subject, "SJIS", "EUC-JP");
					}else{
						echo mb_convert_encoding(link_url(htmlspecialchars(decode_mimeheader($header_list[$header_view[$i][0]], 1), ENT_QUOTES)), "SJIS", "EUC-JP");
					}
				}
				echo '<HR width="100%">';
		}
	}

	//	echo "【本文】<br>";
	echo mb_convert_encoding(str_replace("\n","<br>",link_url(strip_tags($objData->comment))), "SJIS", "EUC-JP");

	$strSQLtemp="Select * from mail_temp_tbl Where syain_cd='$PHP_SYAIN_CD' and mail_id='".str_replace("'", "''", $mail_id)."' Order by temp_index ";
	$objRectemp = pg_exec($strSQLtemp);
	if (pg_numrows($objRectemp)>0){
			echo "【添付ファイル】<br>";
	}
	for ($inttempCnt = 0; $inttempCnt < pg_numrows($objRectemp); $inttempCnt++) {
			$objTempfile = pg_fetch_object($objRectemp, $inttempCnt);
			echo mb_convert_encoding($objTempfile->temp_name, "SJIS", "EUC-JP")."<br>";
	}

?>
<a href="MIL003_m.php?<?php  echo $PHP_Argument ?>&intPage=<?php  echo $intPage ?>"accesskey="1"><?php  echo Get_Num("1"); ?>受信メール一覧へ</a>
<HR width="100%">
<?php 
	//メニュー表示
	include("include_m/CommonMenuReturn.inc");
?>

<?php 
	//*** 共通変数取得 ***//
	include("include_m/CommonHidden.inc");
?>
</form>
</BODY>
</HTML>