M
mark4asp
Hello,
I'm running my script locally and the cookie has been saved on the
machine because the login page is by-passed (with the Redirect to
"menu.asp" below.
OK - but where is my cookie stored? Or at least give me clue. What
will the cookie be called and what text will it contain if:
iAuthorID = 1
iSecurityLvl = 3
uName = "barny" ?
The machine user is "flintstone" and machine name is "W2KPro". The
CookieName will be "mABmyASPBlog"
== == == == ==
Const SITE_NAME = "my ASP Blog"
If getCookie("mAB" & replaceText(SITE_NAME, "\W+", "")) Then
Response.Redirect"menu.asp"
End If
Sub saveCookie(uName, CookieName)
Response.Cookies(CookieName)("aid") = Session("iAuthorID")
Response.Cookies(CookieName)("slvl") = Session("iSecurityLvl")
Response.Cookies(CookieName)("login") = uName
Response.Cookies(CookieName).Expires = DateAdd("m",3,Now)
End Sub
Function getCookie(CookieName)
Dim iAuthorID, iSecurityLvl, userName, sSQL, rsAuthor
iAuthorID = Request.Cookies(CookieName)("aid")
iSecurityLvl = Request.Cookies(CookieName)("slvl")
userName = Request.Cookies(CookieName)("login")
If IsWholeNumber(iAuthorID) And IsWholeNumber(iSecurityLvl)
And userName > "" Then
sSQL = "SELECT author_ID FROM tblAuthors" &_
" WHERE userName =" & fixSQLQuotes(userName) &_
" AND author_ID =" & iAuthorID &_
" AND security_ID =" & iSecurityLvl
Set rsAuthor = doAdoRs("Blog", sSql, 0, 1)
If Not (rsAuthor Is Nothing) Then
If Not(rsAuthor.EOF Or rsAuthor.BOF) Then
Session("iAuthorID") = iAuthorID
Session("iSecurityLvl") = iSecurityLvl
saveCookie userName, CookieName
getCookie = True
Exit Function
End If
End If
End If
getCookie = False
End Function
I'm running my script locally and the cookie has been saved on the
machine because the login page is by-passed (with the Redirect to
"menu.asp" below.
OK - but where is my cookie stored? Or at least give me clue. What
will the cookie be called and what text will it contain if:
iAuthorID = 1
iSecurityLvl = 3
uName = "barny" ?
The machine user is "flintstone" and machine name is "W2KPro". The
CookieName will be "mABmyASPBlog"
== == == == ==
Const SITE_NAME = "my ASP Blog"
If getCookie("mAB" & replaceText(SITE_NAME, "\W+", "")) Then
Response.Redirect"menu.asp"
End If
Sub saveCookie(uName, CookieName)
Response.Cookies(CookieName)("aid") = Session("iAuthorID")
Response.Cookies(CookieName)("slvl") = Session("iSecurityLvl")
Response.Cookies(CookieName)("login") = uName
Response.Cookies(CookieName).Expires = DateAdd("m",3,Now)
End Sub
Function getCookie(CookieName)
Dim iAuthorID, iSecurityLvl, userName, sSQL, rsAuthor
iAuthorID = Request.Cookies(CookieName)("aid")
iSecurityLvl = Request.Cookies(CookieName)("slvl")
userName = Request.Cookies(CookieName)("login")
If IsWholeNumber(iAuthorID) And IsWholeNumber(iSecurityLvl)
And userName > "" Then
sSQL = "SELECT author_ID FROM tblAuthors" &_
" WHERE userName =" & fixSQLQuotes(userName) &_
" AND author_ID =" & iAuthorID &_
" AND security_ID =" & iSecurityLvl
Set rsAuthor = doAdoRs("Blog", sSql, 0, 1)
If Not (rsAuthor Is Nothing) Then
If Not(rsAuthor.EOF Or rsAuthor.BOF) Then
Session("iAuthorID") = iAuthorID
Session("iSecurityLvl") = iSecurityLvl
saveCookie userName, CookieName
getCookie = True
Exit Function
End If
End If
End If
getCookie = False
End Function