Hej - Det er en lidt lang kode men her kommer den :-)
<!--#include file="global.asp"-->
<!--#include virtual="/db.asp"-->
<% Dim sql,rsUser,username,password,page,stayloggedin,LConnectString,lconn,sqlflag
'Grab the submitted variables (page is the page they've come from, set by the hidden variable at the login box) username = Request.Form("username") password = Request.Form("password") page = Request.Form("page") stayloggedin = Request.Form("stayloggedin")
'Check no s**t is trying to hack in using SQL commands if InStr(username, "'") or InStr(username, """") or InStr(username, "=") or InStr(password, "'") or InStr(password, """") or InStr(password, "=") then sqlflag = True end if
if request("comebackto") <> "" then sReferer = request("comebackto") sGoBackTo = "?" & request.querystring end if
function Crypt(sText) 'Removed for security Crypt = sText end function
response.cookies("devUserName").path = "/" response.cookies("devFullName").path = "/" else response.cookies("devUserName") = "" response.cookies("devFullName") = "" response.cookies("devUserName").expires = Date() - 365 response.cookies("devFullName").expires = Date() - 365 end if rs("LastLogin") = now rs.update CloseDB
if sqlflag <> true then 'Open connection
'Get a recordset corresponding to the submitted username and password sql = "SELECT id, username, sex, brugerAlder, seek, filename FROM dating_users WHERE username = '" & username & "' AND password = '" & password & "'" Set rsUser = Server.CreateObject("ADODB.Recordset") rsUser.Open sql, conn, 3, 3
'If there was a valid recordset there, then send them back to the page they came from, with the username cookie set If (not rsUser.BOF) and (not rsUser.EOF) and sqlflag <> True then
session("sex") = rsUser("sex") ' flytter sex/gender over i en fast variabel på serveren til sennere brug.
Dim foundUser, LocalOnline, k foundUser = FALSE Application.Lock LocalOnline = Application("BrugereOnline")
FOR k=0 TO UBOUND( LocalOnline, 2) IF LocalOnline(k, 0) = rsUser("id") THEN foundUser = TRUE EXIT FOR END IF NEXT
IF foundUser = FALSE THEN FOR k = 0 TO UBOUND(LocalOnline, 2)
IF LocalOnline(k, 0) = "" THEN LocalOnline(k, 0) = rsUser("id") // Bruges til at tjekke uniq id for brugeren. LocalOnline(k, 1) = rsUser("username") LocalOnline(k, 2) = rsUser("sex") LocalOnline(k, 3) = rsUser("brugerAlder") LocalOnline(k, 4) = rsUser("seek") if (rsUser("filename") <> "") then ' Hvis der findes et filnavn, hvilket maa betyde at brugeren har et billede. LocalOnline(k, 5) = true else ' Brugeren har ikke noget billede. LocalOnline(k, 5) = false End if LocalOnline(k, 6) = NOW() ' Brug NOW() hvis du vil have årstal med og DATE() hvis det kun skal være datoen eller måske noget helt 3. ? LocalOnline(k, 7) = NOW() EXIT FOR END IF NEXT END IF Application("BrugereOnline") = LocalOnline Application.UnLock
Response.Cookies("username") = rsUser("username") Response.Cookies("username").expires = #1/1/1980# ' sætter til så cookies ikke gemmes. 'If the user wants to stay logged in all the time, then we'll set the cookie with a far-away expiry date session("username")= rsUser("username") session("id") = rsUser("id") session("logintjek") = true if stayloggedin = "yes" then Response.Cookies("username").expires = #1/1/2010# end if
rsUser.close set rsUser = nothing conn.close set conn = nothing Response.Redirect(page) end if
<% Dim sql,rsUser,username,password,page,stayloggedin,LConnectString,lconn,sqlflag
'Grab the submitted variables (page is the page they've come from, set by the hidden variable at the login box) username = Request.Form("username") password = Request.Form("password") page = Request.Form("page") stayloggedin = Request.Form("stayloggedin")
'Check no s**t is trying to hack in using SQL commands if InStr(username, "'") or InStr(username, """") or InStr(username, "=") or InStr(password, "'") or InStr(password, """") or InStr(password, "=") then sqlflag = True end if
if request("comebackto") <> "" then sReferer = request("comebackto") sGoBackTo = "?" & request.querystring end if
function Crypt(sText) 'Removed for security Crypt = sText end function
sSQL = "SELECT * FROM dating_Users WHERE UserName = '" & sUserName & "'" rs.Open sSQL, , , adCmdTable if not (rs.bof or rs.eof) then if rs("Password") = sPassword then 'Login succeeded 'Store info into session session("devUserName") = rs("UserName") session("devFullName") = rs("FirstName") & " " & rs("surname") End If
if request("chkRemember") <> "" then response.cookies("devUserName") = Crypt(rs("UserName")) response.cookies("devFullName") = Crypt(rs("FirstName") & " " & rs("surName"))
'Get a recordset corresponding to the submitted username and password sql = "SELECT id, username, sex, brugerAlder, seek, filename FROM dating_users WHERE username = '" & username & "' AND password = '" & password & "'" Set rsUser = Server.CreateObject("ADODB.Recordset") rsUser.Open sql, conn, 3, 3
End If
'If there was a valid recordset there, then send them back to the page they came from, with the username cookie set If (not rsUser.BOF) and (not rsUser.EOF) and sqlflag <> True then
session("sex") = rsUser("sex") ' flytter sex/gender over i en fast variabel på serveren til sennere brug.
Dim foundUser, LocalOnline, k foundUser = FALSE Application.Lock LocalOnline = Application("BrugereOnline")
FOR k=0 TO UBOUND( LocalOnline, 2) IF LocalOnline(k, 0) = rsUser("id") THEN foundUser = TRUE EXIT FOR END IF NEXT
IF foundUser = FALSE THEN FOR k = 0 TO UBOUND(LocalOnline, 2)
IF LocalOnline(k, 0) = "" THEN LocalOnline(k, 0) = rsUser("id") // Bruges til at tjekke uniq id for brugeren. LocalOnline(k, 1) = rsUser("username") LocalOnline(k, 2) = rsUser("sex") LocalOnline(k, 3) = rsUser("brugerAlder") LocalOnline(k, 4) = rsUser("seek") if (rsUser("filename") <> "") then ' Hvis der findes et filnavn, hvilket maa betyde at brugeren har et billede. LocalOnline(k, 5) = true else ' Brugeren har ikke noget billede. LocalOnline(k, 5) = false End if LocalOnline(k, 6) = NOW() ' Brug NOW() hvis du vil have årstal med og DATE() hvis det kun skal være datoen eller måske noget helt 3. ? LocalOnline(k, 7) = NOW() EXIT FOR END IF NEXT END IF Application("BrugereOnline") = LocalOnline Application.UnLock
Response.Cookies("username") = rsUser("username") Response.Cookies("username").expires = #1/1/1980# ' sætter til så cookies ikke gemmes. 'If the user wants to stay logged in all the time, then we'll set the cookie with a far-away expiry date session("username")= rsUser("username") session("id") = rsUser("id") session("logintjek") = true if stayloggedin = "yes" then Response.Cookies("username").expires = #1/1/2010# end if
rsUser.close set rsUser = nothing conn.close set conn = nothing Response.Redirect(page) end if end if
<% Dim sql,rsUser,username,password,page,stayloggedin,LConnectString,lconn,sqlflag
'Grab the submitted variables (page is the page they've come from, set by the hidden variable at the login box) username = Request.Form("username") password = Request.Form("password") page = Request.Form("page") stayloggedin = Request.Form("stayloggedin")
'Check no s**t is trying to hack in using SQL commands if InStr(username, "'") or InStr(username, """") or InStr(username, "=") or InStr(password, "'") or InStr(password, """") or InStr(password, "=") then sqlflag = True end if
if request("comebackto") <> "" then sReferer = request("comebackto") sGoBackTo = "?" & request.querystring end if
function Crypt(sText) 'Removed for security Crypt = sText end function
sSQL = "SELECT * FROM dating_Users WHERE UserName = '" & sUserName & "'" rs.Open sSQL, , , adCmdTable if not (rs.bof or rs.eof) then if rs("Password") = sPassword then 'Login succeeded 'Store info into session session("devUserName") = rs("UserName") session("devFullName") = rs("FirstName") & " " & rs("surname") End If
if request("chkRemember") <> "" then response.cookies("devUserName") = Crypt(rs("UserName")) response.cookies("devFullName") = Crypt(rs("FirstName") & " " & rs("surName"))
rs("LastLogin") = now rs.update CloseDB End If End If
if sqlflag <> true then 'Open connection
'Get a recordset corresponding to the submitted username and password sql = "SELECT id, username, sex, brugerAlder, seek, filename FROM dating_users WHERE username = '" & username & "' AND password = '" & password & "'" Set rsUser = Server.CreateObject("ADODB.Recordset") rsUser.Open sql, conn, 3, 3
End If
'If there was a valid recordset there, then send them back to the page they came from, with the username cookie set If (not rsUser.BOF) and (not rsUser.EOF) and sqlflag <> True then
session("sex") = rsUser("sex") ' flytter sex/gender over i en fast variabel på serveren til sennere brug.
Dim foundUser, LocalOnline, k foundUser = FALSE Application.Lock LocalOnline = Application("BrugereOnline")
FOR k=0 TO UBOUND( LocalOnline, 2) IF LocalOnline(k, 0) = rsUser("id") THEN foundUser = TRUE EXIT FOR END IF NEXT
IF foundUser = FALSE THEN FOR k = 0 TO UBOUND(LocalOnline, 2)
IF LocalOnline(k, 0) = "" THEN LocalOnline(k, 0) = rsUser("id") // Bruges til at tjekke uniq id for brugeren. LocalOnline(k, 1) = rsUser("username") LocalOnline(k, 2) = rsUser("sex") LocalOnline(k, 3) = rsUser("brugerAlder") LocalOnline(k, 4) = rsUser("seek") if (rsUser("filename") <> "") then ' Hvis der findes et filnavn, hvilket maa betyde at brugeren har et billede. LocalOnline(k, 5) = true else ' Brugeren har ikke noget billede. LocalOnline(k, 5) = false End if LocalOnline(k, 6) = NOW() ' Brug NOW() hvis du vil have årstal med og DATE() hvis det kun skal være datoen eller måske noget helt 3. ? LocalOnline(k, 7) = NOW() EXIT FOR END IF NEXT END IF Application("BrugereOnline") = LocalOnline Application.UnLock
Response.Cookies("username") = rsUser("username") Response.Cookies("username").expires = #1/1/1980# ' sætter til så cookies ikke gemmes. 'If the user wants to stay logged in all the time, then we'll set the cookie with a far-away expiry date session("username")= rsUser("username") session("id") = rsUser("id") session("logintjek") = true if stayloggedin = "yes" then Response.Cookies("username").expires = #1/1/2010# end if
rsUser.close set rsUser = nothing conn.close set conn = nothing Response.Redirect(page) end if
Medions ..Ups - der var jeg for hurtig til at acceptere....men i samme minut kommer der en rettelse fra dig og det virkede. Så alt er perfekt - TAKKER!
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.