?? preferences.asp
字號:
<%'=========================================
'ScriptMate User Manager Version 2.1
'Copyright 2001 (C) ScriptMate.Com
'Admin Module
'This module helps to setup the preferences for your site.
'For any help with modification to
'this file contact support@scriptmate.com
'=========================================%>
<script language="JAVASCRIPT">
var errfound = false;
function ValidLength(item, len) {
return (item.length >= len);
}
function ValidEmail(item) {
if (!ValidLength(item, 5)) return false;
if (item.indexOf ('@', 0) == -1) return false;
if (item.indexOf ('.', 0) == -1) return false;
return true;
}
function error(elem, text) {
if (errfound) return;
window.alert(text);
elem.select();
elem.focus();
elem.style.backgroundColor=errorcolor;
errfound = true;
}
function Validate() {
errfound = false;
d=document.preferences
if (!ValidLength(d.smummaxlevels.value,1))error(d.smummaxlevels,"Maximum Levels should not be blank.");
if (!ValidLength(d.smumrecordsperpage.value,1))error(d.smumrecordsperpage,"Records Displayed per page should not be blank.");
if (!ValidLength(d.smumwebsite.value,2))error(d.smumwebsite,"Name of the Website should not be blank.");
if (!ValidLength(d.smumpagetitle.value,2))error(d.smumpagetitle,"Title of the Pages should not be blank.");
if (!ValidLength(d.smumlogoutredirect.value,2))error(d.smumlogoutredirect,"Default Logout Page should not be blank.");
if (!ValidLength(d.smumadminname.value,2))error(d.smumadminname,"Admin Name should not be blank.");
if (!ValidEmail(d.smumadminemail.value))error(d.smumadminemail,"Please enter a valid email address ex. test@example.com");
if (!ValidLength(d.smummailserver.value,2))error(d.smummailserver,"Mail Server Address should not be blank.");
return !errfound;
}
</script>
<%Sub Preferences()
dim dbsmummaxlevels,dbsmumvalidateemail,dbsmummessagequeuing,dbsmumrecordsperpage,_
dbsmumwebsite,dbsmumpagetitle,dbsmumlogoutredirect,dbsmumadminname,dbsmumadminemail,dbsmumregisternotification,dbsmumcookies,_
dbsmummailserver,dbsmummailcomponent,dbsmumexpirytrigger,dbsmummaxips,dbsmumadditionalfields,dbsmumipsecurity,_
dbsmumdebugmode,dbsmumcheckblockedemailids,dbsmumcheckduplicateemailids,dbsmumapprovemessages,dbsmumlistingfields,dbsmumlistingsessions,_
dbsmummultiplelogin,mcdata,i,ipsdata,smumquery1,getlistingfields,whatever,n,getlistingsessions,name,mystring,todo
smumadminheader("Setup Preferences")
session("emailsettings")= ""
if not Application("smumdebugmode") then on error resume next
if session("admin") = "" then Response.Redirect smumadminpage & "?action=login"
action =request("action")
todo = request("todo")
if todo = "" then
smumquery = "select * from smum_preferencestbl"
smumOpenrs smumquery,"smumrs",action
dbsmummaxlevels = smumrs("smummaxlevels")
dbsmumvalidateemail = smsmIfCheckedDB(smumrs("smumvalidateemail"),"smumvalidateemail")
dbsmummessagequeuing = smsmIfCheckedDB(smumrs("smummessagequeuing"),"smummessagequeuing")
dbsmumrecordsperpage = smumrs("smumrecordsperpage")
dbsmumwebsite = smumrs("smumwebsite")
dbsmumpagetitle = smumrs("smumpagetitle")
dbsmumlogoutredirect = smumrs("smumlogoutredirect")
dbsmumadminname = smumrs("smumadminname")
dbsmumadminemail = smumrs("smumadminemail")
dbsmumregisternotification = smsmIfCheckedDB(smumrs("smumregisternotification"),"smumregisternotification")
dbsmumcookies = smsmIfCheckedDB(smumrs("smumcookies"),"smumcookies")
dbsmummailserver = smumrs("smummailserver")
dbsmummailcomponent = smumrs("smummailcomponent")
dbsmumexpirytrigger = smumrs("smumexpirytrigger")
dbsmummaxips = smumrs("smummaxips")
dbsmumadditionalfields = smumrs("smumadditionalfields")
dbsmumipsecurity = smumrs("smumipsecurity")
dbsmumdebugmode = smsmIfCheckedDB(smumrs("smumdebugmode"),"smumdebugmode")
dbsmumcheckblockedemailids = smsmIfCheckedDB(smumrs("smumcheckblockedemailids"),"smumcheckblockedemailids")
dbsmumcheckduplicateemailids = smsmIfCheckedDB(smumrs("smumcheckduplicateemailids"),"smumcheckduplicateemailids")
dbsmumapprovemessages = smsmIfCheckedDB(smumrs("smumapprovemessages"),"smumapprovemessages")
dbsmumlistingfields = smumrs("smumlistingfields")
dbsmumlistingsessions = smumrs("smumlistingsessions")
dbsmummultiplelogin = smsmIfCheckedDB(smumrs("smummultiplelogin"),"smummultiplelogin")
smumClosers(smumrs)
redim mcarray(6)
mcarray(0) = "ASPEMAIL"
mcarray(1) = "ASPMAIL"
mcarray(2) = "CDONTS"
mcarray(3) = "JMAIL"
mcarray(4) = "OCXMAIL"
mcarray(5) = "SIMPLEMAIL"
mcdata = ""
For i = 0 to 5
if mcarray(i) = dbsmummailcomponent then
mcdata = mcdata & "<option selected value="""&mcarray(i)&""">"&mcarray(i)&"</option>"
else
mcdata = mcdata & "<option value="""&mcarray(i)&""">"&mcarray(i)&"</option>"
end if
Next
redim ipsarray(3)
ipsarray(0) = "None"
ipsarray(1) = "Basic"
ipsarray(2) = "Advanced"
ipsdata = ""
For i = 0 to 2
if i = dbsmumipsecurity then
ipsdata = ipsdata & "<option selected value="""&i&""">"&ipsarray(i)&"</option>"
else
ipsdata = ipsdata & "<option value="""&i&""">"&ipsarray(i)&"</option>"
end if
Next
if dbsmumlistingfields <> "" then dbsmumlistingfields = split(dbsmumlistingfields,",")
if dbsmumlistingsessions <> "" then dbsmumlistingsessions = split(dbsmumlistingsessions,",")
smumFormAction "<form action="""&smumadminpage&"?action=preferences"" method=post name=preferences language=""JAVASCRIPT"" onsubmit=""return Validate();"">"
smumFormHiddenField "todo","add"
smumFormOpenTable
smumFormHeader "Setup Preferences"
smumFormFields "Maximum Levels","<input class=fieldbox type=text name=smummaxlevels size=10 value="""&dbsmummaxlevels&""">"
smumFormFields "Records Displayed per page","<input class=fieldbox type=text name=smumrecordsperpage size=10 value="""&dbsmumrecordsperpage&""">"
smumFormFields "Name of the Website","<input class=fieldbox type=text name=smumwebsite size=35 value="""&dbsmumwebsite&""">"
smumFormFields "Title of the Pages","<input class=fieldbox type=text name=smumpagetitle size=35 value="""&dbsmumpagetitle&""">"
smumFormFields "Default Logout page","<input class=fieldbox type=text name=smumlogoutredirect size=35 value="""&dbsmumlogoutredirect&""">"
smumFormFields "Registration Notification",dbsmumregisternotification
smumFormFields "Use Cookies During Login",dbsmumcookies
smumFormFields "Validate Email",dbsmumvalidateemail
smumFormFields "Admin Name","<input class=fieldbox type=text name=smumadminname size=35 value="""&dbsmumadminname&""">"
smumFormFields "Admin Email","<input class=fieldbox type=text name=smumadminemail size=35 value="""&dbsmumadminemail&""">"
smumFormFields "Mail Server Address","<input class=fieldbox type=text name=smummailserver size=35 value="""&dbsmummailserver&""">"
smumFormFields "Mail Component","<select class=fieldbox name=smummailcomponent>"&mcdata&"</select>"
smumFormFields "Message Queuing",dbsmummessagequeuing
smumFormFields "Debug Mode",dbsmumdebugmode
smumFormFields "Check Blocked Email Ids.",dbsmumcheckblockedemailids
smumFormFields "Check Duplicate Email Ids.",dbsmumcheckduplicateemailids
smumFormFields "Approve Messages",dbsmumapprovemessages
smumquery1 = "select * from smum_memberstbl"
smumOpenrs smumquery1,"smumrs1",action
getlistingfields = ""
For each whatever in smumrs1.fields
if whatever.name <> "members_id" then
if isarray(dbsmumlistingfields) then
getlistingfields = getlistingfields & "<option value="""&whatever.name&""""
For n = 0 to ubound(dbsmumlistingfields)
if trim(cstr(dbsmumlistingfields(n))) = cstr(whatever.name) then
getlistingfields = getlistingfields & "selected"
end if
Next
getlistingfields = getlistingfields & ">"&whatever.name&"</option>"
else
getlistingfields = getlistingfields & "<option value="""&whatever.name&""">"&whatever.name&"</option>"
end if
end if
Next
smumClosers(smumrs1)
smumFormFields "Member Listing Fields","<select class=fieldbox name=smumlistingfields multiple>"&getlistingfields&"</select>"
smumquery1 = "select * from smum_memberstbl"
smumOpenrs smumquery1,"smumrs1",action
getlistingsessions = ""
For each whatever in smumrs1.fields
if isarray(dbsmumlistingsessions) then
getlistingsessions = getlistingsessions & "<option value="""&whatever.name&""""
For n = 0 to ubound(dbsmumlistingsessions)
if trim(cstr(dbsmumlistingsessions(n))) = cstr(whatever.name) then
getlistingsessions = getlistingsessions & "selected"
end if
Next
getlistingsessions = getlistingsessions & ">"&whatever.name&"</option>"
else
getlistingsessions = getlistingsessions & "<option value="""&whatever.name&""">"&whatever.name&"</option>"
end if
Next
smumClosers(smumrs1)
smumFormFields "Member Sessions","<select class=fieldbox name=smumlistingsessions multiple>"&getlistingsessions&"</select>"
smumFormFields "Expiry Trigger","<input class=fieldbox type=text name=smumexpirytrigger size=5 value="""&dbsmumexpirytrigger&""">"
smumFormFields "IP Security","<select class=fieldbox name=smumipsecurity>"&ipsdata&"</select>"
smumFormFields "Maximum IPs","<input class=fieldbox type=text name=smummaxips size=5 value="""&dbsmummaxips&""">"
smumFormFields "Multiple Login",dbsmummultiplelogin
smumFormFields "Additional Fields","<input class=fieldbox type=text name=smumadditionalfields size=35 value="""&dbsmumadditionalfields&""">"
smumFormButtons "<input class=fieldbox type=submit value=""Modify Preferences"" name=submit>"
smumFormCloseTable
smumFormClose
else
For each name in Request.form
MyString = "db"&name&"=smFixer(request.form("""&name&"""))"
execute(mystring)
Next
dim fieldsar
fieldsar = split(dbsmumadditionalfields,"|")
if ubound(fieldsar) < 9 then
smJSalert("You should name all the 10 additional fields seperated by a ""|"" even if you donot wish to use them. Alternatively you can just leave the name of the fields as they were and just edit the names you wish to use. Press OK to go back and refresh the page to see the original fields.")
else
smumquery = "update smum_preferencestbl set smummaxlevels = "&dbsmummaxlevels&" , smumvalidateemail = "&dbsmumvalidateemail&",smumrecordsperpage = "&dbsmumrecordsperpage&",smumwebsite='"&dbsmumwebsite&"',smumpagetitle = '"&dbsmumpagetitle&"',smumlogoutredirect = '"&dbsmumlogoutredirect&"',smumadminname = '"&dbsmumadminname&"',smumadminemail = '"&dbsmumadminemail&"',smummailserver = '"&dbsmummailserver&"',"&_
"smummailcomponent = '"&dbsmummailcomponent&"',smumdebugmode = "&dbsmumdebugmode&",smumcheckblockedemailids= "&dbsmumcheckblockedemailids&",smumcheckduplicateemailids = "&dbsmumcheckduplicateemailids&", smumregisternotification = "&dbsmumregisternotification&", smumcookies = "&dbsmumcookies&", smumapprovemessages= "&dbsmumapprovemessages&","&_
"smumlistingfields = '"&dbsmumlistingfields&"',smumlistingsessions = '"&dbsmumlistingsessions&"',"&_
"smumexpirytrigger = "&dbsmumexpirytrigger&",smumipsecurity = "&dbsmumipsecurity&","&_
"smummaxips = "&dbsmummaxips&",smummultiplelogin = "&dbsmummultiplelogin&", smumadditionalfields = '"&dbsmumadditionalfields&"' , smummessagequeuing="&dbsmummessagequeuing
smumexecutequery smumquery,action
call smumrengenprefrences()
smumFormOpenTable
smumFormHeader "Setup Preferences"
smumFormResponse "The Preferences have been modified successfully."
smumFormCloseTable
end if
end if
End Sub%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -