Link to home
Start Free TrialLog in
Avatar of military donut
military donutFlag for United States of America

asked on

Environ("USERNAME")

I would like to use the environ to add the user to a database as a good user, then when they go to login I would like to compare that to the table.

I would have the supervisor login to the database with the user on the computer, and the supervisor would go to his/her page to add users, and click the button to add user...then when the user goes to login it would check to see if they are a valid user against the table and login waiting for their password.

I have a form for them to change their password or enter their password once it verifies a good user.  

I guess it would bypass the login for a supervisor login using a username and password, but I can figure that out later, but just want to see how I can set this up for them to add a user then when the user logs in to check the table for valid user.

I would also like to use the

environ$("COMPUTERNAME")

to check for a valid PC on the network.  but I think I can just have it check the PC Name against the table.
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

It would seem better to have a login system where users are added by someone (the Supervisor, perhaps), and then when those users login your would write code that would check the login table to see if the login exists. If so, then either (a) ask for a password, if one does not exist in the table or (b) allow the user to enter their password, and check it against the one stored in the table.

You can use Environ("USERNAME")  to grab the name of the currently logged in user, of course. You'd just do this when your login form open:

Me.txUserName = Environ("USERNAME")

This would "default" the currently-logged in user.
Avatar of military donut

ASKER

I currently have the Supervisors now entering the users, but it doesn't go by the computer logged in name.  See they use certs to login to the computer...so the Supervisor doesn't really know the Username

So, I wanted to have like this:

User logs onto the computer

Supervisor starts up the DB

logs in as "different user" so he could put in a separate username and pass to add the user

the Supervisor would use a form that grabs the username using environ

then has the user type in their chosen password.  

then supervisor would log off and the user would click login and it would check the table for the username..

just not sure on the right procedure and wanted to make sure I could do it without too much issues.  Currently they add typing the person's username the Supervisor chooses, but since the username would be consistant with the certs they are issued at the point of hire, that would never change and the user doesn't need to remember a separate username, just a password.

hope that makes sense...
stepping away from the computer for a couple of hours...be back soon...sorry if I don't respond quickly...
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Amy reason why you don't just trust the fact the user is logged in so use their username if you wish without prompting for user or password.

You could always have an extra option for logging in with different user but why re invent the wheel when user is already authenticated?

Steve
Steve,

I would say that the reason is for the PII information the db contains.  Here we have been looking for better ways to restrict the db.  Right now we are pretty good, but things can always be improved.  

So with this I think we can utilize the check for users on startup along with the computer name check.  We also already verify it is being run from a certain network location and restrict other aspects, so this will just add to the direction we want to go.

it is amazing how much I have received from EE during this time we have been developing the db and using it.

I am so thankful for everyone's help, suggestions and ideas.  Many are experts way beyond anything I could ever achieve.