Просмотр файла linkexchanger/admin/codes.php

Размер файла: 2.53Kb
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<title>LinkExchanger ADMIN AREA</title>
</head>

<?
include "../config.php";
include "menu.php";
echo "<body bgcolor=$bgcolor>";

// удаление HTML-кодов
if ($_GET[delete] AND $_GET[addtime]) {
$file=file("../myhtml.dat");
for($k=0;$k<count($file);$k++) {
$a = explode("|", $file[$k]);
if($a[0] == $_GET[delete] AND $_GET[addtime] == $a[1]) unset($file[$k]);
} 
$fp=fopen("../myhtml.dat","w");
flock($fp, LOCK_EX);
fputs($fp,implode("",$file)); 
flock($fp, LOCK_UN);
fclose($fp);
}
// удаление HTML-кодов


if ($_POST[submit] AND $_POST[myhtml]) {
$myhtml = trim($_POST[myhtml]);
$myhtml = str_replace ("|", " ", $myhtml);
$myhtml = ereg_replace ('\\\"', "", $myhtml);
$myhtml = ereg_replace ("\\\'", "", $myhtml);
$myhtml = ereg_replace ("\r", "", $myhtml);
$myhtml = ereg_replace ("\n", "", $myhtml);
$add = time();
$add_time = date("d-m-Y H:i:s", "$add");
$fa = fopen ("../myhtml.dat", "a");
flock($fa, LOCK_EX);
fwrite ($fa, "$myhtml|$add_time|$myhome\n");
flock($fa, LOCK_UN);
fclose ($fa);
}

echo "<center><table cellpadding=3 width=500>";
$file = file("../myhtml.dat");
$num = count($file);
echo "<tr><td colspan=2><font face=$title_face size=$title_size color=$title_color><b>Мои HTML-коды: ($num)</b></font><hr size=1></td></tr>";
for($i=0; $i<$num; $i++){
$a = explode("|", $file[$i]);
echo "<tr><td align=left valign=top><font face=$font_face size=$font_size color=$font_color>$a[0]</font></td><td align=left valign=top><font face=$font_face size=$font_size color=$font_color><textarea name=myhtml rows=3 cols=24>$a[0]</textarea></font></td></tr>";
echo "<tr><td align=left><font face=$font_face size=$font_size color=$font_color>Добавлен: $a[1]</font></td><td align=right><font face=$font_face size=$font_size color=$font_color><a href='$_SERVER[PHP_SELF]?delete=$a[0]&addtime=$a[1]'>Удалить</a></font></td></tr>";
echo "<tr><td colspan=2><hr size=1></td></tr>";
}
echo "</table></center>";
// FORM
echo "<center><table cellpadding=3 width=500><tr><td>";
echo "<form action=$_SERVER[PHP_SELF] method=POST>";
echo "<font face=$title_face size=$title_size color=$title_color><b>Добавить HTML-код:</b></font><hr size=1><br>";
echo "<font face=$font_face size=$font_size color=$font_color>HTML-код текстовой ссылки или кнопки</font><br><textarea name=myhtml rows=4 cols=60></textarea><br>";
echo "<input name=submit type=submit value=Добавить></form></td></tr>";
echo "<tr><td><hr size=1></td></tr></table></center>";
// FORM
?>
</body>
</html>