Click to See Complete Forum and Search --> : login name


benb7760
09-08-2004, 02:50 PM
is it possible to retrieve the name that the user is logged onto on their pc, so you could output something like:
Hello 'logged in name'.
This is you ' ' visit. Or something like that.

NogDog
09-08-2004, 02:56 PM
My god I hope not! That would be a pretty bad security hole. :eek:

solavar
09-08-2004, 03:35 PM
If you allowed an Internet scripting language to retrieve info stored on the user's PC, then nothing on your hard disk would be safe. Any rogue programmer could grab your sensitive data, delete your folders, format your hard disk, etc, etc.

No, PHP and other Internet languages are designed in such a way that they MUST NOT compromise a user's machine.

AdamGundry
09-10-2004, 03:36 PM
You actually can do it with JavaScript, though not PHP, like this:
<script type="text/javascript">
var userName = new ActiveXObject("WScript.Network").UserName;
alert(userName);
</script>
This will only work, however, in Internet Explorer with security permissions almost turned off. NogDog is right, this is a serious security hole, and if your browser is set to allow it to execute without at least a prompt first you have a serious problem.

If you want to be friendly, get your user to type in their name and then store it in a cookie. Don't bother with this.

Adam

neil9999
09-10-2004, 04:27 PM
Gawd, can active X do anything more serious?

Neil

JavaHead Jonnie
09-11-2004, 05:52 AM
Not from a webpage I think, but in a C, C# or C++ program activeX can do a hell-of-a-lot o' stuff.