📄 maillist.asp
字号:
<%'=========================================
'ScriptMate User Manager Version 2.1
'Copyright 2001 (C) ScriptMate.Com
'User Module
'This module helps a member to subscribe or unsubscribe to the mailing list
'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.maillist
if (!ValidLength(d.maillist_name.value,1))error(d.maillist_name,"Name should not be blank.");
if (!ValidLength(d.maillist_email.value,1))error(d.maillist_email,"Email Address should not be blank.");
if (!ValidEmail(d.maillist_email.value))error(d.maillist_email,"Please enter a valid email address ex. test@example.com");
return !errfound;
}
</script>
<%Sub Maillist()
dim todo,action,maillist_name,maillist_email,smumquery1,chkerror,adderror,message
if not application("smumdebugmode") then on error resume next
action = request("action")
todo = Request("todo")
maillist_name = smFixer(request("maillist_name"))
maillist_email = smFixer(smChecknull("Your Email", request("maillist_email"), chkerror))
if todo = "" then
smumFormAction "<form action="""&smumpage&"?action=maillist"" method=post name=maillist language=""JAVASCRIPT"" onsubmit=""return Validate();"">"
smumFormHiddenField "todo","add"
smumFormOpenTable
smumFormHeader "Subscribe/UnSubscribe to the Mailing List"
smumFormFields "Name","<input class=fieldbox type=text size=30 name=maillist_name>"
smumFormFields "Email Address","<input class=fieldbox type=text maxlength=255 size=30 name=maillist_email>"
smumFormButtons "<input class=fieldbox type=submit value=""Subscribe/Unsubscribe"" name=submit>"
smumFormCloseTable
smumFormClose
elseif todo = "add" then
smumquery1 = "select maillist_email from smum_maillisttbl where maillist_email = '"& maillist_email &"'"
smumOpenrs smumquery1,"smumrs",action
if smumrs.eof then maillist_name = smFixer(smChecknull("Your Name", maillist_name, chkerror))
smumClosers(smumrs)
if chkerror <> "" then adderror = "<b>Errors in Adding to the mailing list. Please resubmit the form.</b> <bR>• "& left(chkerror, (len(chkerror)-2)) & " should not be blank."
if maillist_email <> "" then
if chkemail(maillist_email) = 1 then adderror = adderror & " • Invalid Email Id."
end if
if adderror = "" then
smumquery1 = "select * from smum_maillisttbl where maillist_email = '"&maillist_email&"'"
smumOpenrs smumquery1,"smumrs",action
if smumrs.eof then
smumquery = "insert into smum_maillisttbl (maillist_name,maillist_email) values ('"&maillist_name&"','"&maillist_email&"')"
smumexecutequery smumquery,action
message = Application("smummaillistsubscribe")
else
smumquery = "delete from smum_maillisttbl where maillist_id = "& smumrs("maillist_id")
smumexecutequery smumquery,action
message = Application("smummaillistunsubscribe")
end if
smumClosers(smumrs)
smumFormOpenTable
smumFormHeader "Subscribe/UnSubscribe to the Mailing List"
smumFormResponse message
smumFormCloseTable
else
smumFormAction "<form action="""&smumpage&"?action=maillist"" method=post name=maillist language=""JAVASCRIPT"" onsubmit=""return Validate();"">"
smumFormHiddenField "todo","add"
smumFormOpenTable
smumFormHeader "Subscribe/UnSubscribe to the Mailing List"
smumFormResponseCol adderror
smumFormFields "Name","<input class=fieldbox type=text size=30 name=maillist_name value="""&maillist_name&""">"
smumFormFields "Email Address","<input class=fieldbox type=text maxlength=255 size=30 name=maillist_email value="""&maillist_email&""">"
smumFormButtons "<input class=fieldbox type=submit value=""Subscribe/Unsubscribe"" name=submit>"
smumFormCloseTable
smumFormClose
end if
end if
End Sub%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -