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!

redirect ?

Status
Not open for further replies.

iceb

Technical User
Jan 13, 2002
64
DK
Hi

I want to be able to redirect people from

my predokument.asp to my dokument.asp

the first one is my prmember site and

the second is my member site...

They shall ONLY be redirected if the cookie

is on their pc*s if the cookie is not

there then just load the page....

How do I do that ?

Here is the code that checks for cookies....

predokument.asp

<%
' Dataconnection
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;)

if Session(&quot;loginOK&quot;) = &quot;natulivis&quot; then
else
if request.cookies(&quot;forumData&quot;) <> &quot;&quot; then
session(&quot;loginMemberID&quot;) = request.cookies(&quot;forumData&quot;)(&quot;brugerID&quot;)
strSQL = &quot;SELECT * FROM medlemmer WHERE ID = &quot; & session(&quot;loginMemberID&quot;)
set rs = Conn.Execute(strSQL)
response.write rs(&quot;ID&quot;)
if NOT rs.EOF then
session(&quot;loginOK&quot;) = &quot;naturligvis&quot;
else
session(&quot;loginMemberID&quot;) = &quot;&quot;
end if
else
response.redirect(&quot;formular.asp&quot;)
end if
end if

response.write request.cookies(&quot;forumData&quot;)(&quot;brugerID&quot;)



Conn.Close
%>


<html>
<title>prepage</title>
<head>
</head>

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


<h1>Dette er forsiden</h1><br><br>

<%

'THIS is the login part that the people woith no cookie comes to


if Request.ServerVariables(&quot;REQUEST_METHOD&quot;) = &quot;POST&quot; then
' Dataconnection
Set Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
DSN = &quot;DRIVER={Microsoft Access Driver (*.mdb)}; &quot;
DSN = DSN & &quot;DBQ=&quot; & Server.MapPath(&quot;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;');&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;

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

end if


else
session(&quot;loginOK&quot;) = &quot;&quot;
session(&quot;loginMemberID&quot;) = &quot;&quot;
response.cookies(&quot;forumData&quot;)(&quot;brugerID&quot;) = &quot;&quot;
end if
%>
<html>
<head></head>
<body>
<p>Velkommen til denne site login her:</p>
<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>Password:</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;>
<input type=hidden name=huskmig value=ja>
</td></tr>
</form></table><br><br><br><br>

<a href=&quot; target=&quot;_blank&quot;>Anbefel Heilpraktikken</a><br><br>

<a href=&quot; target=&quot;_blank&quot;>Kontakt</a><br>



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

Part and Inventory Search

Sponsor

Back
Top