📄 admin_register.asp
字号:
Else
strEncryptedPassword = strPassword
End If
End If
'Intialise the strSQL variable with an SQL string to open a record set for the Author table
strSQL = "SELECT " & strDbTable & "Author.Author_ID, " & strDbTable & "Author.Group_ID, " & strDbTable & "Author.Username, " & strDbTable & "Author.Real_name, " & strDbTable & "Author.Gender, " & strDbTable & "Author.User_code, " & strDbTable & "Author.Password, " & strDbTable & "Author.Salt, " & strDbTable & "Author.Author_email, " & strDbTable & "Author.Homepage, " & strDbTable & "Author.Location, " & strDbTable & "Author.MSN, " & strDbTable & "Author.Yahoo, " & strDbTable & "Author.ICQ, " & strDbTable & "Author.AIM, " & strDbTable & "Author.Occupation, " & strDbTable & "Author.Interests, " & strDbTable & "Author.DOB, " & strDbTable & "Author.Signature, " & strDbTable & "Author.No_of_posts, " & strDbTable & "Author.No_of_PM, " & strDbTable & "Author.Join_date, " & strDbTable & "Author.Avatar, " & strDbTable & "Author.Avatar_title, " & strDbTable & "Author.Last_visit, " & strDbTable & "Author.Time_offset, " & strDbTable & "Author.Time_offset_hours, " & strDbTable & "Author.Date_format, " & strDbTable & "Author.Show_email, " & strDbTable & "Author.Attach_signature, " & strDbTable & "Author.Active, " & strDbTable & "Author.Rich_editor, " & strDbTable & "Author.Reply_notify, " & strDbTable & "Author.PM_notify, " & strDbTable & "Author.Skype, " & strDbTable & "Author.Login_attempt, " & strDbTable & "Author.Banned, " & strDbTable & "Author.Info, " & strDbTable & "Author.Newsletter " &_
"FROM " & strDbTable & "Author" & strRowLock & " " & _
"WHERE " & strDbTable & "Author.Author_ID = " & lngUserProfileID & ";"
'Set the cursor type property of the record set to Dynamic so we can navigate through the record set
rsCommon.CursorType = 2
'Set the Lock Type for the records so that the record set is only locked when it is updated
rsCommon.LockType = 3
'Open the author table
rsCommon.Open strSQL, adoCon
'******************************************
'*** Update datbase ***
'******************************************
'If this is new reg and the username and email is OK or this is an update then register the new user or update the rs
If blnUsernameOK Then
'Insert the user's details into the rs
With rsCommon
'If not an edit then addnew
If strMode <> "edit" Then .AddNew
'Don't update username is member API is enabled
If blnMemberAPI = False Then .Fields("Username") = strUsername
.Fields("Group_ID") = intUsersGroupID
'If new undate the fields below
If strMode = "new" Then
.Fields("Join_date") = internationalDateTime(Now())
.Fields("Last_visit") = internationalDateTime(Now())
End If
'If the password has changed update it
If strPassword <> "" Then
.Fields("Password") = strEncryptedPassword
.Fields("Salt") = strSalt
End If
'Don't update user code filed is windows authentication is enabeld
If blnWindowsAuthentication = False Then .Fields("User_code") = strUserCode
.Fields("Author_email") = strEmail
.Fields("Real_name") = strRealName
.Fields("Gender") = strGender
.Fields("Avatar") = strAvatar
.Fields("Homepage") = strHomepage
.Fields("Signature") = strSignature
.Fields("Attach_signature") = blnAttachSignature
.Fields("Date_format") = strDateFormat
.Fields("Time_offset") = strTimeOffSet
.Fields("Time_offset_hours") = intTimeOffSet
.Fields("Reply_notify") = blnReplyNotify
.Fields("Rich_editor") = blnWYSIWYGEditor
.Fields("PM_notify") = blnPMNotify
.Fields("Show_email") = blnShowEmail
If blnWebWizNewsPad Then .Fields("Newsletter") = blnNewsletter
'Admin bits
.Fields("Active") = blnUserActive
.Fields("Avatar_title") = strMemberTitle
.Fields("No_of_posts") = lngPosts
.Fields("Banned") = blnSuspended
.Fields("Info") = strAdminNotes
'Update the database with the new user's details (needed for MS Access which can be slow updating)
.Update
'Re-run the query to read in the updated recordset from the database
.Requery
End With
'******************************************
'*** Clean up ***
'******************************************
'Reset server Object
rsCommon.Close
Call closeDatabase()
'******************************************
'*** Redirect to message page ***
'******************************************
'Redirect the welcome new user page
Response.Redirect("admin_added_member.asp?M=" & strMode & strQsSID3)
End If
rsCommon.Close
End If
'******************************************
'*** Get the user details from db ***
'******************************************
'If this is a profile update get the users details to update
If strMode = "edit" Then
'Read the various forums from the database
'Initalise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT " & strDbTable & "Author.* " & _
"FROM " & strDbTable & "Author" & strDBNoLock & " " & _
"WHERE " & strDbTable & "Author.Author_ID = " & lngUserProfileID
'Query the database
rsCommon.Open strSQL, adoCon
'If there is no matching profile returned by the recordset then redirect the user to the main forum page
If rsCommon.EOF Then
'Reset server Object
rsCommon.Close
Call closeDatabase()
Response.Redirect("default.asp" & strQsSID1)
End If
'Read in the new user's profile from the recordset
strUsername = rsCommon("Username")
strRealName = rsCommon("Real_name")
strGender = rsCommon("Gender")
If NOT isNull(rsCommon("Author_email")) Then strEmail = formatInput(rsCommon("Author_email"))
If blnWebWizNewsPad Then blnNewsletter = CBool(rsCommon("Newsletter"))
blnShowEmail = CBool(rsCommon("Show_email"))
If NOT isNull(rsCommon("Homepage")) Then strHomepage = formatInput(rsCommon("Homepage"))
strSignature = rsCommon("Signature")
strAvatar = rsCommon("Avatar")
strMemberTitle = rsCommon("Avatar_title")
strDateFormat = rsCommon("Date_format")
strTimeOffSet = rsCommon("Time_offset")
intTimeOffSet = CInt(rsCommon("Time_offset_hours"))
blnReplyNotify = CBool(rsCommon("Reply_notify"))
blnAttachSignature = CBool(rsCommon("Attach_signature"))
blnWYSIWYGEditor = CBool(rsCommon("Rich_editor"))
blnPMNotify = CBool(rsCommon("PM_notify"))
intUsersGroupID = CInt(rsCommon("Group_ID"))
blnUserActive = CBool(rsCommon("Active"))
lngPosts = CLng(rsCommon("No_of_posts"))
blnSuspended = CBool(rsCommon("Banned"))
strAdminNotes = rsCommon("Info")
'Reset Server Objects
rsCommon.Close
End If
'Covert the signature back to forum codes
If strSignature <> "" Then strSignature = EditPostConvertion(strSignature)
%>
<!-- #include file="includes/browser_page_encoding_inc.asp" -->
<meta name="generator" content="Web Wiz Forums" />
<title><% If strMode = "edit" Then Response.Write("Update Member") Else Response.Write("Register New User") %></title>
<%
'***** START WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******
Response.Write("<!--//" & _
vbCrLf & "/* *******************************************************" & _
vbCrLf & "Software: Web Wiz Forums(TM) ver. " & strVersion & "" & _
vbCrLf & "Info: http://www.webwizforums.com" & _
vbCrLf & "Copyright: (C)2001-2008 Web Wiz(TM). All rights reserved" & _
vbCrLf & "******************************************************* */" & _
vbCrLf & "//-->" & vbCrLf & vbCrLf)
'***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ******
%>
<!-- Check the from is filled in correctly before submitting -->
<script language="JavaScript" type="text/javascript">
//Function to check form is filled in correctly before submitting
function CheckForm () {
//Initialise variables
var errorMsg = "";
var errorMsgLong = "";
//Check for a username
if (document.frmRegister.name1.value.length < 2){
errorMsg += "\n\tUsername \t- Your Username must be at least 2 characters";
}<%
'If not in edit mode
If strMode <> "edit" Then
%>
//Check for a password
if (document.frmRegister.password1.value.length <= 3){
errorMsg += "\n\tPassword \t- Your Password must be at least 4 characters";
}
//Check both passwords are the same
if ((document.frmRegister.password1.value) != (document.frmRegister.password2.value)){
errorMsg += "\n\tPassword Error\t- The passwords entered do not match";
document.frmRegister.password1.value = ""
document.frmRegister.password2.value = ""
}<%
'If this is an update only check the password length if the user is enetring a new password
ElseIf strMode <> "edit" and blnWindowsAuthentication = False Then
%>
//Check for a password
if ((formArea.password1.value.length <= 3) && (formArea.password1.value.length > 0)){
errorMsg += "\n\t<% = strTxtErrorPasswordChar %>";
}<%
End If
%>
//If an e-mail is entered check that the e-mail address is valid
if (document.frmRegister.email.value.length >0 && (document.frmRegister.email.value.indexOf("@",0) == -1||document.frmRegister.email.value.indexOf(".",0) == -1)) {
errorMsg +="\n\tEmail\t\t- Enter your valid email address";
errorMsgLong += "\n- If you don't want to enter your email address then leave the email field blank";
}
//Check to make sure the user is not trying to show their email if they have not entered one
if (document.frmRegister.email.value == "" && document.frmRegister.emailShow[0].checked == true){
errorMsgLong += "\n- You can not show your email address if you haven\'t entered one!";
document.frmRegister.emailShow[1].checked = true
document.frmRegister.email.focus();
}
//Check that the signature is not above 200 chracters
if (document.frmRegister.signature.value.length > 200){
errorMsg += "\n\tSignature \t- Your signature has to many characters";
errorMsgLong += "\n- You have " + document.frmRegister.signature.value.length + " characters in your signature, you must shorten it to below 200";
}
//If there is aproblem with the form then display an error
if ((errorMsg != "") || (errorMsgLong != "")){
msg = "_______________________________________________________________\n\n";
msg += "The form has not been submitted because there are problem(s) with the form.\n";
msg += "Please correct the problem(s) and re-submit the form.\n";
msg += "_______________________________________________________________\n\n";
msg += "The following field(s) need to be corrected: -\n";
errorMsg += alert(msg + errorMsg + "\n" + errorMsgLong);
return false;
}
//Reset the submition action
document.frmRegister.action = "admin_register.asp<% = strQsSID1 %>"
document.frmRegister.target = "_self";
return true;
}
//Function to count the number of characters in the signature text box
function DescriptionCharCount() {
document.frmRegister.countcharacters.value = document.frmRegister.signature.value.length;
}
//Function to open pop up window
function winOpener(theURL, winName, scrollbars, resizable, width, height) {
winFeatures = 'left=' + (screen.availWidth-10-width)/2 + ',top=' + (screen.availHeight-30-height)/2 + ',scrollbars=' + scrollbars + ',resizable=' + resizable + ',width=' + width + ',height=' + height + ',toolbar=0,location=0,status=1,menubar=0'
window.open(theURL, winName, winFeatures);
}
//Function to open preview post window
function OpenPreviewWindow(targetPage, formName){
now = new Date
//Open the window first
winOpener('','preview',1,1,680,400)
//Now submit form to the new window
formName.action = targetPage + "?ID=" + now.getTime();
formName.target = "preview";
formName.submit();
}
//Function to count characters in textarea
function characterCounter(charNoBox, textFeild) {
document.getElementById(charNoBox).value = document.getElementById(textFeild).value.length;
}
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -