|
Hi!
What to do and how whit the script?Step by step please.
Can you help me?Here is my register.asp script.
<% dim xxxxm, rsheadUpdatee, rsheadUpdatee_numRows Dim textfield, textfield3, textfield4, textfield5, textfield6, textfield7, textfield8, textfield9, textfield10, textfield11, checkbox, SAVECOOKIES, rsup, rsup_numRows, textfield2, ipaddy, thequery, p_id, rsdup, rsdup_numRows, MM_editAction
Function sqlsafe(s) pos = InStr(s, "'") While pos > 0 s = Mid(s, 1, pos) & "'" & Mid(s, pos + 1) pos = InStr(pos + 2, s, "'") Wend sqlsafe=s End Function
if request.form("MM_insert") = "true" then
textfield = request.form("textfield")
set rsdup = Server.CreateObject("ADODB.Recordset") rsdup.ActiveConnection = MM_conn_STRING rsdup.Source = "SELECT p_user FROM p_users WHERE p_user = '" + Replace(textfield, "'", "''") + "'" rsdup.CursorType = 0 rsdup.CursorLocation = 2 rsdup.LockType = 3 rsdup.Open() rsdup_numRows = 0
if NOT request.form("textfield2") = request.form("textfield12") then message = 53 rsdup.close set rsdup = nothing
elseif ucase(request("textfield")) = ucase("Administration") Then message = 54 rsdup.close set rsdup = nothing
elseif ucase(request("textfield")) = ucase("Admin") Then message = 54 rsdup.close set rsdup = nothing
elseif NOT rsdup.EOF And NOT rsdup.BOF then message = 52 rsdup.close set rsdup = nothing
elseif request.form("textfield2") = request.form("textfield12") AND rsdup.EOF And rsdup.BOF AND NOT ucase(request("textfield")) = ucase("Administration") AND NOT ucase(request("textfield")) = ucase("Admin") Then
textfield2 = request.form("textfield2") textfield3 = request.form("textfield3") textfield4 = request.form("textfield4") textfield5 = request.form("textfield5") textfield6 = request.form("textfield6") textfield7 = request.form("textfield7") textfield8 = request.form("textfield8") textfield9 = request.form("textfield9") textfield10 = request.form("textfield10") textfield11 = request.form("textfield11") checkbox = request.form("checkbox") ipaddy = Request.ServerVariables("REMOTE_ADDR")
If rsdup.EOF And rsdup.BOF Then
if request.form("SAVECOOKIES") = "yes" then Response.Buffer = True
' This script handles both the adding and deleting of cookies Dim strCookieName ' id Dim strCookiePass ' pass Dim strCookieValue ' The value to be assigned to it Dim strCookieValue2 ' The value to be assigned to it
' Get the values passed in by the other script strCookieName = "id" strCookiePass = "access" strCookieValue = request.form("textfield") strCookieValue2 = request.form("textfield2")
' If no name is passed in then we don't do anything If strCookieName <> "" AND strCookiePass <> "" Then
If strCookieValue <> "" AND strCookieValue2 <> ""Then Response.Cookies(strCookiePass) = strCookieValue2 Response.Cookies(strCookiePass).Expires = Date() + 365
Response.Cookies(strCookieName) = strCookieValue Response.Cookies(strCookieName).Expires = Date() + 365
End If End If
ElseIf request.form("SAVECOOKIES") <> "yes" then Response.Cookies("id") = "$" Response.Cookies("id").Expires = Date() + 1
Response.Cookies("access") = "$" Response.Cookies("access").Expires = Date() + 1 end if Session.Abandon
Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open MM_conn_STRING sql1 = "insert into p_users (p_user,p_password,p_state,p_first,p_last,p_email,p_phone,p_fax,p_address,p_city,p_zip,p_newsletter,p_ip) values('"& sqlsafe(textfield) & "','"& sqlsafe(textfield2) & "','"& textfield3 & "','"& sqlsafe(textfield4) & "','"& sqlsafe(textfield5) & "','"& sqlsafe(textfield6) & "','"& sqlsafe(textfield7) & "','"& sqlsafe(textfield8) & "','"& sqlsafe(textfield9) & "','"& sqlsafe(textfield10) & "','"& sqlsafe(textfield11) & "','"& checkbox & "','"& sqlsafe(ipaddy) & "')" conn.execute(sql1)
SQL1 = "SELECT p_id FROM p_users WHERE p_user = '" + Replace(textfield, "'", "''") + "'" Set rsReg = conn.execute(sql1) p_id = rsReg("p_id")
Dim objCDO Set objCDO = Server.CreateObject("CDONTS.NewMail") body = "Hej " & textfield4 & (" ") & textfield5 & vbCrLf & vbCrLf body = body & "Din användarnamn är: " & textfield & vbCrLf body = body & "Ditt lösenord är: " & textfield2 & vbCrLf & vbCrLf body = body & "Din aktivation nummer är: " & p_id & vbCrLf & vbCrLf body = body & "Du har 24 timmar på dig att aktivera ditt konto annars din registration tas bort. Använd länken för ditt konto aktivering. " & vbCrLf & vbCrLf body = body & weburl & "activate.asp?activate=" & p_id & vbCrLf objCDO.To = textfield6 objCDO.From = websitename & " < " & webemail & (" >") objCDO.Subject = "Aktivera ditt konto!" objCDO.Body = body objCDO.Send() Set objCDO = Nothing rsdup.close set rsdup = nothing conn.close set conn = nothing MM_conn_STRING.close set MM_conn_STRING = nothing set SQL = nothing set rsReg = nothing
SAVECOOKIES = request.form("SAVECOOKIES") response.redirect("activate.asp?message=14&f=" & textfield4 & ("&l=") & textfield5 & ("&e=") & textfield6 & ("&c=") & SAVECOOKIES) end if end if
end if %>
<!--#include file="header.asp"--> <script language="JavaScript"> <!-- Hide from older browsers...
//Function to check that the form is filled in correctly function CheckForm () {
//Check User id if (document.form1.textfield.value == ""){ alert("Ange medlemsid"); document.form1.textfield.focus(); return false; } //Check pass if (document.form1.textfield2.value == ""){ alert("Ange ditt lösenord"); document.form1.textfield2.focus(); return false; } //Check pass if (document.form1.textfield12.value == ""){ alert("Bekräfta ditt lösenord"); document.form1.textfield12.focus(); return false; } &n
|