Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Frequently Asked Questions
 FAQ Addition Requests
 How to expire cookie when closing window
 New Topic  Reply to Topic
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

gent
Starting Member

Sweden
5 Posts

Posted - 05 November 2000 :  17:51:48  Show Profile  Visit gent's Homepage  Send gent an AOL message  Send gent an ICQ Message  Send gent a Yahoo! Message  Reply with Quote
I have the problem of the forum keeping the cookie alive when closing the window. I am automatically looged in when I start. I do not want this, since people will be logging on via public computers. Can I fix it?

/ Gent


/ Gent<

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 05 November 2000 :  23:06:56  Show Profile  Reply with Quote
Well, 2 sure ways I can think of is, press the Logout button at the top before leaving the forum. You won't auto login the next time someone visits from the same computer.
Or you can manually delete the cookie from your computer that was created if you didn't logout of the forum.

*----*----*----*----*----*----*----*----*----*----*----*
"However, if you suffer as a Christian, do not be ashamed,
but praise God that you bear that name."

1 Peter 4:16
<
Go to Top of Page

gent
Starting Member

Sweden
5 Posts

Posted - 06 November 2000 :  00:54:23  Show Profile  Visit gent's Homepage  Send gent an AOL message  Send gent an ICQ Message  Send gent a Yahoo! Message  Reply with Quote
Thanks, but this is not a very secure way. People will forget this from time to time. Is there not a way to limit the cookie's existence to the browser window? Also maybe a time-limit as well?

/ Gent

Edited by - gent on 06 November 2000 00:56:46<
Go to Top of Page

jwilliams
Starting Member

18 Posts

Posted - 10 November 2000 :  18:04:17  Show Profile  Reply with Quote
jeeez... can't someone give these guys a good answer?

i am not an ASP developer (im really a Java dude), but I think you can use a global.asa file with a Session_OnStart method and use an ASP session instead of a cookie and then tell IIS to shorten the timeout of the session in your web server properties... errr whatever... this is actually pretty easy to do.

<
Go to Top of Page

gor
Retired Admin

Netherlands
5511 Posts

Posted - 10 November 2000 :  18:11:30  Show Profile  Visit gor's Homepage  Reply with Quote
Hey dude,

Could you please start reading your posts over once more before posting them ?
The last few minutes I've been reading nothing but negative posts by you.

Because jeeeez... your answer wasn't that great either, because the easiest way to have a cookie expire when the browser closes is by just not setting the expiration date.

Please understand that all people posting here are trying to help other members.
If you like to do that also, and are willing to do that in a polite way: please do so, we are happy with all the help we get
If not, please stay away.

Pierre Gorissen

Even if you're on the right track,
you'll get run over if you just sit there.

Will Rogers<
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 10 November 2000 :  21:14:44  Show Profile  Reply with Quote
Relax, already

======
Doug G
======<
Go to Top of Page

gent
Starting Member

Sweden
5 Posts

Posted - 11 November 2000 :  03:27:50  Show Profile  Visit gent's Homepage  Send gent an AOL message  Send gent an ICQ Message  Send gent a Yahoo! Message  Reply with Quote
Can you please tell me how to do this?

Kind Regards,

/ Gent

[quote]
... because the easiest way to have a cookie expire when the browser closes is by just not setting the expiration date.



/ Gent<
Go to Top of Page

gor
Retired Admin

Netherlands
5511 Posts

Posted - 11 November 2000 :  04:04:20  Show Profile  Visit gor's Homepage  Reply with Quote
Ok, I'm not sure it fixes it for the forums all at once, but it should get you an idea of what to look for:

in inc_functions.asp you find this:

sub DoCookies()
if strSetCookieToForum = 1 then
Response.Cookies(strCookieURL & "User").Path = strCookieURL
else
Response.Cookies(strCookieURL & "User").Path = "/"
end if
Response.Cookies(strCookieURL & "User")("Name") = Request.Form("Name")
Response.Cookies(strCookieURL & "User")("Pword") = Request.Form("Password")
Response.Cookies(strCookieURL & "User")("Cookies") = Request.Form("Cookies")
Response.Cookies(strCookieURL & "User").Expires = dateAdd("d", 30, strForumTimeAdjust)
Session(strCookieURL & "last_here_date") = ReadLastHereDate(Request.Form("Name"))
if strAuthType = "nt" then
Session(strCookieURL & "last_here_date") = ReadLastHereDate(Session(strCookieURL & "userID"))
end if
end sub


