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 October 3rd, 2003, 11:59 AM
hamster84 hamster84 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Singapore
Posts: 21 hamster84 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question How to use login name to be part of another page?

Hello!

I have a login page where i validate my user id and password... this part is done... I need to get the user id to the next page i am showing...

Example like:
-------------------------------
Login Page
userid : abc
pwd : XXXXX

Authentication Successful
---------------------------------
Next Page:

Welcome abc ---> i want it here
----------------------------------

Anyone can show me how shld i do it...

Thanks for reading my post

Reply With Quote
  #2  
Old October 3rd, 2003, 12:30 PM
don_sparko's Avatar
don_sparko don_sparko is offline
Digitally Challenged
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 280 don_sparko User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 14 sec
Reputation Power: 6
i would suggest using cookies. then you can just set a cookie to the username and id. it would look something like this.
Code:
response.cookies("user")("name") = rs("username")
response.cookies("user")("id") = rs("userid")

and then when you want to recall that once they are logged in you can just output it like this.
Code:
<%=request.cookies("user")("name")%>
<%=request.cookies("user")("id")%>


let me know if this works!
__________________
My brain cells are like a storm trooper's armor: useless

Reply With Quote
  #3  
Old October 3rd, 2003, 10:26 PM
aaron.martone's Avatar
aaron.martone aaron.martone is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Central Florida
Posts: 76 aaron.martone User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via ICQ to aaron.martone
The Don's got the right idea. You may want to check if the user has Cookies enabled or disabled before doing this though.

response.cookies("test") = "chump"
If request.cookies("test") <> "chump" then
Response.Redirect("no_cookies.asp")
end if

Reply With Quote
  #4  
Old October 4th, 2003, 01:01 PM
seb835 seb835 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: UK, London
Posts: 95 seb835 User rank is Lance Corporal (50 - 100 Reputation Level)seb835 User rank is Lance Corporal (50 - 100 Reputation Level)seb835 User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 9 h 29 m 2 sec
Reputation Power: 6
Just out of interest, Session variables would also acheive the same effect...but which would be th ebest method? session vars. or cookies?

Reply With Quote
  #5  
Old October 6th, 2003, 08:22 AM
don_sparko's Avatar
don_sparko don_sparko is offline
Digitally Challenged
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 280 don_sparko User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 14 sec
Reputation Power: 6
i would suggest cookies. that way if their session gets terminated for some reason (disconnection etc) they will not get kicked out. also, session variables tend to eat up alot of memory, and the memory isn't always reallocated when your user terminates there session.

Reply With Quote
  #6  
Old October 6th, 2003, 06:45 PM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
Quote:
Originally posted by seb835
Just out of interest, Session variables would also acheive the same effect...but which would be th ebest method? session vars. or cookies?


that's entirely dependent on the level of security you want. I use sessions because i don't like usernames sitting around in the cookie jar so that keeps at least one more bit of information out of people's hands (login name). If you have 40 billion people hitting your website at once, then yeah, sessions are going to be rough on it, otherwise they don't take up that much memory and are usually leased for 20 minutes.

Reply With Quote
  #7  
Old October 6th, 2003, 07:20 PM
pda8333 pda8333 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 216 pda8333 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 6 m 31 sec
Reputation Power: 5
well, look at the bright side, if a user stays *idle* in the website for x minutes, then the session expires, and therefore kicks out that user. Isn't that called security feature? i agree with unatratnag. Of course don't put all your variables into sessions!!

Reply With Quote
  #8  
Old October 6th, 2003, 07:54 PM
aaron.martone's Avatar
aaron.martone aaron.martone is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Central Florida
Posts: 76 aaron.martone User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via ICQ to aaron.martone
I didn't know Session Expiration to be as much of a security feature as it was a method of the server attempting to open up un-used resources.

Reply With Quote
  #9  
Old October 6th, 2003, 08:26 PM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
Quote:
Originally posted by aaron.martone
I didn't know Session Expiration to be as much of a security feature as it was a method of the server attempting to open up un-used resources.

oh absolutely a security feature as well, a common hack is session hijacking, if i nab your session you're subject to a classic man-in-the-middle attack

Reply With Quote
  #10  
Old October 6th, 2003, 09:06 PM
pda8333 pda8333 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 216 pda8333 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 6 m 31 sec
Reputation Power: 5
hey guys, you know what? we've side tracked from hamster84's question. sorry hamster84.

anyway, you could also do this.

== on the login page ==
' after validating yr userid & password,
' if validation is true
response.redirect "welcome.asp?userid=<%=UserId%>"
response.end
else
' yr error msg here.
end if


== on the welcome.asp page ==
Welcome <%=trim(request.querystring("UserId"))%>

Reply With Quote
  #11  
Old October 6th, 2003, 09:10 PM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
oops

but don't do the querystring, just use the session variable.

Reply With Quote
  #12  
Old October 6th, 2003, 09:14 PM
pda8333 pda8333 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 216 pda8333 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 6 m 31 sec
Reputation Power: 5
any particular reason unatratnag? just curious only. any comments is valuable to everybody. tks for the input though.

Reply With Quote
  #13  
Old October 6th, 2003, 09:18 PM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
well if he's using sessions, there's no need to put the login in the URL. Plus if you do that the coder might be tempted to use the querystring object instead of the session variable for example querying information from db where id = request.querystring('user'). In which case i could type in user=pda8333 in my browser and hunt you down and kill you. This is all theoretical of course

Reply With Quote
  #14  
Old October 6th, 2003, 09:33 PM
pda8333 pda8333 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 216 pda8333 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 6 m 31 sec
Reputation Power: 5
theoratical u r absolutely correct. but how do you know his db & field name?

since we're talking "sessions" and "login details", i'll post a new topic regarding "sessions" outside of hamster84's thread. not fair to him/her.

Reply With Quote
  #15  
Old October 6th, 2003, 09:40 PM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
Oh i disagree, i think hamsters getting a very valuable lesson alright, but to close this topic
if the code says
Code:
strSQL = "SELECT * FROM users where id = '" & request.querystring("user") & "'"

I don't have to do any coding, it automatically updates to your info when i change the URL. This could happen if i bring someone else to update the page and they see the querystring and don't know we're doing authentication through sessions and use the quersysting and pop, right there is a big security flaw.

but in reference to not knowing the table name, i wouldn't rely on that it's pretty easy to do injection attacks to not well written pages (or brute force for the highly determined)

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > How to use login name to be part of another page?


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