| <%@LANGUAGE="JavaScript"%>
<%
var _DO=Request.queryString("do");
var PAGE=((begin=Request.ServerVariables("URL")(1).lastIndexOf("/"))==-1)? Request.ServerVariables("URL"):Request.ServerVariables("URL")(1).substring(begin+1);
var AUTH_USER=new Array();
AUTH_USER["username"]="admin";
AUTH_USER["password"]="21232f297a57a5a743894a0e4a801fc3";
AUTH_USER["email"]="support@gaya.cn";
//END_AUTH_USER
var CONFIG=new Array();
CONFIG["version"]="V1.2/051228";
CONFIG["use_utf"]="";
CONFIG["nLayer"]="1";
CONFIG["auth_type"]="cookie";
CONFIG["cookie_life"]="2592000";
CONFIG["session_life"]="54000";
CONFIG["realm"]="EditONE@{server_name}";
CONFIG["start_dir"]="/";
CONFIG["expand_one"]="";
CONFIG["encoding"]="GB2312";
CONFIG["wrap_word"]="undefined";
CONFIG["editor_font_family"]="宋体";
CONFIG["editor_font_height"]="14";
CONFIG["editor_line_height"]="16";
//END_CONFIG
var realm=CONFIG["realm"].replace(/\{server_name\}/, Request.ServerVariables("SERVER_NAME")(1));
var HTML_HEADER="\r\n"+
"\r\n"+
"\r\n"+
""+realm+" - Edit All in One Page!\r\n"+
"\r\n"+
"\r\n"+
"";
if (_DO=="edit")
showEditFile();
else if (_DO=="save")
responseSaveFile();
else if (_DO=="login")
showLogin("");
else if (_DO=="verify")
showVerify();
else if (_DO=="logout")
showLogout();
else if (_DO=="frame_set")
showFrameSet();
else if (_DO=="file_list") {
var dir=(Request.queryString("dir")(1)!="")? Request.queryString("dir")(1):CONFIG["start_dir"];
showFileList(dir, CONFIG["nLayer"]);
}
else if (_DO=="left_frame")
showLeftFrame();
else if (_DO=="main_frame")
showMainFrame();
else if (_DO=="image")
responseImageFile("");
else if (_DO=="config")
showConfig();
else if (_DO=="modify")
modifyConfig();
else if (_DO=="xml")
responseXmlFile();
else if (_DO=="download")
downloadFile();
else if (_DO=="new")
newFile();
else if (_DO=="paste")
pasteFile();
else if (_DO=="rename")
renameFile();
else if (_DO=="delete")
deleteFile();
else if (_DO=="upload")
uploadFile();
else if (_DO=="getad") {
getAD();
}
else if (_DO=="debug") {
loadConvertTable();
}
else
showFrameSet();
Response.End();
function showAuthorize(fileType)
{
if (CONFIG["auth_type"]=="none")
return;
else if (CONFIG["auth_type"]=="HTTP") {
if (Session.contents("auth")==true)
return;
else if (fileType=="HTML")
if (Request.ServerVariables("AUTH_USER")=="") {
Response.addHeader(’WWW-Authenticate", "Basic realm="’+realm+’"’);
Response.addHeader(’HTTP/1.0 401 Unauthorized’);
Response.Write("抱歉,您的密码不正确,或者您没有使用此软件的权限。请联系"+AUTH_USER["email"]+"");
Response.End();
}
else {
if (AUTH_USER["password"]==MD5(Request.ServerVariables(’AUTH_PW’)(1)) && AUTH_USER["username"]==Request.ServerVariables("AUTH_USER"))
Session.contents("auth")=true;
else {
Response.addHeader(’WWW-Authenticate", "Basic realm="’+realm+’"’);
Response.addHeader(’HTTP/1.0 401 Unauthorized’);
Response.Write("抱歉,您的密码不正确,或者您没有使用此软件的权限。请联系"+AUTH_USER["email"]+"");
Response.End();
}
}
else if (fileType=="XMLHTTP") {
Response.ContentType="text/xml";
Response.Write("\r\n\r\n");
}
else if (fileType=="EMBED")
Response.Write("操作未授权");
}
else if (CONFIG["auth_type"]=="cookie") {
if (AUTH_USER["password"]==Request.Cookies("_editone_asp_hash") && AUTH_USER["username"]==Request.Cookies("_editone_asp_user"))
return;
else if (fileType=="HTML") {
Response.Write("");
showLogin("");
//序列化$_REQUEST, set_cookie(Request.ServerVariables("URI"))
}
else if (fileType=="XMLHTTP") {
Response.ContentType="text/xml";
Response.Write("\r\n\r\n");
}
else if (fileType=="EMBED")
Response.Write("操作未授权");
}
Response.End();
}
function showLogin(message)
{
Response.Write(HTML_HEADER);
%>
<%
}
function showVerify()
{
if (AUTH_USER["password"]==MD5(Request.form("password")(1)) && AUTH_USER["username"]==Request.form("username"))
{
Response.cookies("_editone_asp_user")=AUTH_USER["username"]; // time()+CONFIG["cookie_life"]);
Response.cookies("_editone_asp_hash")=AUTH_USER["password"]; // time()+CONFIG["cookie_life"]);
Response.Write("");
}
else
showLogin("密码不正确。请重新输入。"); // "" => d41d8cd98f00b204e9800998ecf8427e
}
function showLogout()
{
if (CONFIG["auth_type"]=="cookie")
{
Response.cookies("_editone_asp_user")=""; // time()-3600);
Response.cookies("_editone_asp_hash")=""; // time()-3600);
}
else if (CONFIG["auth_type"]=="HTTP")
Session.contents("auth");
showLogin("正常退出。Cookie被清除。会话已中止。感谢您的使用。");
}
function showFrameSet()
{
showAuthorize("HTML");
Response.Write(HTML_HEADER);
%>
请使用支持Frame的浏览器。
|