Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cookie problems?????????????

Status
Not open for further replies.

iceb

Technical User
Jan 13, 2002
64
DK
Hi

I have a login script that has 2 profiles

a test profile

and my own profile

The meaning of this is that I can use both profiles

and that everytime i change profile a new cookie

is created on my pc and the old one overwritten...

BUT that does not happen now even though et logs

me in all right ?

How come ?

Thanks so much for this great forum

iceb

The code:

formular.asp


<%

if Request.ServerVariables(&quot;REQUEST_METHOD&quot;) = &quot;POST&quot; then
' Databaseforbindelse - husk at angive sti til din database
Set Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
DSN = &quot;DRIVER={Microsoft Access Driver (*.mdb)}; &quot;
DSN = DSN & &quot;DBQ=&quot; & Server.MapPath(&quot;/db/hp.mdb&quot;)
Conn.Open DSN
Set rs = Server.CreateObject(&quot;ADODB.RecordSet&quot;)
username = replace(Request.Form(&quot;username&quot;),&quot;'&quot;,&quot;&quot;)
password = replace(Request.Form(&quot;password&quot;),&quot;'&quot;,&quot;&quot;)
strSQL= &quot;SELECT * FROM medlemmer WHERE (brugernavn= '&quot; & username & &quot;' AND kode='&quot; & password & &quot;') AND (status = 1 OR status = 2)&quot;
Set rs = Conn.Execute (strSQL)

if not rs.EOF then
session(&quot;loginOK&quot;) = &quot;naturligvis&quot;
session(&quot;loginMemberID&quot;) = rs(&quot;ID&quot;)
response.cookies(&quot;forumData&quot;)(&quot;brugerID&quot;) = Session(&quot;loginMemberID&quot;)
response.cookies(&quot;forumData&quot;).Expires = now + 365
Conn.Close
'Den side man skal til når man er logget ind
Response.Redirect(&quot;dokument.asp&quot;)
else
session(&quot;loginOK&quot;) = &quot;&quot;
session(&quot;loginMemberID&quot;) = &quot;&quot;
if not rs.EOF then
session(&quot;loginOK&quot;) = &quot;naturligvis&quot;
session(&quot;loginMemberID&quot;) = rs(&quot;memberID&quot;)
response.cookies(&quot;forumData&quot;)(&quot;brugerID&quot;) = Session(&quot;loginMemberID&quot;)
response.cookies(&quot;forumData&quot;).Expires = now + 365

Conn.Close
'Den side man skal til når man er logget ind
else
Response.Redirect(&quot;til.asp&quot;)

session(&quot;loginOK&quot;) = &quot;&quot;
session(&quot;loginMemberID&quot;) = &quot;&quot;
response.cookies(&quot;forumData&quot;)(&quot;brugerID&quot;) = &quot;&quot;
end if
end if
end if
%>
<html>
<head></head>

<body bgcolor=&quot;#999966&quot; text=&quot;#000000&quot; link=&quot;#000000&quot; vlink=&quot;#000000&quot; alink=&quot;#FFFFFF&quot;>


<center><p>Velkommen til login her:</p>

Tilmeld dig <a href=&quot; target=&quot;_blank&quot;> her</a>
<table border=&quot;1&quot;>
<form method=&quot;post&quot; action=&quot;formular.asp&quot;>
<tr><td>Brugernavn:</td><td><input name=&quot;username&quot;></td></tr>
<tr><td>Kode:</td><td><input type=&quot;password&quot; name=&quot;password&quot;></td></tr>
<tr><td colspan=&quot;2&quot; align=&quot;center&quot;><input type=&quot;submit&quot; value=&quot;Login&quot; name=&quot;Action&quot;>

</td></tr>
</form></table>
<%
response.write request.cookies(&quot;forumData&quot;)(&quot;brugerID&quot;)
%>

For tests only user: ice pass: ic

</center>



</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top