권장 : ASP 팁 예 : 가장 간결한 다중 쿼리 솔루션의 ASP 구현 우리는 종종 여러 쿼리 문제를 겪고 있으며 긴 SQL 문은 종종 승려를 혼란스럽게 만듭니다. 특히 클라이언트 부품이 쿼리 조건을 채우는 경우 일반 방법을 사용하는 것이 훨씬 더 어려울 것입니다. 다음은 where 1 = 1의 정체성을 영리하게 사용합니다 (
모든 사람이 볼 수 있도록 간단한 ASP 구성 요소가없는 업로드 클래스가 전송됩니다. 실험을 할 수 있습니다!
| 다음은 인용 된 내용입니다. <%@ language = javaScript%> <% var self = request.servervariables (script_name); if (request.servervariables (request_method) == post) { var oo = new uploadFile (); oo.path = myfile; // 스토리지 경로, 비어있는 것은 현재 경로를 의미하며, 기본값은 uploadFile입니다. oo.named = 파일; // 이름 메소드, 날짜는 날짜와 이름 지정을 의미하고 파일은 파일 이름 자체를 사용하고 기본값은 파일입니다. oo.ext = 모두; // 업로드 할 수있는 확장자가 모두 허용되고 기본값이 모두임을 의미합니다. oo.over = true; // 동일한 파일 이름이 존재할 때 덮어 쓰는 지 여부는 기본값이 False입니다. 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.name = 파일; this.ext = 모두; this.over = false; this.size = 1*1024*1024*1024; // 1GB // 파일 업로드 this.upload = function () { var o = this.getInfo (); if (O.Size> this.Size) { ALERT (파일이 너무 커서 업로드 할 수 없습니다!); 반품; } var f = this.getFilename (); var ext = f.replace (/^. /./,); if (this. { Alert (현재 Ext Extension이있는 파일 업로드는 지원되지 않습니다!); 반품; } if (this.name == date) { f = new date (). tolocalestring (). 교체 (// d/g). ext; } oo.open (); oo.type = 1; oo.write (O.Bin); this.path = this.path.replace (/[^///] $/, $ &/); var fso = server.createobject (scripting.filesystemobject); if (this.path! = &&! fso.dolerexists (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 = 유니 코드; var gbcode = Escape (oo.readtext ()). 교체 (/%u (..) (..)/g,%$ 2%$ 1); var spos = gbcode.indexof () 12; var slength = blen- (gbcode.substring (0, gbcode.indexof ()). length/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 (); 반환 {bin : bfile, size : slength}; } // 파일 이름을 얻습니다 this.getFilename = function () { oo.open (); oo.type = 2; oo.writetext (btext); oo.position = 0; oo.charset = gb2312; var filename = oo.readtext (). match (/filename =/(.?) // i) [1] .split (//). slice (-1) [0]; oo.close (); 리턴 파일 이름; } 기능 경보 (MSG) { response.write ( '<script type = text/javaScript> alert ('msg '); </script>'); } } %> <html> <헤드> <title> ASP 구성 요소가없는 업로드 클래스 </title> <meta http-equiv = content-type content = text/html; charset = gb2312> </head> <body> <양식 action = <%= self%> method = post encType = multipart/form-data onsubmit = return (this.upfile.value! = '');> <입력 유형 = 파일 이름 = upfile/> <입력 유형 = 제출 값 = 파일 업로드/ </form> </body> </html> |
공유 : 10 줄의 코드 라인 많은 사람들이 기숙사에서 인터넷을 함께 서핑하고 있으며, 많은 사람들이 ARP를 사용하여 악을 행하기 때문에 인터넷 연결을 유지합니다. 해결책이 있는지 물었 기 때문에 다음 VBS 스크립트를 썼습니다. 반 친구는 채팅을 사용한 후에 채팅을 제거하지 않을 것이라고 말했습니다. ~에 의해