Location: PHPKode > projects > tinyphpadmin > tinyphpadmin/english/tinyphpadmin_without_WYSIWYG/admin.php
<?php 
//------------------------------------------------------------------------ 
// tinyphpadmin
//------------------------------------------------------------------------

// password
$password="123";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>tinyphpadmin</title>
<style type="text/css">
body {
font-family: Arial,sans-serif;
font-size: 12px;
line-height: 1.7;
}

a {
color: #333;
}

#main {
position: absolute;
margin-top: 20px;
margin-left: 20px;
}
</style>
</head>
<body><div id="main">
<?php
$passwordgiven="";

if (isset($_POST["passwordgiven"])) {
$passwordgiven=$_POST["passwordgiven"]; };

if ($password == $passwordgiven) {

if (isset($_POST["fileselect"]) and isset($_POST["content"])) {

$passwordgiven=$_POST["passwordgiven"];
$content = $_POST["content"];
$fileselect = $_POST["fileselect"];
$datei = fopen($fileselect, "w");
fwrite ($datei, $content);
fclose ($datei);
?>

<p>The file "<a href="<?php echo $fileselect; ?>"><?php echo $fileselect; ?></a>" has been successfully updated.</p>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="hidden" name="passwordgiven" value="<?php echo $passwordgiven; ?>" />
<input type="submit" value="edit another file" />
</form>

<?php
} else {

if (isset($_POST["fileselect"])) {
$fileselect=$_POST["fileselect"];
?>

<p><strong>File:</strong> <?php echo $fileselect; ?></p>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="hidden" name="fileselect" value="<?php echo $fileselect; ?>" />
<input type="hidden" name="passwordgiven" value="<?php echo $passwordgiven; ?>" />
<p>
<textarea name="content" cols="90" rows="15">
<?php
readfile($fileselect);
?>
</textarea></p>
<input type="submit" name="submit" value="save" />
</form> 

<?php 
} else { 
?>

<p>Please choose a file to edit.</p>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="hidden" name="passwordgiven" value="<?php echo $passwordgiven; ?>" />
<p>
<select name="fileselect">
<?php
foreach (glob("*.html") as $filename) {
    echo "<option>".$filename."</option>";
}

foreach (glob("*.htm") as $filename) {
    echo "<option>".$filename."</option>";
}

foreach (glob("*.css") as $filename) {
    echo "<option>".$filename."</option>";
}

foreach (glob("style/*.css") as $filename) {
    echo "<option>".$filename."</option>";
}
?>
</select>
&nbsp;<input type="submit" name="submit" value="edit" /></p>
</form> 

<?php 
};
};
} else {
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="password" name="passwordgiven" />
&nbsp;<input type="submit" value="login" />
</form> 

<?php
};
?>
</div></body>
</html>
Return current item: tinyphpadmin