Location: PHPKode > scripts > PHP Form2Text > php-form2text/form2txt_admin.php
<?php
/******************************************************************************\
* PHP Form 2 Text                              Version 1.0                     *
* Copyright 2000 Frederic TYNDIUK (FTLS)       All Rights Reserved.            *
* E-Mail: hide@address.com                     Script License: GPL             *
* Created  02/28/2000                          Last Modified 02/28/2000        *
* Scripts Archive at:                          http://www.ftls.org/php/        *
*******************************************************************************/
// Necessary Variables:

$MESSAGE_FILE = "form2txt_data.txt";
	// En: result file
	// Fr: fichier resultat.

$LOGIN = "ftls";
$PASSWORD = "demo";
	// En: Login and passord.
	// Fr: Login et mot de passe.

$EXIT_URL = "http://www.ftls.org/";
	// En: exit page.
	// Fr: page de sortie.

// End  Necessary Variables section
/******************************************************************************/

function error ($error_message) {
	echo $error_message."<BR>";
	exit;
}

if ($BT_Exit != "") {
	header("Location: $EXIT_URL");
}

if ( (!isset($PHP_AUTH_USER)) || ! (($PHP_AUTH_USER == $LOGIN) && ( $PHP_AUTH_PW == "$PASSWORD" )) ) {
	header("WWW-Authenticate: Basic entrer=\"Form2txt admin\"");
	header("HTTP/1.0 401 Unauthorized");
	error("Unauthorized access...");
}
?> 

<HTML><HEAD><TITLE>PHP Form 2 Text Admin</TITLE></HEAD>
<BODY BGCOLOR="white">
<BR><BR><P ALIGN="Center"><FONT FACE="Arial, helvetica" SIZE="+2" COLOR="#336699"><STRONG><EM>PHP Form 2 Text Admin</EM></STRONG></FONT></P><BR>

<?php
if (! file_exists($MESSAGE_FILE))
	error("Can't find file, check '\$MESSAGE_FILE' var...");

$file_arry = file($MESSAGE_FILE); //or error("Can not open \$MESSAGE_FILE");


if (($BT_Suppress != "") && is_array($select))  {
	while (list($key, $val) = each($select)) {
		if ($val != "") {
			$file_arry[$val] = "";
			$modif = 1;
		}
	}

	if ($modif) {
		$txt = join('', $file_arry);
		$fp = fopen("$MESSAGE_FILE", "w"); // error("Can not write \$MESSAGE_FILE");
		flock($fp, 1);
		fputs($fp, $txt);                                                     
		flock($fp, 3);
		fclose($fp);
	}
}



echo "<FORM METHOD=POST><TABLE Border=\"1\" WIDTH=\"50%\" ALIGN=\"CENTER\"><TR><TD></TD><TH>Message</TH></TR>";

$no = 0;
while (list($key, $val) = each($file_arry)) {
	if ($val != "") {
		$no++;
		echo "<TR><TD><INPUT type=\"checkbox\" Name=\"select[$key]\" value=\"$key\"> $no</TD><TH>$val</TH></TR>";
	}
}
echo "</TABLE><BR>";
echo "<CENTER><INPUT TYPE=\"Submit\" Value=\"Suppress\" NAME=\"BT_Suppress\"><INPUT TYPE=\"Submit\" Value=\"Exit\" NAME=BT_Exit></CENTER></FORM>";
?>

<CENTER><BR><BR>
	<FONT FACE="Arial" SIZE=-2>
	<EM>&copy Copyright 2000 <A HREF="http://www.ftls.org/ftls.shtml">FTLS</A> (Tyndiuk Fr&eacute;d&eacute;ric). All rights reserved.
	<BR>FTLS's PHP Scripts Archive : <A HREF="http://www.ftls.org/php/">http://www.ftls.org/php/</A></EM></FONT>
</CENTER></BODY></HTML>
Return current item: PHP Form2Text