ディレクトリリスト


  control.php




部品として使用する事を想定しているので、フレームを用いずに画面は一つです
control.php?In1001=ディレクトリのパス で初期ディレクトリを指定できます


  

<?
# **********************************************************
# 外部ファイル
# **********************************************************
require_once( "common.php" );
require_once( "model.php" );

# **********************************************************
# 定数定義
# **********************************************************
define( 'PASS_MESSAGE', 1 );

define( 'VIEW_MESSAGE', 'viewmessage.php' );
define( 'VIEW_CUR', 'view.php' );

# **********************************************************
# グローバル変数
# **********************************************************
$ErrMessage	= '';
$OutData	= '';

# **********************************************************
# 初期処理
# **********************************************************

# **********************************************************
# 処理コントロール
# **********************************************************
CheckDataHead( );
if ( $ErrMessage != "" ) {
	$_POST['GNO'] = PASS_MESSAGE;
}
else {
	GetData( );
	if ( $ErrMessage != "" ) {
		$_POST['GNO'] = PASS_MESSAGE;
	}
}

# **********************************************************
# ビュー
# **********************************************************
switch( $_POST['GNO'] ) {
	case PASS_MESSAGE:
		require_once( VIEW_MESSAGE );
		break;

	default:
		EditDataHead( );
		require_once( VIEW_CUR );
		break;
}

# **********************************************************
# デバッグ
# **********************************************************
#DispData();
?>
  







  model.php




  

<?
# **********************************************************
# データの読出し
# **********************************************************
function GetData(  ) {

	global $ErrMessage;

	$DirHandle = @opendir($_POST["In1001"]);
	if ( $DirHandle ) {
		$Target = readdir( $DirHandle );
		while( $Target !== false ) {

			if ( $Target != "." ) {
				EditListData( $Target );
			}
			$Target = readdir( $DirHandle );

		}
		
		closedir( $DirHandle );
	}
	else {
		$ErrMessage = "ディレクトリが不正です ( {$_POST["In1001"]} )";
	}

}

# **********************************************************
# データの編集
# **********************************************************
function EditListData( $Target ) {

	global $OutData;

	$OutData .= "<TR>";
	if ( is_dir( $_POST["In1001"]. "\\" . $Target ) ) {
		if ( $Target == ".." ) {
			$Href = "{$_SERVER['SCRIPT_NAME']}?In1001=";
			$Href .= urlencode(
				substr(
					$_POST["In1001"],
					0,
					strrpos( $_POST["In1001"], "\\" )
				)
			);
			$OutData .= "<TD class=MyCell>";
			$OutData .= "<A href=\"$Href\">親ディレクトリ</A>";
			$OutData .= "</TD>";
		}
		else {
			$Href = "{$_SERVER['SCRIPT_NAME']}?In1001=";
			$Href .= urlencode( 
				$_POST["In1001"] . "\\" . $Target
			);
			$OutData .= "<TD class=MyCell>";
			$OutData .= "<A href=\"$Href\">$Target</A>";
			$OutData .= "</TD>";
		}
	}
	else {
		$OutData .= "<TD class=MyCell>$Target</TD>";
	}
	$OutData .= "</TR>";

}

# **********************************************************
# 画面の編集
# **********************************************************
function EditDataHead( ) {

}

# **********************************************************
# エラーチェック
# **********************************************************
function CheckDataHead( ) {

	global $ErrMessage;

	if ( $_POST["In1001"] == "" ) {
		$_POST["In1001"] = getcwd( );
	}

}
?>
  

  view.php

  

<SCRIPT language=JavaScript>

// *********************************************************
// フォームのチェック
// *********************************************************
function CheckData() {

	return true;
}

</SCRIPT>


<HTML>
<HEAD>
	<META http-equiv="Content-type" content="text/html; charset=Shift_JIS">
	<TITLE>PHP 雛形</TITLE>
<STYLE>
	.MyHead {
		background-color:silver
	}
	.MyCell {
		background-color:silver
	}
</STYLE>
</HEAD>
<BODY>

<FORM
	name=frmMain
	method=GET
	action=control.php
	onSubmit='return CheckData()'