Now there are some more places in the code where cookies are set, if you want to find those just do a search for .Expires and you should be able to find them.
I'm not sure what happens if there allready is a cookie there with .Expires set to something so you might need to have to delete your cookie(s) first.

If it works, please report back here because it would be nice to add this as a user-selectable option. (like you see at hotmail i.e.)

Pierre Gorissen

Even if you're on the right track,
you'll get run over if you just sit there.

Will Rogers<
Go to Top of Page

Ken
Starting Member

3 Posts

Posted - 11 November 2000 :  12:09:02  Show Profile  Reply with Quote
I added ' in front of the .expire line and it works fine on my forums. How do I go about adding this as a feature for the user to select?

quote:

Ok, I'm not sure it fixes it for the forums all at once, but it should get you an idea of what to look for:

in inc_functions.asp you find this:

sub DoCookies()
if strSetCookieToForum = 1 then
Response.Cookies(strCookieURL & "User").Path = strCookieURL
else
Response.Cookies(strCookieURL & "User").Path = "/"
end if
Response.Cookies(strCookieURL & "User")("Name") = Request.Form("Name")
Response.Cookies(strCookieURL & "User")("Pword") = Request.Form("Password")
Response.Cookies(strCookieURL & "User")("Cookies") = Request.Form("Cookies")
Response.Cookies(strCookieURL & "User").Expires = dateAdd("d", 30, strForumTimeAdjust)
Session(strCookieURL & "last_here_date") = ReadLastHereDate(Request.Form("Name"))
if strAuthType = "nt" then
Session(strCookieURL & "last_here_date") = ReadLastHereDate(Session(strCookieURL & "userID"))
end if
end sub


Now there are some more places in the code where cookies are set, if you want to find those just do a search for .Expires and you should be able to find them.
I'm not sure what happens if there allready is a cookie there with .Expires set to something so you might need to have to delete your cookie(s) first.

If it works, please report back here because it would be nice to add this as a user-selectable option. (like you see at hotmail i.e.)

Pierre Gorissen

Even if you're on the right track,
you'll get run over if you just sit there.

Will Rogers



<
Go to Top of Page

gor
Retired Admin

Netherlands
5511 Posts

Posted - 11 November 2000 :  12:44:57  Show Profile  Visit gor's Homepage  Reply with Quote
Ehm, haven't thought about it very long yet, I think that the quickest way to do it is to add a checkbox in inc_top.asp so that it displays Save password
and then use this value to do something like

if checkbox = true then
Response.Cookies(strCookieURL & "User").Expires = dateAdd("d", 30, strForumTimeAdjust)
end if


so that the expires property only gets set if the checkbox is checked.



Pierre Gorissen

Even if you're on the right track,
you'll get run over if you just sit there.

Will Rogers<
Go to Top of Page

Ken
Starting Member

3 Posts

Posted - 11 November 2000 :  14:36:56  Show Profile  Reply with Quote
Not sure if I did this correctly but I add this to the inc_top.asp and it does not save the cookie.

<input type="checkbox" name="savepassword" value="">
Save Password
<%
if checkbox = true then
Response.Cookies(strCookieURL & "User").Expires = dateAdd("d", 30, strForumTimeAdjust)
end if
%>

Any sugestions?

<
Go to Top of Page

gor
Retired Admin

Netherlands
5511 Posts

Posted - 11 November 2000 :  15:26:46  Show Profile  Visit gor's Homepage  Reply with Quote
Try this:

in inc_top.asp change this code starting around line 61:

select case Request.Form("Method_Type")

case "login"
select case ChkUser2(Request.Form("Name"), Request.Form("Password"))
case 1, 2, 3, 4
Call DoCookies(Request.Form("SavePassword"))
strLoginStatus = 1
case else
strLoginStatus = 0
end select
case "logout"
Call ClearCookies()

end select


further down starting around line 193:

<% if (strAuthType = "db") then %>
<td><font face="<% =strDefaultFontFace %>" size="<% =strFooterFontSize %>">Username:</font>

<INPUT type="text" name="Name" size="10" value=""></td>
<td><font face="<% =strDefaultFontFace %>" size="<% =strFooterFontSize %>">Password:</font>

<INPUT type="password" name="Password" size="10" value=""></td>
<td valign="bottom">
<% if strGfxButtons <> "0" then %>
<INPUT src=button_login.gif type="image" value="Login" id=submit1 name=submit1 border=0 hspace=4>
<% else %>
<% if strGfxButtons = "0" then %>
<INPUT type="submit" value="Login" id=submit1 name=submit1>
<% end if %>
<% end if %>
</td>
<tr>
<td colspan="3" align="left"><font face="<% =strDefaultFontFace %>" size="<% =strFooterFontSize %>">
<INPUT type="checkbox" name="SavePassWord" value="true"> Save my Password</font>
</td>

<% else %>


in inc_functions.asp change the DoCookies() function to:

sub DoCookies(fSavePassWord)
if strSetCookieToForum = 1 then
Response.Cookies(strCookieURL & "User").Path = strCookieURL
else
Response.Cookies(strCookieURL & "User").Path = "/"
end if
Response.Cookies(strCookieURL & "User")("Name") = Request.Form("Name")
Response.Cookies(strCookieURL & "User")("Pword") = Request.Form("Password")
Response.Cookies(strCookieURL & "User")("Cookies") = Request.Form("Cookies")
if fSavePassWord = "true" then
Response.Cookies(strCookieURL & "User").Expires = dateAdd("d", 30, strForumTimeAdjust)
end if

Session(strCookieURL & "last_here_date") = ReadLastHereDate(Request.Form("Name"))
if strAuthType = "nt" then
Session(strCookieURL & "last_here_date") = ReadLastHereDate(Session(strCookieURL & "userID"))
end if
end sub


in register.asp change line 268 to:

Call DoCookies("")

(this needs to be done or else you get an error when registering a new user)

Remember I didn't have time to check and re-check all the code, but the first few tests at my server worked: Only if you select the "save my password" checkbox before loggin on the username and password are saved after you close the browser.

Pierre Gorissen

Even if you're on the right track,
you'll get run over if you just sit there.

Will Rogers<
Go to Top of Page

Huntress
New Member

USA
96 Posts

Posted - 21 November 2002 :  08:07:24  Show Profile  Visit Huntress's Homepage  Reply with Quote
You know this is done in an easier way by not allowing the save password function as follows, in inc_header.asp find this:


" <input type=""checkbox"" name=""SavePassWord"" value=""true"" tabindex=""-1"" CHECKED><b>Save Login </b>" & _


And change it to:


" <input type=""hidden"" name=""SavePassWord"" value=""false"" tabindex=""-1"">" & _


This removes the Save Password checkbox, and never saves the password to the cookie, thus they are not logged in when the browser is closed.

<

There are 10 kinds of people, those that understand binary, and those that don't.
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 21 November 2002 :  08:11:35  Show Profile  Visit Gremlin's Homepage  Reply with Quote
Did you notice the age of the thread ? hehe 2 years old was probably talking about version 3.1 or earlier back then.<

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

Huntress
New Member

USA
96 Posts

Posted - 21 November 2002 :  09:09:22  Show Profile  Visit Huntress's Homepage  Reply with Quote
LOL that's funny... I was researching something else and stubled across this and didn't notice the year... I thought it was only a few weeks old... jeez I'm embarrassed now. LOL

My new motto, I'm here to help, you just have to wait 2 years <

There are 10 kinds of people, those that understand binary, and those that don't.

Edited by - Huntress on 21 November 2002 09:11:01
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 21 November 2002 :  09:20:51  Show Profile  Visit Gremlin's Homepage  Reply with Quote
ROFL :) Love the motto Huntress !<

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.36 seconds. Powered By: Snitz Forums 2000 Version 3.4.07