
Don Hohman
|
| Posted: 03/05/2003, 8:09 AM |
|
I need an ASP solution...
I need to be able to log a user on and let them see only their departments records from a database. I have a user table with UserID, Password, and Department. I have another table with Employee, Department, ETC. I need to be able to lock the logged on user into seeing only their department and prevent them from changing the URL for access based on their UserID and Department matchup. Any help would be GREATLY appriciated.
Thanks
Don
|
|
|
 |
RonB
|
| Posted: 03/06/2003, 5:58 AM |
|
I assume the employee table also holds info on the department that employee belongs to ( a dep nr that refers to the department in the department table)
If so you can use this info in an event. first set a variable in the query for department so it will be included in the wehere part of the sql (where dep_id={my_dep_id})
now with query builder set it to code expression. In the before build select set the my_dep_id variable with CCDLookUP or CCGetDBValue. You do this by using the UserID to look up the coresponding dep_id in the employee table.
Ron
|
|
|
 |
Peter K
|
| Posted: 03/06/2003, 6:57 AM |
|
Could you provide a coding example? I'm new to CodeCharge and have a similiar requirement. I am coding in PHP and MySQL.
|
|
|
 |
Don Hohman
|
| Posted: 03/10/2003, 2:32 PM |
|
Here was my solution... A session variable. I'm using MS Access and ASP
On the Logon page, Logon Form, Propertys, Events, On Logon... add this code:
Session("s_Department") = DLookUp("Users", "Department", "UserID =" & ToSQL(sLogin, "Text") & " and password=" & ToSQL(sPassword, "Text"))
Where:
s_Department = your session variable you want to create
Users = the table that has your information
Department = the key field you want to match up to
UserID and Password are fields that are normally passed.
The on the input for the pages, I pass s_Department and was able to lock the page down.
|
|
|
 |
Peter
|
| Posted: 03/12/2003, 4:09 AM |
|
Great, thanks! I will covert this to PHP and give it a try.
|
|
|
 |
|

|