แนะนำ: ASP TIP ตัวอย่าง: การใช้ ASP ของโซลูชันหลายคำถามที่รัดกุมที่สุด เรามักจะพบปัญหาการสืบค้นหลายครั้งและข้อความ SQL ที่ยาวนานมักจะทำให้พระสับสน โดยเฉพาะอย่างยิ่งเมื่อไคลเอ็นต์ส่วนเติมเต็มในเงื่อนไขการสืบค้นมันจะยากกว่าที่จะใช้วิธีการทั่วไป ต่อไปนี้ใช้ตัวตนอย่างชาญฉลาดโดยที่ 1 = 1 (
คลาสการอัปโหลดที่ปราศจากองค์ประกอบ ASP ง่าย ๆ จะถูกส่งออกไปเพื่อให้ทุกคนได้เห็น สามารถทำการทดลองได้!
| ต่อไปนี้เป็นเนื้อหาที่ยกมา: <%@ language = JavaScript%> - var self = request.serverVariables (script_name); if (request.serverVariables (request_method) == โพสต์) - var oo = ใหม่ uploadfile (); oo.path = myfile; // พา ธ การจัดเก็บข้อมูลว่างเปล่าหมายถึงเส้นทางปัจจุบันค่าเริ่มต้นคือ uploadfile oo.named = ไฟล์; // เมธอดชื่อวันที่หมายถึงการตั้งชื่อกับวันที่, ไฟล์หมายถึงการใช้ชื่อไฟล์ตัวเอง, ค่าเริ่มต้นคือไฟล์ oo.ext = ทั้งหมด; // ส่วนขยายที่อนุญาตให้อัปโหลดทั้งหมดหมายความว่าพวกเขาได้รับอนุญาตและค่าเริ่มต้นคือทั้งหมด oo.over = true; // ว่าจะเขียนทับเมื่อชื่อไฟล์เดียวกันมีอยู่หรือไม่ค่าเริ่มต้นเป็นเท็จ oo.size = 1*1024*1024; // จำนวนไบต์สูงสุดมี จำกัด ค่าเริ่มต้นคือ 1G oo.upload (); Response.write ('<script type = text/javascript> location.replace (' self ') </script>'); - // คลาสอัปโหลดฟรีส่วนประกอบ ASP ฟังก์ชั่น uploadfile () - var blen = request.totalbytes; var btext = request.binaryRead (blen); var oo = server.createObject (adodb.stream); oo.mode = 3; this.path = uploadfile; this.named = ไฟล์; this.ext = ทั้งหมด; this.over = false; this.size = 1*1024*1024*1024; // 1GB // อัปโหลดไฟล์ this.upload = function () - var o = this.getInfo (); ถ้า (O.Size> this.size) - การแจ้งเตือน (ไฟล์มีขนาดใหญ่เกินไปและไม่สามารถอัปโหลดได้!); กลับ; - var f = this.getFilename (); var ext = f.replace (/^. /./,); if (this.ext! = all &&! regexp ใหม่ (this.ext.replace (/,/g, |), ig) .test (ext)) - การแจ้งเตือน (ปัจจุบันไม่รองรับการอัปโหลดไฟล์พร้อมส่วนขยาย ext!); กลับ; - if (this.named == วันที่) - f = วันที่ใหม่ (). tolocalestring (). แทนที่ (// d/g,) ต่อ; - oo.open (); oo.type = 1; oo.write (O.bin); this.path = this.path.replace (/[^/////] $/, $ &/); var fso = server.createObject (scripting.filesystemobject); if (this.path! = &&! fso.folderexists (server.mappath (this.path))) - FSO.CreateFolder (Server.Mappath (this.Path)); - พยายาม - oo.savetofile (server.mappath (this.path f), this.over? 2: 1); การแจ้งเตือน (อัพโหลดสำเร็จ!); - จับ (e) - การแจ้งเตือน (ขออภัยไฟล์นี้มีอยู่แล้ว!); - oo.close (); ลบ (oo); - // รับไบนารีและไฟล์ไบต์ this.getInfo = function () - oo.open (); oo.type = 1; oo.write (btext); oo.position = 0; oo.type = 2; oo.charset = Unicode; var gbcode = escape (oo.readtext ()). แทนที่ (/%u (.. ) (.. )/g,%$ 2%$ 1); var spos = gbcode.indexof () 12; var slength = blen- (gbcode.substring (0, gbcode.indexof ()). ความยาว/3) -spos/3-6; oo.close (); oo.open (); oo.type = 1; oo.write (btext); oo.position = spos/3; var bfile = oo.read (slength); oo.close (); return {bin: bfile, ขนาด: slength}; - // รับชื่อไฟล์ this.getFileName = function () - oo.open (); oo.type = 2; oo.writeText (btext); oo.position = 0; oo.charset = gb2312; var filename = oo.readtext (). การจับคู่ (/filename =/(.?) // i) [1] .split (//). slice (-1) [0]; oo.close (); คืนชื่อไฟล์; - ฟังก์ชั่นการแจ้งเตือน (ผงชูรส) - Response.write ('<script type = text/javascript> Alert (' msg '); </script>'); - - - <html> <head> <title> คลาสอัปโหลดองค์ประกอบฟรี ASP </title> <meta http-equiv = เนื้อหาประเภทเนื้อหา = text/html; charset = gb2312> </head> <body> <form action = <%= self%> method = post enctype = multipart/form-data onsubmit = return (this.upfile.value! = '');> <input type = ชื่อไฟล์ = upfile/> <อินพุตประเภท = ส่งค่า = อัปโหลดไฟล์/ </form> </body> </html> |
แบ่งปัน: รหัส 10 บรรทัดจะช่วยให้คุณกล่าวคำอำลากับการตัดการเชื่อมต่อที่เกิดจากการกระทำชั่วของ ARP หลายคนกำลังท่องอินเทอร์เน็ตด้วยกันในหอพักและหลายคนใช้ ARP เพื่อทำสิ่งชั่วร้ายซึ่งนำไปสู่การขาดการเชื่อมต่ออินเทอร์เน็ต ฉันถามฉันว่ามีวิธีแก้ปัญหาใด ๆ หรือไม่ดังนั้นฉันจึงเขียนสคริปต์ VBS ต่อไปนี้ เพื่อนร่วมชั้นของฉันบอกว่าฉันจะไม่กำจัดการแชทหลังจากใช้งาน โดย