📄 register.asp
字号:
<%'=========================================
'ScriptMate User Manager Version 2.1
'Copyright 2001 (C) ScriptMate.Com
'User Module
'This module helps in registration of a member
'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.register
<%if checkfirstname then%>if (!ValidLength(d.members_firstname.value,1)) error(d.members_firstname,"First Name should not be blank.");<%end if%>
<%if checklastname then%>if (!ValidLength(d.members_lastname.value,1)) error(d.members_lastname,"Last Name should not be blank.");<%end if%>
if (!ValidLength(d.members_username.value,6))error(d.members_username,"User Name should contain atleast 6 characters.");
if (!ValidLength(d.members_password.value,6))error(d.members_password,"Password should contain atleast 6 characters.");
if (!ValidLength(d.confirmpassword.value,6))error(d.confirmpassword,"Confirm Password should contain atleast 6 characters.");
<%if checkaddress then%>if (!ValidLength(d.members_address.value,1))error(d.members_address,"Address should not be blank.");<%end if%>
<%if checkcity then%>if (!ValidLength(d.members_city.value,1))error(d.members_city,"City should not be blank.");<%end if%>
<%if checkstate then%>if (!ValidLength(d.members_state.value,1))error(d.members_state,"State should not be blank.");<%end if%>
<%if checkcountry then%>if (!ValidLength(d.members_country.value,1))error(d.members_country,"Country should not be blank.");<%end if%>
<%if CheckEmail then%>if (!ValidLength(d.members_email.value,1))error(d.members_email,"Email should not be blank.");<%end if%>
<%if Application("smumvalidateemail") and CheckEmail then%>if (!ValidEmail(d.members_email.value))error(d.members_email,"Invalid email address.");<%end if%>
<%if checkphone then%>if (!ValidLength(d.members_phone.value,1))error(d.members_phone,"Phone should not be blank.");<%end if%>
<%if checkzip then%>if (!ValidLength(d.members_zip.value,1))error(d.members_zip,"Zip should not be blank.");<%end if%>
<%if checknotes then%>if (!ValidLength(d.members_notes.value,1))error(d.members_notes,"Notes should not be blank.");<%end if%>
<%if checkfield1 then%>if (!ValidLength(d.members_field1.value,1))error(d.members_field1,"<%=smumgetfieldname(1)%> should not be blank.");<%end if%>
<%if checkfield2 then%>if (!ValidLength(d.members_field2.value,1))error(d.members_field2,"<%=smumgetfieldname(2)%> should not be blank.");<%end if%>
<%if checkfield3 then%>if (!ValidLength(d.members_field3.value,1))error(d.members_field3,"<%=smumgetfieldname(3)%> should not be blank.");<%end if%>
<%if checkfield4 then%>if (!ValidLength(d.members_field4.value,1))error(d.members_field4,"<%=smumgetfieldname(4)%> should not be blank.");<%end if%>
<%if checkfield5 then%>if (!ValidLength(d.members_field5.value,1))error(d.members_field5,"<%=smumgetfieldname(5)%> should not be blank.");<%end if%>
<%if checkfield6 then%>if (!ValidLength(d.members_field6.value,1))error(d.members_field6,"<%=smumgetfieldname(6)%> should not be blank.");<%end if%>
<%if checkfield7 then%>if (!ValidLength(d.members_field7.value,1))error(d.members_field7,"<%=smumgetfieldname(7)%> should not be blank.");<%end if%>
<%if checkfield8 then%>if (!ValidLength(d.members_field8.value,1))error(d.members_field8,"<%=smumgetfieldname(8)%> should not be blank.");<%end if%>
<%if checkfield9 then%>if (!ValidLength(d.members_field9.value,1))error(d.members_field9,"<%=smumgetfieldname(9)%> should not be blank.");<%end if%>
<%if checkfield10 then%>if (!ValidLength(d.members_field10.value,1))error(d.members_field10,"<%=smumgetfieldname(10)%> should not be blank.");<%end if%>
return !errfound;
}
</script>
<%Sub Register()
dim action,emailactivaetion,rid,todo,members_username,members_password,confirmpassword,chkerror,i,adderror,smum_groupstbl,members_id,messagebody,subject,result,tempid,orderid,smumquery,smumregredirect,smumgroups,email,firstname
if not Application("smumdebugmode") then on error resume next
action = request("action")
todo = Request("todo")
members_username = smFixer(smChecknull("Username", request("members_username"), chkerror))
members_password = smFixer(smChecknull("Password", request("members_password"), chkerror))
confirmpassword = smFixer(smChecknull("Confirm Password", request("confirmpassword"), chkerror))
smumdisplayform checkfirstname,"members_firstname","First Name"
smumdisplayform checklastname,"members_lastname","Last Name"
smumdisplayform checkaddress,"members_address","Address"
smumdisplayform checkcity,"members_city","City"
smumdisplayform checkstate,"members_state","State"
smumdisplayform checkcountry,"members_country","Country"
smumdisplayform CheckEmail,"members_email","Email"
smumdisplayform checkphone,"members_phone","Phone"
smumdisplayform checkzip,"members_zip","Zip"
smumdisplayform checknotes,"members_notes","Notes"
smumdisplayform checkfield1,"members_field1",smumgetfieldname(1)
smumdisplayform checkfield2,"members_field2",smumgetfieldname(2)
smumdisplayform checkfield3,"members_field3",smumgetfieldname(3)
smumdisplayform checkfield4,"members_field4",smumgetfieldname(4)
smumdisplayform checkfield5,"members_field5",smumgetfieldname(5)
smumdisplayform checkfield6,"members_field6",smumgetfieldname(6)
smumdisplayform checkfield7,"members_field7",smumgetfieldname(7)
smumdisplayform checkfield8,"members_field8",smumgetfieldname(8)
smumdisplayform checkfield9,"members_field9",smumgetfieldname(9)
smumdisplayform checkfield10,"members_field10",smumgetfieldname(10)
if todo = "" then
smumFormAction "<form action="""&smumpage&"?action=register"" method=post name=register language=""JAVASCRIPT"" onsubmit=""return Validate();"">"
smumFormHiddenField "todo","register"
smumFormOpenTable
smumFormHeader "Order Form</b> (<font class=textsize8><img src=/smusermanager/images/redicon.gif border=0> Mandatory <img src=/smusermanager/images/greenicon.gif border=0> Optional)"
if showfield3 then smumFormFields smumgetfieldname(3) &members_field3text,"<select class=fieldbox name=members_field3><option value=Monthly>$9 Monthly Plan</option><option value=Annually>$75 Annually Plan</option></select>"
if showfield1 then smumFormFields smumgetfieldname(1) &members_field1text,"<input class=fieldbox type=text size=35 name=members_field1>"
if showfirstname then smumFormFields "First Name"&members_firstnametext,"<input class=fieldbox type=text size=35 name=members_firstname>"
if showlastname then smumFormFields "Last Name"&members_lastnametext,"<input class=fieldbox type=text size=35 name=members_lastname>"
smumFormFields "User Name <img src=/smusermanager/images/redicon.gif border=0>","<input class=fieldbox type=text size=35 name=members_username>"
smumFormFields "Password <img src=/smusermanager/images/redicon.gif border=0>","<input class=fieldbox type=password size=35 name=members_password>"
smumFormFields "Confirm Password <img src=/smusermanager/images/redicon.gif border=0>","<input class=fieldbox type=password size=35 name=confirmpassword>"
if showaddress then smumFormFields "Address"&members_addresstext,"<input class=fieldbox type=text size=35 name=members_address>"
if showcity then smumFormFields "City"&members_citytext,"<input class=fieldbox type=text size=35 name=members_city>"
if showstate then smumFormFields "State"&members_statetext,"<input class=fieldbox type=text size=35 name=members_state>"
if showcountry then smumFormFields "Country"&members_countrytext,"<input class=fieldbox type=text size=35 name=members_country>"
if showemail then smumFormFields "Email"&members_emailtext,"<input class=fieldbox type=text size=35 name=members_email>"
if showphone then smumFormFields "Phone"&members_phonetext,"<input class=fieldbox type=text size=35 name=members_phone>"
if showzip then smumFormFields "Zip"&members_ziptext,"<input class=fieldbox type=text size=35 name=members_zip>"
if shownotes then smumFormFields "Notes or Remarks"&members_notestext,"<textarea class=fieldbox rows=5 cols=35 name=members_notes></textarea>"
if showfield2 then smumFormFields smumgetfieldname(2) &members_field2text,"<input class=fieldbox type=text size=35 name=members_field2>"
if showfield4 then smumFormFields smumgetfieldname(4) &members_field4text,"<input class=fieldbox type=text size=35 name=members_field4>"
if showfield5 then smumFormFields smumgetfieldname(5) &members_field5text,"<input class=fieldbox type=text size=35 name=members_field5>"
if showfield6 then smumFormFields smumgetfieldname(6) &members_field6text,"<input class=fieldbox type=text size=35 name=members_field6>"
if showfield7 then smumFormFields smumgetfieldname(7) &members_field7text,"<input class=fieldbox type=text size=35 name=members_field7>"
if showfield8 then smumFormFields smumgetfieldname(8) &members_field8text,"<input class=fieldbox type=text size=35 name=members_field8>"
if showfield9 then smumFormFields smumgetfieldname(9) &members_field9text,"<input class=fieldbox type=text size=35 name=members_field9>"
if showfield10 then smumFormFields smumgetfieldname(10) &members_field10text,"<input class=fieldbox type=text size=35 name=members_field10>"
smumFormButtons "<input class=fieldbox type=submit value=""Register"" name=submit>"
smumFormCloseTable
smumFormClose
elseif todo = "register" then
smumquery = "select members_username from smum_memberstbl where members_username = '" & members_username & "'"
smumOpenrs smumquery,"smumrs",action
if smumrs.eof then
else
adderror = "error occured"
smJSalert("The User Name - "& members_username &" is being used by an existing members. Please choose another username.")
end if
smumClosers(smumrs)
if members_password = "" or confirmpassword = "" then
else
if members_password <> confirmpassword then
adderror = "error occured"
smJSalert("Password and Confirm Password should match. Please check them.")
end if
end if
if members_email <> "" then
if Application("smumcheckduplicateemailids") then
smumquery = "select members_email from smum_memberstbl where members_email = '" & members_email & "'"
smumOpenrs smumquery,"smumrs",action
if smumrs.eof and smumrs.bof then
else
adderror = "error occured"
smJSalert("A Member with "& members_email &" is already registered with us. Please enter another email id.")
end if
smumClosers(smumrs)
end if
if Application("smumcheckblockedemailids")then
smumquery = "select bei_email from smum_blockedemailidstbl where bei_email = '" & members_email & "'"
smumOpenrs smumquery,"smumrs",action
if smumrs.eof and smumrs.bof then
else
adderror = "error occured"
smJSalert(members_email &" has been blocked from registering with us.")
end if
smumClosers(smumrs)
end if
end if
if adderror = "" then
if useractive = "" then
useractive = smumfalse
else
if useractive then
useractive = smumtrue
else
useractive = smumfalse
end if
end if
if emailactivation then useractive = smumfalse
if useradmin = "" then
useradmin = smumfalse
else
if useradmin then
useradmin = smumtrue
else
useradmin = smumfalse
end if
end if
if useraccesslevel = "" then useraccesslevel = 1
if userexpirydate <> "" then
userexpirydate = smumdatechar&userexpirydate&smumdatechar
else
userexpirydate = smumdatechar&"1/1/9000"&smumdatechar
end if
smumquery = "insert into smum_memberstbl (members_firstname, members_lastname, members_username, members_password, members_notes, members_address, members_city, members_state, members_country, members_email, members_phone, members_zip, members_expirydate, members_accesslevel, members_active, members_admin, members_field1, members_field2, members_field3, members_field4, members_field5, members_field6, members_field7, members_field8, members_field9, members_field10) values ('"&members_firstname&"','"&members_lastname&"','"&members_username&"','"&members_password&"','"&members_notes&"','"&members_address&"','"&members_city&"','"&members_state&"','"&members_country&"','"&members_email&"','"&members_phone&"','"&members_zip&"',"&userexpirydate&","&useraccesslevel&","&useractive&","&useradmin&",'"&members_field1&"','"&members_field2&"','"&members_field3&"','"&members_field4&"','"&members_field5&"','"&members_field6&"','"&members_field7&"','"&members_field8&"','"&members_field9&"','"&members_field10&"')"
smumexecutequery smumquery,action
smumquery = "select * from smum_memberstbl where members_username ='"& members_username &"'"
smumOpenrs smumquery,"smumrs1",action
if not smumrs1.eof then
if smumgroups <> "" then call smumregroup(smumgroups,members_username)
members_id = smumrs1("members_id")
members_email = smumrs1("members_email")
members_firstname = smumrs1("members_firstname")
messagebody = convertmes(Application("smummesregistermailcontent"), members_id)
subject = Application("smumregistermailsubject")
if emailactivation then
rid = (members_id * 224)/2
messagebody = replace(messagebody,"#$link$#","http://"&application("smumwebsite")& smumpage & "?action=activate&rid="&rid)
end if
result = sendmail(Application("smumadminemail"), members_email, Application("smumadminname"), members_firstname, Application("smummailserver"), subject, messagebody, Application("smummailcomponent"))
if application("smumregisternotification") then
messagebody = convertmes(Application("smummesadminmailcontent"), members_id)
subject = Application("smummesadminmailsubject")
result = sendmail("newmember@mysite.com", Application("smumadminemail"), "New Member Signup", Application("smumadminname"), Application("smummailserver"), subject, messagebody, Application("smummailcomponent"))
end if
end if
smumClosers(smumrs1)
if smumregredirect <> "" then Response.Redirect smumregredirect
if smumregmessage = "" then smumregmessage = "You have been registered with us."
smumFormOpenTable
smumFormHeader "Registration"
smumFormResponse smumregmessage
smumFormCloseTable
end if
end if
End Sub%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -