Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Frequently Asked Questions
 FAQ Addition Requests
 How to expire cookie when closing window

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!
Before posting, make sure you have read this topic!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
gent Posted - 05 November 2000 : 17:51:48
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<
15   L A T E S T    R E P L I E S    (Newest First)
Huntress Posted - 21 November 2002 : 11:09:46
Thanks Dave I'm so honored!

The one good thing about this is the lack of pressure LOL<
davemaxwell Posted - 21 November 2002 : 09:28:42
I officially nominate Huntress to be the "old bug" fixer! <
Gremlin Posted - 21 November 2002 : 09:20:51
ROFL :) Love the motto Huntress !<
Huntress Posted - 21 November 2002 : 09:09:22
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 <
Gremlin Posted - 21 November 2002 : 08:11:35
Did you notice the age of the thread ? hehe 2 years old was probably talking about version 3.1 or earlier back then.<
Huntress Posted - 21 November 2002 : 08:07:24
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.

<
gor Posted - 11 November 2000 : 15:26:46
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<
Ken Posted - 11 November 2000 : 14:36:56
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?

<
gor Posted - 11 November 2000 : 12:44:57
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<
Ken Posted - 11 November 2000 : 12:09:02
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



<
gor Posted - 11 November 2000 : 04:04:20
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<
gent Posted - 11 November 2000 : 03:27:50
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<
Doug G Posted - 10 November 2000 : 21:14:44
Relax, already

======
Doug G
======<
gor Posted - 10 November 2000 : 18:11:30
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<
jwilliams Posted - 10 November 2000 : 18:04:17
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.

<

Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000 Version 3.4.07