Log in

View Full Version : Sending Client variables to webserver...



Luterin
05-09-2007, 02:32 PM
I would like to have the client send a variable that is only available on the client to the server for verification use. What I would need is the name that the user is logged in with on that windows machine, not the password or anything else vital.

Ofcourse, that doesn't matter how vital it is, since it is not possible to do without using either some bug, or some object of some sorts that the user should have to verify that he allows to run on his machine.

I am ofcourse Ok with the users validating the object, afterall it's their choice for a sollution like this, but I wonder what the best method of achieving this is?

I heard normal things like using Java and perhaps even Flash, but I also heard that something should be possible to do using Jscript/WSH?

Any ideas around this, and/or pointers to someone else that has done something simillar would be appreciated.

Thanks.

EDIT:
Just realised that this might not be suited to be posted in the Javascript area, but I bet there will be a few Javascript lines included no matter what. :)
But feel free to move this to a more appropriate area if needed.

Luterin
05-11-2007, 09:59 PM
No one have any suggestions on the best way of doing this? Or which ways that it is even possible to do it with?

Twey
05-12-2007, 09:50 AM
There's no really accessible way to do this. If you did do it, it would involve either ActiveX or Java. However, Java is a plugin, making it quite inaccessible, and ActiveX is even more so, since it will only work for IE users. Java would be your best choice, but the way you accomplished it would be different for every operating system. On Windows you'd need the value of the %CURRENTUSER% environment variable, while on UNIX-based systems you'd need the output of the whoami command. There are other operating systems too, though, and it would be impossible to account for every one of them.
In short, there's no reliable way to do it. I wouldn't bother, if I were you: there are many downsides, and it's a lot of effort, all for something that doesn't have any great use as far as I can see.

Luterin
05-12-2007, 10:27 AM
Well, there is one thing which makes thing alot easier, and it's that I know that it is only around 10 people who will use this system and they are all using windows.

So this should be doable, since its in a "closed" enviroment I have rather good control over. I just want to do it this way to control which user is doing things on their internal site without needing them to log in. And they having to accept a Java object once is fine with them.

Twey
05-12-2007, 02:05 PM
In that case:
public class UsernameGetter extends java.swing.JApplet {
public String getUsername() {
return getEnv("CURRENTUSER");
}
}... should be sufficient. Compile it, put it in a JAR, and sign the JAR with jarsigner.exe.

Luterin
05-13-2007, 10:33 PM
Thanks, I'll try that out.