Файл: mailist/admin.php
Строк: 103
<?php include("inc/bouncer.php"); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<head>
<link href="css/style.css" rel="stylesheet" type="text/css">
<title>Mailist V2 Administration</title>
</head>
<br>
<center>
<img src="css/logo.gif" alt="Maillist">
<?php
$file = "maillist.php";
$lines = count(file($file));
$lines = $lines-1;
echo "<br><br>- There are $lines people in the maillist. -";
?>
<br>
<a href="<?php echo $_SERVER['php_self'] ?>?logout">Logout</a>
<div id="container">
<fieldset>
<legend>List Options</legend>
<A href="<?php echo $_SERVER['PHP_SELF'] ?>?view">View Mail list</a><br>
<?php
if (isset($_GET['view'])){
echo "<br>";
$names = file("maillist.php");
foreach ($names as $line_num => $line) {
echo $line;
}
echo '<a href="'.$_SERVER['PHP_SELF'].'">Hide</a><br>';
}
?>
<A href="<?php echo $_SERVER['PHP_SELF'] ?>?backup">Backup List</a><br>
<?php
if (isset($_GET['backup'])){
echo "<br>";
$file = 'maillist.php';
$newfile = 'backups/'.date("jnY").'.txt';
copy($file, $newfile);
echo 'Successfully backed up. (backups/'.$newfile.')<br>';
echo '<a href="'.$_SERVER['PHP_SELF'].'">Hide</a><br>';
}
?>
<A href="down.php" target="new">Download List</a><br>
</fieldset>
<fieldset>
<legend>Messaging</legend>
<A href="<?php echo $_SERVER['PHP_SELF'] ?>?header">Edit header</a><br>
<?php
if (isset($_GET['header'])){
$header = file_get_contents("assets/header.txt");
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">
<textarea name="header">'.$header.'</textarea><br>
<input name="Submit" value="Submit" type="submit" />
</form>';
echo '<a href="'.$_SERVER['PHP_SELF'].'">Hide</a><br>';
}
if (isset($_POST['header'])){
$data = $_POST['header'];
$file = "assets/header.txt";
if (!$file_handle = fopen($file,"w")) {
echo "Cannot open file";
}
if (!fwrite($file_handle, $data)) {
echo "Cannot write to file";
}
echo "You have successfully changed the header";
echo '<br><a href="'.$_SERVER['PHP_SELF'].'">Hide</a><br>';
fclose($file_handle);
}
?>
<A href="<?php echo $_SERVER['PHP_SELF'] ?>?send">Send an email</a><br>
<?php
if (isset($_GET['send'])){
echo "<br>";
include("send.php");
echo '<a href="'.$_SERVER['PHP_SELF'].'">Hide</a><br>';
}
?>
<A href="<?php echo $_SERVER['PHP_SELF'] ?>?footer">Edit footer</a><br>
<?php
if (isset($_GET['footer'])){
$footer = file_get_contents("assets/footer.txt");
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">
<textarea name="footer">'.$footer.'</textarea><br>
<input name="Submit" value="Submit" type="submit" />
</form>';
echo '<a href="'.$_SERVER['PHP_SELF'].'">Hide</a><br>';
}
if (isset($_POST['footer'])){
$data = $_POST['footer'];
$file = "assets/footer.txt";
if (!$file_handle = fopen($file,"w")) {
echo "Cannot open file";
}
if (!fwrite($file_handle, $data)) {
echo "Cannot write to file";
}
echo "You have successfully changed the footer";
echo '<br><a href="'.$_SERVER['PHP_SELF'].'">Hide</a><br>';
fclose($file_handle);
}
?>
</fieldset>
<fieldset>
<legend>Administration</legend>
<A href="<?php echo $_SERVER['PHP_SELF'] ?>?pass">Change Password</a><br>
<?php
if (isset($_GET['pass'])){
include("inc/config.php");
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">
<input name="password" value="'.$password.'" type="password" />
<input type="submit" value="Save">
</form>';
echo '<a href="'.$_SERVER['PHP_SELF'].'">Hide</a><br>';
}
if (isset($_POST['password'])){
$data = '<?php
$password = "'.$_POST['password'].'";
?>';
$file = "inc/config.php";
if (!$file_handle = fopen($file,"w")) {
echo "Cannot open file";
}
if (!fwrite($file_handle, $data)) {
echo "Cannot write to file";
}
echo "You have successfully changed the password";
echo '<br><a href="'.$_SERVER['PHP_SELF'].'">Hide</a><br>';
fclose($file_handle);
}
?>
</fieldset>
</div>
<p>
<a href="http://validator.w3.org/check?uri=referer"><img
src="http://www.w3.org/Icons/valid-html401"
alt="Valid HTML 4.01 Transitional" height="31" width="88" border="0"></a>
</p>
</center>