BBS001.php 3.07 KB
<?php 
//*****************************************************************************
//* 
//* プログラム名:掲示板
//* プログラムID:BBS001.php
//* 機能        :掲示板一覧画面
//* 作成者      :
//* 
//*****************************************************************************
header("Content-type: text/html; charset=EUC-JP");

//***************************
//* インクルードファイル
//***************************
include("include/session_start.inc");
include("include/SessionChk.inc");
include("include/STRING.inc");
include("inc/Advertisement.inc");
include('./include/smarty.conf');

include("inc/header.inc");
include("inc/input_chk.inc");

//**** メニュー ****//
include("menu_opacity.php");

include("./include/dbcon.inc");				//DB接続

include("inc/BBS001.inc");

$o_smarty = new Smarty;
$o_smarty->clear_all_assign();

$strTempPath="temp/".$PHP_FOLDER_NAME."/bbs/";

if (empty($intPage)){
	$intPage=0;
}

//掲示期限超過掲示板削除
$strSQL="select * from bbs_tbl where period is not null and period < '".date("YmdHi")."'";
$objRecSet = pg_exec($strSQL);
if($objRecSet==false){
	echo("SQL実行に失敗しました(SELECT)");
	exit;
}
if(pg_numrows($objRecSet) > 0){
	for($i=0;$i<pg_numrows($objRecSet);$i++){
		$objFtc = pg_fetch_object($objRecSet, $i);
		//添付ファイル削除
		if(trim($objFtc->filename) != ""){
			if(file_exists($strTempPath.($objFtc->filename)) == true){
				$ret = unlink($strTempPath.($objFtc->filename));
				if($ret==false){
					echo("ファイル削除に失敗しました");
					exit;
				}
			}
		}

		$Log1[$i]=$objFtc->voicedate;
		$Log2[$i]=$objFtc->voicetime;
		$Log3[$i]=$objFtc->title;
		$Log4[$i]=$objFtc->message;
		$Log5[$i]=$objFtc->period;

		//掲示板削除
		$strSQL2="delete from bbs_tbl where seq = ".($objFtc->seq);
		$objRecSet2 = pg_exec($strSQL2);
		if($objRecSet2==false){
			echo("SQL実行に失敗しました(DELETE)");
			exit;
		}
		//掲示板個人データ削除
		$strSQL2="delete from pbbs_tbl where seq = ".($objFtc->seq);
		$objRecSet2 = pg_exec($strSQL2);
		if($objRecSet2==false){
			echo("SQL実行に失敗しました(DELETE)");
			exit;
		}
	}
}

//クレーム対応Log
include("./include/dbcon_group.inc");				//DB接続
for ($intCnt = 0; $intCnt < count($Log1); $intCnt++){
		$strSQLIns = "Insert Into bbs_delete_history " .
							"(delete_date,group_name,voicedate,voicetime,title,message,period,delete_user) " .
							"values (" .
							"'".date("YmdHi")."',".
							"'$PHP_GROUP_NAME',".
							"'".$Log1[$intCnt]."',".
							"'".$Log2[$intCnt]."',".
							"'".$Log3[$intCnt]."',".
							"'".$Log4[$intCnt]."',".
							"'".$Log5[$intCnt]."',".
							"'auto')";
		$objRecSetIns = pg_exec($strSQLIns);
		if($objRecSetIns==false){
			echo("SQL実行に失敗しました(INSERT)");
			exit;
		}
}


$o_smarty->assign('PageBack',$PageBack);
$o_smarty->assign('PageNext',$PageNext);
$o_smarty->assign('intPage',$intPage);

$o_smarty->assign('PHP_TITLE_NAME',$PHP_TITLE_NAME[8]);

//無料版ダウンロードボタン制御
$o_smarty->assign('PHP_MODE_FLG',$PHP_MODE_FLG);

$o_smarty->display('BBS001.tpl');

?>