RokitRod Posted April 19, 2012 Share Posted April 19, 2012 I have a login page and after the user logs in it displays their info (by using the session username) to filter the database. I would like to display additional information from another table based on that isers information (but not their username) For example the user has an associated "region" field in their user information, many people have that same region idI would like to display the region details based on the users region ID How do I filter the recordset? Link to comment Share on other sites More sharing options...
justsomeguy Posted April 19, 2012 Share Posted April 19, 2012 You can either store all of the user's information in the session, or look up the information from the database based on the username and then use that to filter your other queries. Link to comment Share on other sites More sharing options...
RokitRod Posted April 20, 2012 Author Share Posted April 20, 2012 My knowledge is pretty basic so could you point me to the "how to" on both of those? Also which is more secure? Can't someone edit the cookie and look up other users info? Link to comment Share on other sites More sharing options...
justsomeguy Posted April 20, 2012 Share Posted April 20, 2012 The session data doesn't get sent to the user in a cookie, only the session ID does. They would need to know someone else's random session ID in order to impersonate another logged-in user. If you're already storing the username in the session then the first suggestion was just to store everything else in the session also, whatever other data you want to access about the user. You would do that the same way you're storing the username, just with the other data. The second suggestion would use a SQL query to look up the user's record in the database and get the other information on-demand. How you would do that depends on which database system you're using and how you connect to it, but you would sent a SELECT query to the database to look up the user and get their data. Link to comment Share on other sites More sharing options...
RokitRod Posted April 26, 2012 Author Share Posted April 26, 2012 Thanks this is helpful I never realized that about the the session id. Unfortunatlye the username, password and group are established by the log in user behavior in dreamweaver so that is all done through a nice screen where I don't write any script. Therefore I'm not sure where that happens exactly. I'm guessing I could plug a few lines into that to pull in the other data. On the sceond option dreamweaver also makes the sql very easy (if it is a simple request) but writing a query to establish the recordset is more complex than my current knowledge. Link to comment Share on other sites More sharing options...
justsomeguy Posted April 26, 2012 Share Posted April 26, 2012 You may have to break out of Dreamweaver. At the end it's going to produce ASP code, so you may just need to export your whole project and then start editing the code manually from there. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now