<scriptLanguage = "javaScript"runat = "Server">
// 데이터베이스를 연결합니다
functionconnopen (databaseConnectStr) {
varconn = server.createObject ( "adodb.connection");
conn.open (databaseConnectStr);
returnconn;
}
// 지정된 형식의 텍스트 파일을 읽으려면 adodb.stream 객체를 사용합니다.
functionReadfromTextFile (fileUrl, charset) {
varstr;
varstm = server.createobject ( "adodb.stream");
stm.type = 2;
stm.mode = 3;
STM.CHARSET = CharSet;
STM.OPEN;
stm.loadfromfile (server.mappath (fileUrl));
str = stm.ReadText
stm.close;
returnstr;
}
// 지정된 형식으로 텍스트 파일을 쓰려면 adodb.stream 객체를 사용합니다.
functionWritetOtextFile (FileUrl, str, charset) {
varstm = server.createobject ( "adodb.stream");
stm.type = 2;
stm.mode = 3;
STM.CHARSET = CharSet;
STM.OPEN;
stm.writetext (str);
stm.savetofile (server.mappath (fileUrl), 2);
stm.flush;
stm.close;
}
// FSO를 사용하여 파일이 존재하는지 확인하십시오
functionIsfileExist (fileUrl) {
varfso = server.createobject ( "scripting.filesystemobject")
if (fso.fileExists (server.mappath (fileUrl))) {
returntrue;
}또 다른{
returnfalse;
}
}
// FSO를 사용하여 파일을 작성합니다
functioncatefile (파일, fbody) {
varfs = server.createObject ( "scripting.filesystemobject");
vara = fs.createtextFile (Server.Mappath (files));
A.Write (fbody);
A.Close ();
}
// 대상 페이지 소스 코드를 가져옵니다
functiongethttppage (url) {
varhttp = server.createobject ( "microsoft.xmlhttp");
http.open ( "get", url, false);
http.send ();
if (http.readystate! == 4) {returnfalse;}
return (bytestobstr (http.responsebody, "gb2312"));
}
// 코딩
functionByTestObstr (body, cset) {
varobjstream = server.createObject ( "adodb.stream");
objstream.type = 1;
objstream.mode = 3;
objstream.open ();
objstream.write = body;
objstream.position = 0;
objstream.type = 2;
objstream.charset = cset;
return (objstream.readtext);
objstream.close ();
}
// 전체 연결 주소를 가져옵니다
functiongetCompleteUrl (sources_url, get_url) {
if (get_url.indexof ( "http : //")! = -1) returnet_url;
varCompleTeUrl = "";
varsources_url_arr = sources_url.split ( "/");