Click here to Skip to main content
12,817,428 members (38,217 online)
Rate this:
Please Sign up or sign in to vote.
See more: Javascript PHP
Hi, i need php or js code to get the username of logged in user of the system. when we hit the url of the code it should take the username from the system and display it on web page.
Thanks & regards
Posted 20-Feb-13 22:52pm
Updated 21-Feb-13 0:11am
enhzflep 21-Feb-13 4:13am
What did google tell you when you asked it? (you can't get this info with either of those, btw)
Bala Selvanayagam 21-Feb-13 5:18am
When you say username, are you referring to the username of the server under which the web server is running ?
kavinsp 21-Feb-13 7:53am
No.. client machine user name
Sandeep Mewara 21-Feb-13 11:51am
Did you try anything?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The following will work, but probably only on IE (with an appropriate ActiveX warning)
    <script language="javascript">
        function GetUserName()
            var wshell = new ActiveXObject("WScript.Shell");
<body onload="GetUserName();">

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170308.1 | Last Updated 21 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100