使用php或javascript获取系统的用户名 [英] getting user name of a system using php or javascript

查看:134
本文介绍了使用php或javascript获取系统的用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要php或js代码来获取系统登录用户的用户名。当我们点击代码的url时,应该从系统中获取用户名并将其显示在网页上。

谢谢和问候

kavin

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
kavin

推荐答案

以下内容可行,但可能只适用于IE(带有适当的ActiveX警告)

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


这篇关于使用php或javascript获取系统的用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