|
| |
Setting a new Session variable for Spooky Login Question
View related threads:
(in this forum
| in all forums)
|
Logged in as: Guest
|
|
|
winter
Posts: 183 Joined: 3/12/2002 From: Toronto ON Canada Status: offline
|
Setting a new Session variable for Spooky Login Question - 6/13/2009 0:02:06
Hi All – I am setting out to learn something new and need some help. Using FP03, Spooky Login Dev Edition and an Access 2000 DB, I have a form pre-populated with session variables. The key variable that is not working is one for “AccountExpires”. I would like the actual date recorded in a hidden field. In the Spooky Admin Settings I have checked off Extended fields, use cookies, use sessions. But I have noticed that Account Expires is not actually in the list of session variables. Sooo searching the forum extensively I found this answer (add the new variable to the list in a_general.asp) which i attempted and tried to modify. (see the code below) http://www.frontpagewebmaster.com/m-190493/key-set%252Cvariables/tm.htm#190493 End Sub '------------------------ Function Delim() Delim = IFF(strDbase="SQL" OR strDbase="MYSQL","'","#") End Function '------------------------ Sub CheckForAdmin() If (lCase(Session(appName&"Admin"))="false" or Session(appName&"Admin")&""="") OR (Session(appName&"Username")&""="" AND lCase(Session(appName&"Admin"))="true") then Call XRedirect(strLoginPage &"?Redirect="& Request.ServerVariables("URL")&"?" &Request.Servervariables("QUERY_STRING")) Response.clear Response.endResponse.Cookies(COOKIE_NAME)("xExpires") = IIF(isDate(AccExpires),AccExpires,"") ' New line below Response.Cookies(COOKIE_NAME)("UserID") = UserID '.... End Sub End if End Sub '------------------------ Sub SetCookie() Dim tmpExpiry : tmpExpiry = Request.Cookies(cookie_name)("xExpires") Response.Cookies(cookie_name).expires = IFF(isDate(AccountExpires),AccountExpires,Date+1000) Response.Cookies(cookie_name).path = "/" Response.Cookies(cookie_name)("T1aUs") = IFF(Len(Username),Username,"") Response.Cookies(cookie_name)("T2aPd") = IFF(Len(Password),Password,"") Response.Cookies(cookie_name)("UserID") = IFF(Len(UserID),UserID,"") Response.Cookies(cookie_name)("FirstName") = IFF(Len(x_firstname),x_firstname,"") Response.Cookies(cookie_name)("LastName") = IFF(Len(x_lastname),x_lastname,"") Response.Cookies(cookie_name)("AccessLevel")= IFF(Len(AccessLevel),AccessLevel,"") Response.Cookies(cookie_name)("xEmail") = IFF(Len(x_email),x_email,"") Response.Cookies(cookie_name)("xaddress") = IFF(Len(x_address),x_address,"") Response.Cookies(cookie_name)("xCity") = IFF(Len(x_city),x_city,"") Response.Cookies(cookie_name)("xZip") = IFF(Len(x_zip) ,x_zip,"") Response.Cookies(cookie_name)("xState") = IFF(Len(x_state),x_state,"") Response.Cookies(cookie_name)("xCountry") = IFF(Len(x_country),x_country,"") Response.Cookies(cookie_name)("xPhone") = IFF(Len(x_phone),x_phone,"") Response.Cookies(cookie_name)("xCellPhone") = IFF(Len(x_cellphone),x_cellphone,"") Response.Cookies(cookie_name)("xFax") = IFF(Len(x_fax),x_fax,"") Response.Cookies(cookie_name)("xCompany") = IFF(Len(x_company),x_company,"") Response.Cookies(cookie_name)("xExpires") = IFF(isDate(AccountExpires),AccountExpires,tmpExpiry) End Sub '------------------------ Sub ClearCookie() Response.Cookies(cookie_name)="" Response.Cookies(cookie_name).path ="/" Response.Cookies(cookie_name).expires=Date-1000 End Sub '------------------------ Sub SetSession() Session(appName&"UserID") = IFF(UserID&""="",request.form("UserID"),UserID) Session(appName&"UserName") = IFF(UserName&""="",request.form("UserName"),UserName) Session(appName&"AccessLevel") = IFF(AccessLevel&""="",request.form("AccessLevel"),AccessLevel) Session(appName&"Admin") = IFF(Admin&""="",request.form("Admin"),Admin) Session(appName&"x_firstname") = IFF(x_firstname&""="",request.form("x_firstname"),x_firstname) Session(appName&"x_lastname") = IFF(x_lastname&""="",request.form("x_lastname"),x_lastname) If l_use_session then Session(appName&"x_email") = x_email Session(appName&"x_company") = IFF(x_company&""="",request.form("x_company"),x_company) Session(appName&"x_address") = IFF(x_address&""="",request.form("x_address"),x_address) Session(appName&"x_city") = IFF(x_city&""="",request.form("x_city"),x_city) Session(appName&"x_state") = IFF(x_state&""="",request.form("x_state"),x_state) Session(appName&"x_zip") = IFF(x_zip&""="",request.form("x_zip"),x_zip) Session(appName&"x_country") = IFF(x_country&""="",request.form("x_country"),x_country) Session(appName&"x_phone") = IFF(x_phone&""="",request.form("x_phone"),x_phone) Session(appName&"x_cellphone") = IFF(x_cellphone&""="",request.form("x_cellphone"),x_cellphone) Session(appName&"x_fax") = IFF(x_fax&""="",request.form("x_fax"),x_fax) Session(appName&"x_website") = IFF(x_website&""="",request.form("x_website"),x_website) Session(appName&"x_Userfound") = IFF(x_Userfound&""="",request.form("x_Userfound"),x_Userfound) Session(appName&"x_spare") = IFF(x_spare&""="",request.form("x_spare"),x_spare) Session(appName&"XExpires") = IFF(XExpires&""="",request.form("XExpires"),x_XExpires) ----------------------------------------------------------------------------------------------------------------------- Now the admin area for the login doesn’t work and the form still does not collect the date. Here is the session variable that I tried to use: <%=Session("AccountExpires")%> as well as <%=Session("XExpires")%> ... but no luck I am getting lost. Any ideas? Help is appreciated! Carolyn
|
|
|
|
winter
Posts: 183 Joined: 3/12/2002 From: Toronto ON Canada Status: offline
|
RE: Setting a new Session variable for Spooky Login Que... - 6/25/2009 10:18:33
Hi - while it's true I didn't hear from anyone, (it is summer!) I think just hanging out in the halls of this forum has helped! I went through I am sure every post written on Account Expires, spooky login and session variables and learned more things along the way. In the end, I realized I was confusing terms like database and table and also was not at all familiar with queries. The other thing I am realizing from all of the posts, is that there is probably more than one way to solve any problem like this and a lot depends on getting clear on what we are doing. So in case this helps anyone else, here is what I did to solve my original problem. Carolyn In order to allow members (organized in the spooky login system with 'cookies' and 'sessions' checked off in the Admin Settings of the login program) to make a listing of their services for the public and have their listing show up on a results page ONLY if their account has not expired... 1. add a table for listings to the spooky login database. A form can post to it with the new information and has UserID as a hidden field. The form page is password protected and uses session variables (collecting the UserID automatically to the form). 2. set up a query within Spooky that creates a relationship with the UserID from the listing table to the UserID in the spooky Users table. 3. Then create a query in the Spooky Login DB that has variables from 2 tables... Listing table variables: name, UserID, Listing, Users table variables: AccountExpires variable 4. Then do a DRW that draws the info from the query view above. 5 . Finally to provide a page of listings from members whose account has not expired I did a DRW page with the query view, put the page on the Spooky Diet and then in code view amended this line to: fp_sQry="SELECT * FROM TestQuery WHERE (AccountExpires >date())" This now works. So if a members account in the spooky login expires so does their listing. If their account is back in order their listing re-appears. This could solve other information problems for us at the website, however, my only hesitation in this solution is that I am not sure (since I don't know Access that well) if it is okay to add tables to the spooky login data base. Is there a limit? It's such an amazing program and after 8 years I am finally getting to know how to use it!!! Hope this helps someone else as well  
_____________________________
" All that matters is what we do for each other" Lewis Carroll
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|