<scriptLanguage = "javascript" runat = "เซิร์ฟเวอร์">
// เชื่อมต่อฐานข้อมูล
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 เพื่อตรวจสอบว่ามีไฟล์อยู่หรือไม่
functionisisfileexist (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 (ไฟล์));
a.write (fbody);
A.close ();
-
// รับซอร์สโค้ดหน้าเป้าหมาย
FunctionGetHttppage (URL) {
varhttp = server.createObject ("microsoft.xmlhttp");
http.open ("รับ", 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 ("/");