>
<TABLE border=0 bgcolor=black cellspacing=1 cellpadding=5>
<TR>
<!-- *******************************************************
 タイトル
******************************************************** -->
	<TD class=MyCell>ベースディレクトリ</TD>
<!-- *******************************************************
 入力データ
******************************************************** -->
	<TD class=MyCell>
		<INPUT
			type=text
			name=In1001
			value="<?= $_POST["In1001"] ?>"
			readonly
			style='background-color:silver'
			size=100
		>
	</TD>

<!-- *******************************************************
 画面初期化ボタン
******************************************************** -->
	<TD class=MyCell>
		<INPUT 
			type=button
			value="Cancel"
			onClick='top.location="control.php"'
		>
	</TD>
</TR>
</TABLE>

<br>
<!-- *******************************************************
 画面定義
******************************************************** -->
<TABLE border=0 bgcolor=black cellspacing=1 cellpadding=5>
<TH class=MyHead>名称</TH>
<?= $OutData ?>
</TABLE>

</FORM>

</BODY>
</HTML>
  

  viewmessage.php

  

<HTML>
<HEAD>
<META http-equiv="Content-type" content="text/html; charset=Shift_JIS">
<TITLE>メッセージ表示専用</TITLE>
<STYLE>
	.MyCell {
		background-color:silver
	}
</STYLE>
</HEAD>
<BODY>
<SPAN style='color:blue'><?= $ErrMessage ?></SPAN>
<SPAN style='color:black;font-weight:bold'><?= $Message ?></SPAN>
</BODY>
</HTML>
  




yahoo  google  MSDN  MSDN(us)  WinFAQ  Win Howto  tohoho  ie_DHTML  vector  wdic  辞書  天気 


[webclass]
claudebot
24/03/29 11:02:02
InfoBoard Version 1.00 : Language=Perl

1 BatchHelper COMprog CommonSpec Cprog CprogBase CprogSAMPLE CprogSTD CprogSTD2 CprogWinsock Cygwin GameScript HTML HTMLcss InstallShield InstallShieldFunc JScript JScriptSAMPLE Jsfuncs LLINK OldProg OracleGold OracleSilver PRO PRObrowser PROc PROconePOINT PROcontrol PROftpclient PROjscript PROmailer PROperl PROperlCHAT PROphp PROphpLesson PROphpLesson2 PROphpLesson3 PROphpfunction PROphpfunctionArray PROphpfunctionMisc PROphpfunctionString PROsql PROvb PROvbFunction PROvbString PROvbdbmtn PROvbonepoint PROwebapp PROwin1POINT PROwinSYSTEM PROwinYOROZU PROwindows ProjectBoard RealPHP ScriptAPP ScriptMaster VBRealtime Vsfuncs a1root access accreq adsi ajax amazon argus asp aspSample aspVarious aspdotnet aw2kinst cappvariety centura ckeyword classStyle cmaterial cmbin cmdbapp cmenum cmlang cmlistbox cmstd cmstdseed cmtxt cs daz3d db dbCommon dbaccess dnettool dos download flex2 flex3 flex4 framemtn framereq freeWorld freesoft gimp ginpro giodownload google hdml home hta htmlDom ie9svg install java javaSwing javascript jetsql jquery jsp jspTest jspVarious lightbox listasp listmsapi listmsie listmsiis listmsnt listmspatch listmsscript listmsvb listmsvc memo ms msde mysql netbeans oraPlsql oracle oracleWiper oraclehelper orafunc other panoramio pear perl personal pgdojo pgdojo_cal pgdojo_holiday pgdojo_idx pgdojo_ref pgdojo_req php phpVarious phpguide plsql postgres ps r205 realC realwebapp regex rgaki ruby rule sboard sc scprint scquest sdb sdbquest seesaa setup sh_Imagick sh_canvas sh_dotnet sh_google sh_tool sh_web shadowbox shgm shjquery shvbs shweb sjscript skadai skywalker smalltech sperl sqlq src systemdoc tcpip tegaki three toolbox twitter typeface usb useXML vb vbdb vbsfunc vbsguide vbsrc vpc wcsignup webanymind webappgen webclass webparts webtool webwsh win8 winofsql wmi work wp youtube