|
Admin
|
 |
« on: July 30, 2001, 09:24:15 PM » |
|
## 2000/05/17 ## ## TITLE: FormSave filter ## ## Save your FROM DATA in Cookie & Auto-load ## ## AUTHOR: Yoshihiro Tomita ## ## FILTERS: ## ## 1) FormSave filter (JavaScript) # Main Script ## 2) FormSave AutoLoad ## 3) FormSave MainMenu ## 4) FormSaveMenu@InputBox ## 5) Cookie: Kill FormSaveCookie (out) ## 6) RemoveCookie (JavaScript) ## ## FormSave filter enables you to save your FORM INPUTs such as ## your ID and PASSWORD in the Cookie file on your machine. ## When you visit the web page again, FormSave filter loads FORM ## DATA, automatically. ## ## **CAUTION** ## This flter has some risks. For example, your PASSOWRD can be ## read out by someone having knowledge of cookie system. ## ## USAGE: ## ## Setup filters and visit a web page having FORM TEXT INPUT BOX. ## Then, MENUs appear on the web page. Main menu at the last of ## the web page and tiny menu "?ASD" at the input box. ## Fill the input box (DON'T SUBMIT) and click "Save". ## Finish the browser and visit same web page again. ## Then, automatically load your FORM INPUT. ## ## 1) FormSave filter must be "ON", since it's main script. ## 2) FormSave AutoLoad ON/OFF auto-load operation. ## 3) FormSave MainMenu ON/OFF main menu. ## 4) FormSaveMenu@InputBox ON/OFF tiny menu. ## 5) Kill FormSaveCookie (out) hides only FormSave's cookie data ## from HTTP header to web server. ## 6) RemoveCookie is indipendent JavaScript.(Default is "OFF") ## You can remove cookies with confirmation. Turn off the ## "Kill alert/confirm boxes" filter for this operation. ## When you have cookie data for the web page, menu "Cookie?" ## is shown at the bottom. Click it. You'll see confirmation ## of removing each cookie data. (not only FormSave's cookie) ## ## MENU ITEMS: ## ## Each menu items call a function "FormSave(Mode)". ## Mode=0: "Load" Load stored FORM DATA from Cookie. ## Mode=1: "All" Save All FORM INPUT BOX to Cookie. ## Mode=2: "Save" Save only confirmed data. ## Mode=9: "Del" Delete cookie data of FormSave filter. ## (Mode=-1: Return "ture", if Cookie DATA is exist.) ## Tiny menu: "?"=Load, "A"=All, "S"=Save, "D"= Del ## ## When you have stored "FormSaveCookie" of the web page, ## "Load" and "Del" menu are shown. When the "FormSaveCookie" ## is not exist, only "All" and "Save" menu are shown. ## ## Turn off the "Kill alert/confirm boxes" filter, ## if you want to use Mode=2, ## ## TYPE CHECK ## ## Function "FS_Check(Type)" checks a type of FORM INPUT. ## Function "FormSave" calls "FS_Check(Type)" at the top of the ## script, and Save/Load only input types matching the "Type". ## "FormSave MainMenu" also calls "FS_Check(Type)" at the top. ## When matched type is exist, main menu is shown. ## Both default "Type" is "^(text|password)$". ## The types of TEXT or PASSWORD matches the default. ## ## ## The flag of "MakeFormName" in top of the script sets ON/OFF ## to make new form name such as "forms[n]" for FORM tag having ## no name. If it is "true", FORM can be identifyed strictly. ## But order of FORM tags do not fix at some web pages. ## I think "MakeFormName = false" is better. ##
[HTTP headers] In = FALSE Out = TRUE Key = "Cookie: Kill FormSaveCookie (out)" Match = "1FormSave*=(*;2|w+)" Replace = "12"
[Patterns] Name = "FormSave filter (JavaScript)" Active = TRUE Limit = 256 Match = "<start>" Replace = "<script language="JavaScript">" " " "var MakeFormName = false; " "function FormSave(Mode) { " " var Elms = FS_Check("^(text|password)$"); " " var Key = "FormSave"+escape(location.pathname); " " var Val = ""; " " if(Mode==9) return(setFS_Cookie("",Key)); " " if(Mode<1) { " " Val = getFS_Cookie(document.Cracker,Key); " " if(Val == 0) return false; " " if(Mode<0) return true; " " setFS_Cookie(Val,Key); " " } " " for(var n=0; n<Elms.length ; n+=2) { " " var Elm=Elms[n]; var ElmN=Elms[n+1]; " " switch(Mode) { " " case 0: " " var Str=getFS_Cookie(Val,ElmN); " " if(Str != 0) Elm.value = Str; " " break; " " case 2: " " if(! confirm(ElmN+" ("+Elm.type+") Save ?"))" " break; " " default:" " Val += ElmN+"="+escape(Elm.value)+";"; " " } " " } " " if(Mode>0) setFS_Cookie(Val,Key); " "} " " " "function FS_Check(Types) { " " var n=0; var Elms = new Array(); " " for(var j=0; j<document.forms.length ; j++) { " " var Form = document.forms[j]; " " var FormName = (Form.name.length>0) ? Form.name" " : (MakeFormName ? "forms["+j+"]" : ""); " " for(var i=0; i<Form.elements.length; i++) { " " var Elm = Form.elements; " " var ElmName = (Elm.name.length>0) ? Elm.name" " : "elements["+i+"]"; " " if(Elm.type.toLowerCase().match(Types) != null) { " " Elms[n++]= Elm; " " Elms[n++]= FormName + "." + ElmName; " " } " " } " " } " " return(Elms); " "} " " " "function getFS_Cookie(Val,Key) { " " var n1=Val.indexOf(Key+"=",0); " " if(n1<0) return(0); " " n1 += Key.length + 1; " " var n2 = Val.indexOf(";",n1); " " if( n2<0 ) n2 = Val.length; " " return( unescape(Val.substring(n1,n2)) ); " "} " " " "function setFS_Cookie(Val,Key) { " " var Exp = new Date(); " " if( Val.length > 0 ) { " " Exp.setTime(Exp.getTime()+365*24*60*60*1000); " " } " " document.Cracker = Key+ "=" + escape(Val) " " + "; expires=" + Exp.toGMTString(); " "} " "</script> "
Name = "FormSave AutoLoad" Active = TRUE Limit = 256 Match = "<end>" Replace = "<script language="JavaScript">FormSave(0);</script> "
Name = "FormSave MainMenu" Active = TRUE Limit = 256 Match = "<end>" Replace = "<script language="JavaScript"> " "if(FS_Check("^(text|password)$").length>0) { " " document.write("<table width='100%'>" " <tr><th bgcolor='#c0ffc0'>FormSave["); " " if(FormSave(-1)) document.write("" " <a href='' onClick='FormSave(0);return false;'>Load</a>" " <a href='' onClick='FormSave(9);return false;'>Del</a>" " "); " " document.write("" " <a href='' onClick='FormSave(1);return false;'>All</a>" " <a href='' onClick='FormSave(2);return false;'>Save</a>" " ]</th></tr></table>"); " "} " "</script> "
Name = "FormSaveMenu@InputBox" Active = TRUE Bounds = "<inputs*type=("|)(text|password)("|)*>" Limit = 512 Match = "1" Replace = "1" "<a href='' onClick='FormSave(0);return false;'>?</a>" "<a href='' onClick='FormSave(1);return false;'>A</a>" "<a href='' onClick='FormSave(2);return false;'>S</a>" "<a href='' onClick='FormSave(9);return false;'>D</a>"
Name = "RemoveCookie (JavaScript)" Active = FALSE Limit = 256 Match = "<end>" Replace = "<script language="JavaScript">" "function RmCookie(){ " " if(document.Cracker.length<1) return; " " var Cookies = document.Cracker.split(";"); " " var Exp = new Date(); " " Exp = Exp.toGMTString(); " " for(var n=0; n<Cookies.length; n++){ " " var Key = Cookies[n].split("="); " " if(confirm("RemoveCookie? "+Key[0])) " " document.Cracker = Key[0]+"=; expires="+Exp; " " } " "} " "if(document.Cracker.length>0){ " " document.write("" " <a href='' onClick='RmCookie();return false;'>" " Cookie?</a>"); " "} " "</script>"
With regards from Admin
|