ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 25th, 2003, 04:25 PM
icecubes7 icecubes7 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 33 icecubes7 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Url validation

I have two pages, one called "test1" and another called "test2"

Is there any way I can check that a person has come from test1 when they go to the url "test2"?

Or would it be easier to create a session on test1 and then check for that session on the test2?

If the latter, then can someone point me in the direction of a tutorial suitable for this?

Thanks,

Mike

Reply With Quote
  #2  
Old November 25th, 2003, 04:46 PM
jstrohofer jstrohofer is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Cincinnati, OH USA
Posts: 111 jstrohofer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 3 sec
Reputation Power: 6
You could check the HTTP_REFERER Server Variable to see if it is the page test1.

Reply With Quote
  #3  
Old November 25th, 2003, 05:09 PM
icecubes7 icecubes7 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 33 icecubes7 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
should of said but I am really new to asp, could you give me an example?

Reply With Quote
  #4  
Old November 26th, 2003, 09:06 AM
jstrohofer jstrohofer is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Cincinnati, OH USA
Posts: 111 jstrohofer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 3 sec
Reputation Power: 6
If Request.ServerVariables("HTTP_REFERER") = "http://www.yourdomain.com/test1.asp" then
...do whatever here
End If


Of course, replacing 'www.yourdomain.com' with your actual domain name.

Reply With Quote
  #5  
Old November 26th, 2003, 12:08 PM
icecubes7 icecubes7 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 33 icecubes7 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
hey thanks man!


Reply With Quote
  #6  
Old November 26th, 2003, 12:11 PM
jstrohofer jstrohofer is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Cincinnati, OH USA
Posts: 111 jstrohofer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 3 sec
Reputation Power: 6
wo-man! =)

Reply With Quote
  #7  
Old November 26th, 2003, 01:33 PM
icecubes7 icecubes7 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 33 icecubes7 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
When I use this bit of code

"Request.ServerVariables("HTTP_REFERER") = page2"

I get this error...

"Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'Request.ServerVariables'

/mikesasp/test2.asp, line 4"


Any ideas?

Reply With Quote
  #8  
Old November 26th, 2003, 02:33 PM
jstrohofer jstrohofer is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Cincinnati, OH USA
Posts: 111 jstrohofer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 3 sec
Reputation Power: 6
Can you post a bit more of your code, or attach the ASP page so I can see exactly what the problem is?

Reply With Quote
  #9  
Old November 26th, 2003, 05:11 PM
icecubes7 icecubes7 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 33 icecubes7 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
ok (but I really don't need a lecture on security, lol. And bear in mind that this is a barebone script at the mo. no features or actualy content.....)

The login (login.asp):
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name="form1" method="post" action="test7.asp">
        <p>What is ur name? 
          <input name="user" type="text" id="user">
          What is ur pass? 
          <input name="pass" type="password" id="pass">
        </p>
        <p>
          <input type="submit" name="Submit" value="Submit">
        </p>
      </form>
</body>
</html>


The processor (test7.asp):

Code:
<% 

username = request.form("user")
password = request.form("pass")

Dim user(6)
user(1) = "admin"
user(2) = "Pierce"
user(3) = "random1"
user(4) = "random2"
user(5) = "random3"
user(6) = "random4"

If username= user(1) or username= user(2) or username= user(3) or username= user(4) or username= user(5) or username= user(6) Then

If (username= user(1) and password = "pass") or  (username= user(2) and password = "baby") or  (username= user(3) and password = "random") or  (username= user(4) and password = "random") or  (username= user(5) and password = "random") or  (username= user(6) and password = "random")Then

response.write ("Welcome admin!")

%>
<script type="text/javascript">

 top.location.href="test2.asp"

</script>
<%
Else 

response.write ("Go away commoner!")

End If

Else 

response.write ("Go away commoner!")

End If 

%>


The admin area (test2.asp):

[code]

<%
If Request.ServerVariables(HTTP_REFERER) = "http://www.xxxx.com/mikesasp/test7.asp" Then

response.write ("welcome person")

Else

response.write ("errrr....ur not suppost to be here!")

End If

%>

Reply With Quote
  #10  
Old November 27th, 2003, 11:03 AM
unclefu unclefu is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 120 unclefu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 m 57 sec
Reputation Power: 6
couple suggestions

you've already got an array for usernames, you could do one of two things

1) have a multi-dimensional array

Code:
user(0,0) = "username"
user(0,1) = "password"
user(1,0) = "username2"
user(1,1) = "password2"
'etc..

'to compare the username

for i = lbound(user) to ubound(user)
   if (username = user(i,0) AND password = user(i,1)) then
         response.write "Welcome Admin"
         response.redirect("test2.asp")
    end if
next


2) just have a second array for passwords
Code:
pass(0) = "password"
pass(1) = "password2"

for i = lbound(user) to ubound(user)
     if (username = user(i) AND password = pass(i)) then
           response.write "Welcome Admin"
           response.redirect("test2.asp")
     end if
next


anyways, as to the possible problem...
it may be because you do not have any double-quotes around HTTP_REFERER

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Url validation


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT