用户名+密码控制+php文件存储
<?php
$posi = strrpos($_SERVER['PHP_SELF'],"/"); #
$script_name = substr($_SERVER['PHP_SELF'], ++$posi); #
$usernamestr = "us";
$username = "ora";
$passwdstr = "pswd"; # Get password by string .
$passwd = "ora";
#$passwd = crypt($passwd,"qw@");#加密 #echo $passwd;
$login_form = "
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">
<div>登陆</div>
<form method=\"post\" action=\"$script_name\" >
<span>用户名:<input type=\"text\" name=\"$passwdstr\" value=\"\" /></span><br/>
<span>密码:<input type=\"password\" name=\"$usernamestr\" value=\"\" /></span><br/>
<input type=\"submit\" value=\"提交\" />
</form>
";
if (empty($_REQUEST[$passwdstr])
|| empty($_REQUEST[$usernamestr])
|| $_REQUEST[$passwdstr] != $passwd
|| $_REQUEST[$usernamestr] != $username
){
exit ("$login_form");#禁止访问
} ## else go contine.
$passwd_user_canshu = "?".$passwdstr."=".$passwd."&".$usernamestr."=".$username."&"; ###
?>
<?php
#共享参数
$RecordDirName = $uploaddir = $username."/" ; #
$RecordFileName = $Recordfn = $username."-"."uploadRecord.txt"; #
$RecordFileUrl = $RecordDirName.$RecordFileName; #
$htaccessFileUrl = $uploaddir.".htaccess"; #
?>
<!doctype html>
<html>
<head>
<title >公共网盘 </title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="keywords" content="网盘,公共网盘,云盘,"/>
<meta name="description" content=" 一个免费的、匿名的公共网盘."/>
<style>
a {
text-decoration:none;
//color: blue;
// color:#319FC4;//royalblue;//aquamarine; //
}
form {
background-color:#BCABAB;
}
.page_show a ,.page_show span {
//display:inline-block;
//display:block;
//width:45px;align:center;
//height:30px;border:1px;
//页码显示优化,11/05/2019 20:55:57
}
.page_show a,
.page_show span {
//float: left;
padding: 2px 8px;
line-height: 20px;
text-decoration: none;
font-weight: normal;
background-color: #FAFAFA;
border: 1px solid #dddddd;
color: #828282;
margin-left: 5px;
}
.page_show a:hover,
.page_show a:focus,
.page_show span.current {
background-color: #ff4629;
color: white;
border-color: #ff4629;
}
.page_show span.current {
color: white;
border-color: #ff4629;
cursor: default;
}
body {
line-height:200% ;
}
</style>
</head>
<body style="">
<a name="top"></a>
<hr />
<h1 style=""> 公共网盘</h1>
<h2 style=""> 用户:<?php echo $username; ?></h2>
<form role="search" method="post" id="searchform" class="searchform" action="<?php echo $script_name.$passwd_user_canshu ?>">
搜索文件<input type="text" value="" name="s" id="" style="background-color: rgb(240,240,240);">
<input type="submit" id="searchsubmit" value="?搜索">上传前,先搜索。使用精准的搜索词。
<input type="hidden" name="<?php echo $passwdstr; ?>" value="<?php echo $passwd; ?>" />
<input type="hidden" name="<?php echo $usernamestr; ?>" value="<?php echo $username; ?>" />
</form>
<form action="<?php echo $script_name.$passwd_user_canshu ?>" method=