%
Dim Last, Email, passcom, checkbox, objRS, First, Mem, Login, Password, objCom, regType
Dim signature, homepage, regProblem, regText,candorc4
if request.querystring("do") <> "reapprove" then
if not fromThisDomain("register.asp") then
response.redirect (forumdir&"first.asp?error=referer")
response.end
end if
if request.form("jsenabled")="false" then
response.redirect (forumdir&"first.asp")
response.end
end if
regProblem = false
' Dim item
' for each item in request.form
' response.write "Dim "&item&":"&item&" = request.form("""&item&""")&""""
"
' next
' Call pgdform("reg_",false)
' response.end
Login = trim(request.form("login")):Login = replace(SQLStrip(Login),",","")
First = request.form("fname")
Last = request.form("lname")
Email = trim(request.form("email")):Email=left(""&Email,50)
homepage = request.form("homepage")
signature = request.form("signature")
password = trim(request.form("password"))
passcom = trim(request.form("passcom"))
checkbox = request.form("checkbox")
regType = Application(dbName&"regType")
if len(Login) = 0 or len(Email) = 0 then
regProblem = true
regText = profAllFieldReq
''response.end
end if
if regType = 0 then
if (len(password) = 0 or len(passcom) = 0) then
regProblem = true
regText = profAllFieldReq
''response.end
end if
if password<>passcom then
regProblem = true
regText = profPassNotMatch
'response.end
end if
else
password = rndPasswd(11)
end if
if isNumeric(Login) then
regProblem = true
regText = regLoginWarning
'response.end
end if
if len(replace(homepage,"http://","")) = 0 then homepage = ""
Dim status, tempPass
tempPass = rndPasswd(5)
if not regProblem then
set objCom = server.createobject("adodb.command")
with objCom
.activeconnection = datastore
.commandText = dbOwnerPrefix&"spRegister"
.commandType = adCmdStoredProc
.Parameters.Append .Createparameter("@RETURN_VALUE", adInteger, adParamReturnValue)
.Parameters.Append .Createparameter("@tempPass", adVarChar, adParamInput, 50, tempPass)
.Parameters.Append .Createparameter("@Userpass", adVarChar, adParamInput, 50, password)
.Parameters.Append .Createparameter("@Login", adVarChar, adParamInput, 50, Login)
.Parameters.Append .Createparameter("@Fname", adVarChar, adParamInput, 50, left(""&First,50))
.Parameters.Append .Createparameter("@Lname", adVarChar, adParamInput, 50, left(""&Last,50))
.Parameters.Append .Createparameter("@Email", adVarChar, adParamInput, 50, Email)
.Parameters.Append .Createparameter("@homepage", adVarChar, adParamInput, 50, left(""&homepage,50))
.Parameters.Append .Createparameter("@signature", adVarChar, adParamInput, 255, left(""&signature,255))
.Parameters.Append .Createparameter("@ip", adVarChar, adParamInput, 50, Request.ServerVariables("REMOTE_ADDR"))
.Parameters.Append .Createparameter("@viewpref", adUnsignedTinyInt, adParamInput, 0, memViewPref)
.Parameters.Append .Createparameter("@regStatus", adUnsignedTinyInt, adParamInput, 0, regType)
.Parameters.Append .Createparameter("@memberID", adInteger, adParamOutput, 0 )
.execute , , adExecuteNoRecords
status = .Parameters("@RETURN_VALUE")
Dim newMemID:newMemID = .Parameters("@memberID")
end with
set objCom = nothing
end if
if status = 1 then
regProblem = true
regText = regEmailLoginChosen
'response.end
end if
if checkbox="on" then
call setAutoCookies(Login, password)
end if
if not regProblem then
'*** new code for additional fields
Dim fldCount:fldCount = cInt(request.form("fldCount"))
if fldCount>0 then
Dim formClass
Dim arrFields(), arrValues()
Redim arrFields(fldCount) : Redim arrValues(fldCount)
arrFields(0)="Mem":arrValues(0)=newMemId
Dim iFld:iFld = 1
for each formClass in request.form
if left(formClass,4)= "fld_" or left(formClass,4)= "lfld" then
arrFields(iFld) = formClass
arrValues(iFld) = iff(len(""&request.form(formClass)), trim(request.form(formClass)&""),"")
iFld = iFld + 1
end if
next
set objRS = server.createobject("adodb.recordset")
with objRS
.open "SELECT * FROM pgd_regFields WHERE (0=1)", datastore, adOpenDynamic, adLockOptimistic, adCmdText
.AddNew arrFields, arrValues
.close
end with
set objRS=nothing
end if
'*** new code for additional fields
Dim senderE,senderN,mailTo,mailCC,mailBCC,subject, arrBody
SELECT CASE regType
Case 0
Application.lock
Application(dbName&"totalMem") = Application(dbName&"totalMem")+1
Application.unlock
call SendLoginPassword(login, Email, password)
regText = regNoRestrictResponse
Case 1 'simple e-mail confirmation
Dim Body
call confirmResend (Email,1)
call SendLoginPassword(login, Email, password)
regText = regEmailResponse
Case 2 'Admin Approval Required
call confirmResend (Email,2)
regText = regAdminResponse
End SELECT
end if
else
regText = regReApproveResponse
end if
%>
<%= Application(dbName&"forumtitle") %>
<%= OutputCSS() %>
>
<% call headerHTML() %>
<% call footerHTML() %>