php-windows Digest 3 Mar 2006 18:46:06 -0000 Issue 2902
Topics (messages 26729 through 26735):
Re: get username that is currently logged in to Windows workstation.
26729 by: Aaron Kenney
26730 by: Aaron Kenney
26731 by: Aaron Kenney
26732 by: Aaron Kenney
26733 by: Aaron Kenney
Getting more information to pass to PHP
26734 by: Aaron Kenney
DOM/XML -> PHP 5.0.3 HowTo?
26735 by: S.F. Alim
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
The Javascript idea would work, but I don't understand what is really
going on in the script.
var WshNetwork = new ActiveXObject("WScript.Network");
I guess this declares a variable, but I know nothing of ActiveX, since
it's about to be deprecated anyway, I never bothered to learn it. I am
going to assume that WScript.Network is a "superglobal" ActiveX array.
//document.write(WshNetwork.UserName);
//document.writeln(WshNetwork.UserDomain)
If these were uncommented, I am assuming they would display the
"UserName" and "UserDomain." I guess there should be a semicolon at
the end of the second line. :-P At this point though, I wouldn't want
to display this info, just assign it to a variable or cookie so i can
get at it with PHP. I suppose in this case I can always echo the JS
within PHP to get it to assign to a PHP variable. Maybe?
document.forms[0].lookupNBID.value = WshNetwork.UserName
document.forms[0].submit()
Here is where I am confused. Generally speaking, at this point, I just
want to get the username assigned to a PHP variable. But what happens
here? I guess you are naming a form element and then comparing that to
the current username upon submit, but what good is that if you do not
also authenticate the password?
I guess I'm missing the second part of my question which is to get the
username assigned to a PHP variable. How do I do this?
-Aaron
On 3/1/06, Wagner, Aaron <[EMAIL PROTECTED]> wrote:
> > -----Original Message-----
> > From: Aaron Kenney [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, February 28, 2006 16:10
> > To: [email protected]
> > Subject: [PHP-WIN] NEWB: get username that is currently
> > logged in to Windows workstation.
> >
> > I am sorry but I am somewhat new to interfacing Windows through PHP.
> > What I am trying to do is to get the username (or otherwise unique
> > identifier) of the user that is currently logged into the local
> > Windows workstation, and then assign the username to a variable. Can
> > it be done?
> > Originally what I considered doing was, in ASP, obtain the username
> > and write it to a cookie. Then use PHP to parse the cookie to get the
> > username.
> > -Aaron
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> I'm working on the same kind of issue. The problem I'm having is that
> PHP is a server-side script and can only see what is passed back to it
> in the browser. You can try to run a phpinfo and see what is passed
> back to PHP.
>
> I've actually had to go to a client-side script to see the user
> information and pass that back to the server. ActiveX and VBScript(I
> know, I hate it too) are the only processes I found that can get out of
> the 'sandbox' and read local user info.
>
> *****this queries active directory and gets your full name******
> <script language="VBScript">
> Set sysinfo = CreateObject("ADSystemInfo")
> Set oUser = GetObject("LDAP://" & sysinfo.UserName & "")
> Document.writeln("Name: <b>" & oUser.FirstName & " " &
> oUser.LastName & "</b><br>")
> //Document.writeln(sysinfo.UserName)
> </script>
>
> ************this gets username and domain**************
> <script language=javascript>
> var WshNetwork = new ActiveXObject("WScript.Network");
> //document.write(WshNetwork.UserName);
> //document.writeln(WshNetwork.UserDomain)
> document.forms[0].lookupNBID.value = WshNetwork.UserName
> document.forms[0].submit()
> </script>
>
> Thanx
> Aaron N Wagner
> Monitoring Systems and Network Tools
> CCO-Command Center Operations
> 804.515.6298
>
--- End Message ---
--- Begin Message ---
Eh... POST didn't work. Here's my code to try and get this to work,
but I'm sure it's way off. My first issue is that the form is not
auto-submitting unto itself.
<?PHP
if (isset($_POST['username']))
{
$username = $_POST['username'];
echo "returned<br>";
echo $username;
}
else {
echo "go";
echo "
<html>
<head>
<title>testing username script</title>
<script language=javascript><!--
var WshNetwork = new ActiveXObject(\"WScript.Network\");
document.postvars.username.value = WshNetwork.UserName;
document.postvars.submit();
//--></script>
</head>
<body>
<form name='postvars' method='POST' action='test.php' onsubmit='submitform()'>
<input type='hidden' name='username' value=''>
</form>
</body>
</html>";
}
?>
On 3/1/06, Aaron Kenney <[EMAIL PROTECTED]> wrote:
> I was going to POST instead of GET or use a cookie so that the user
> wouldn't try to get smart and modify the value of the user name. Then
> I would just use "document.goPostBack.submit();" in a function as my
> action to submit the page automatically, provided that the value of
> $username hasn't been set by PHP. I let you know what happens.
> -Aaron (Kenney)... so many Aarons.
>
> On 3/1/06, Wagner, Aaron <[EMAIL PROTECTED]> wrote:
> >
> > > -----Original Message-----
> > > From: Aaron Kenney [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, March 01, 2006 13:12
> > > To: Wagner, Aaron
> > > Subject: Re: [PHP-WIN] NEWB: get username that is currently
> > > logged in to Windows workstation.
> > >
> > > I'm realizing something at this point that I never considered before.
> > > In the last two lines of the script, you are naming a form element
> > > "lookupNBID" so that you can use this form element to pass the
> > > username to PHP via submit. This "solves" the client side VS server
> > > side script problem, although in a very dirty way. Does the
> > > "document.forms[0].submit()" line autosubmit the form, or is there
> > > something else I have to do to automatically submit?
> > > -Aaron
> > >
> > > On 3/1/06, Aaron Kenney <[EMAIL PROTECTED]> wrote:
> > > > The Javascript idea would work, but I don't understand what
> > > is really
> > > > going on in the script.
> > > >
> > > > var WshNetwork = new ActiveXObject("WScript.Network");
> > > >
> > > > I guess this declares a variable, but I know nothing of
> > > ActiveX, since
> > > > it's about to be deprecated anyway, I never bothered to
> > > learn it. I am
> > > > going to assume that WScript.Network is a "superglobal"
> > > ActiveX array.
> > > >
> > > > //document.write(WshNetwork.UserName);
> > > > //document.writeln(WshNetwork.UserDomain)
> > > >
> > > > If these were uncommented, I am assuming they would display the
> > > > "UserName" and "UserDomain." I guess there should be a semicolon at
> > > > the end of the second line. :-P At this point though, I
> > > wouldn't want
> > > > to display this info, just assign it to a variable or
> > > cookie so i can
> > > > get at it with PHP. I suppose in this case I can always echo the JS
> > > > within PHP to get it to assign to a PHP variable. Maybe?
> > > >
> > > > document.forms[0].lookupNBID.value = WshNetwork.UserName
> > > > document.forms[0].submit()
> > > >
> > > > Here is where I am confused. Generally speaking, at this
> > > point, I just
> > > > want to get the username assigned to a PHP variable. But
> > > what happens
> > > > here? I guess you are naming a form element and then
> > > comparing that to
> > > > the current username upon submit, but what good is that if
> > > you do not
> > > > also authenticate the password?
> > > >
> > > > I guess I'm missing the second part of my question which is
> > > to get the
> > > > username assigned to a PHP variable. How do I do this?
> > > > -Aaron
> > > >
> > > >
> > > > On 3/1/06, Wagner, Aaron <[EMAIL PROTECTED]> wrote:
> > > > > > -----Original Message-----
> > > > > > From: Aaron Kenney [mailto:[EMAIL PROTECTED]
> > > > > > Sent: Tuesday, February 28, 2006 16:10
> > > > > > To: [email protected]
> > > > > > Subject: [PHP-WIN] NEWB: get username that is currently
> > > > > > logged in to Windows workstation.
> > > > > >
> > > > > > I am sorry but I am somewhat new to interfacing Windows
> > > through PHP.
> > > > > > What I am trying to do is to get the username (or
> > > otherwise unique
> > > > > > identifier) of the user that is currently logged into the local
> > > > > > Windows workstation, and then assign the username to a
> > > variable. Can
> > > > > > it be done?
> > > > > > Originally what I considered doing was, in ASP, obtain
> > > the username
> > > > > > and write it to a cookie. Then use PHP to parse the
> > > cookie to get the
> > > > > > username.
> > > > > > -Aaron
> > > > > >
> > > > > > --
> > > > > > PHP Windows Mailing List (http://www.php.net/)
> > > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > > >
> > > > > >
> > > > >
> > > > > I'm working on the same kind of issue. The problem I'm
> > > having is that
> > > > > PHP is a server-side script and can only see what is
> > > passed back to it
> > > > > in the browser. You can try to run a phpinfo and see
> > > what is passed
> > > > > back to PHP.
> > > > >
> > > > > I've actually had to go to a client-side script to see the user
> > > > > information and pass that back to the server. ActiveX
> > > and VBScript(I
> > > > > know, I hate it too) are the only processes I found that
> > > can get out of
> > > > > the 'sandbox' and read local user info.
> > > > >
> > > > > *****this queries active directory and gets your full name******
> > > > > <script language="VBScript">
> > > > > Set sysinfo = CreateObject("ADSystemInfo")
> > > > > Set oUser = GetObject("LDAP://" & sysinfo.UserName & "")
> > > > > Document.writeln("Name: <b>" & oUser.FirstName & " " &
> > > > > oUser.LastName & "</b><br>")
> > > > > //Document.writeln(sysinfo.UserName)
> > > > > </script>
> > > > >
> > > > > ************this gets username and domain**************
> > > > > <script language=javascript>
> > > > > var WshNetwork = new ActiveXObject("WScript.Network");
> > > > > //document.write(WshNetwork.UserName);
> > > > > //document.writeln(WshNetwork.UserDomain)
> > > > > document.forms[0].lookupNBID.value = WshNetwork.UserName
> > > > > document.forms[0].submit()
> > > > > </script>
> > > > >
> > > > > Thanx
> > > > > Aaron N Wagner
> > > > > Monitoring Systems and Network Tools
> > > > > CCO-Command Center Operations
> > > > > 804.515.6298
> > > > >
> > > >
> > >
> >
> > Yea, I have a hidden frame that I autosubmit with the submit() line
> >
> > ************************
> > <IFRAME name='userProcess' src='about:blank' width=0 height=0></IFRAME>
> > <form action='UserGroupDBProc.php' method=POST target='userProcess'>
> > <input type=hidden name=lookupNBID value=''>
> > <input type=hidden name=lookupNBIDgroup value=1>
> > </form>
> >
> > <script language=javascript>
> > var WshNetwork = new ActiveXObject("WScript.Network");
> > //document.write(WshNetwork.UserName);
> > //document.writeln(WshNetwork.UserDomain)
> > document.forms[0].lookupNBID.value = WshNetwork.UserName
> > document.forms[0].submit()
> > </script>
> >
> > ***********************
> >
> >
> > Thanx
> > Aaron N Wagner
> > Monitoring Systems and Network Tools
> > CCO-Command Center Operations
> > 804.515.6298
> >
>
--- End Message ---
--- Begin Message ---
So I added onLoad to the body tag and took out value='' for my hidden
field, and it submitted, but the output was "returned". Unfortunately,
the username didn't pass and echo.
<?PHP
if (isset($_POST['username']))
{
$username = $_POST['username'];
echo "returned<br>";
echo $username;
}
else {
echo "go";
echo "
<html>
<head>
<title>testing username script</title>
<script language=javascript><!--
var WshNetwork = new ActiveXObject(\"WScript.Network\");
document.postvars.username.value = WshNetwork.UserName;
function autosubmit()
{
document.postvars.submit();
}
//--></script>
</head>
<body onLoad='autosubmit()'>
<form name='postvars' method='POST' action='test.php' onsubmit='submitform()'>
<input type='hidden' name='username'>
</form>
</body>
</html>";
}
?>
On 3/1/06, Aaron Kenney <[EMAIL PROTECTED]> wrote:
> Eh... POST didn't work. Here's my code to try and get this to work,
> but I'm sure it's way off. My first issue is that the form is not
> auto-submitting unto itself.
>
> <?PHP
> if (isset($_POST['username']))
> {
> $username = $_POST['username'];
> echo "returned<br>";
> echo $username;
> }
> else {
> echo "go";
> echo "
> <html>
> <head>
> <title>testing username script</title>
> <script language=javascript><!--
> var WshNetwork = new ActiveXObject(\"WScript.Network\");
> document.postvars.username.value = WshNetwork.UserName;
> document.postvars.submit();
>
> //--></script>
> </head>
> <body>
> <form name='postvars' method='POST' action='test.php' onsubmit='submitform()'>
> <input type='hidden' name='username' value=''>
> </form>
> </body>
> </html>";
> }
> ?>
>
>
> On 3/1/06, Aaron Kenney <[EMAIL PROTECTED]> wrote:
> > I was going to POST instead of GET or use a cookie so that the user
> > wouldn't try to get smart and modify the value of the user name. Then
> > I would just use "document.goPostBack.submit();" in a function as my
> > action to submit the page automatically, provided that the value of
> > $username hasn't been set by PHP. I let you know what happens.
> > -Aaron (Kenney)... so many Aarons.
> >
> > On 3/1/06, Wagner, Aaron <[EMAIL PROTECTED]> wrote:
> > >
> > > > -----Original Message-----
> > > > From: Aaron Kenney [mailto:[EMAIL PROTECTED]
> > > > Sent: Wednesday, March 01, 2006 13:12
> > > > To: Wagner, Aaron
> > > > Subject: Re: [PHP-WIN] NEWB: get username that is currently
> > > > logged in to Windows workstation.
> > > >
> > > > I'm realizing something at this point that I never considered before.
> > > > In the last two lines of the script, you are naming a form element
> > > > "lookupNBID" so that you can use this form element to pass the
> > > > username to PHP via submit. This "solves" the client side VS server
> > > > side script problem, although in a very dirty way. Does the
> > > > "document.forms[0].submit()" line autosubmit the form, or is there
> > > > something else I have to do to automatically submit?
> > > > -Aaron
> > > >
> > > > On 3/1/06, Aaron Kenney <[EMAIL PROTECTED]> wrote:
> > > > > The Javascript idea would work, but I don't understand what
> > > > is really
> > > > > going on in the script.
> > > > >
> > > > > var WshNetwork = new ActiveXObject("WScript.Network");
> > > > >
> > > > > I guess this declares a variable, but I know nothing of
> > > > ActiveX, since
> > > > > it's about to be deprecated anyway, I never bothered to
> > > > learn it. I am
> > > > > going to assume that WScript.Network is a "superglobal"
> > > > ActiveX array.
> > > > >
> > > > > //document.write(WshNetwork.UserName);
> > > > > //document.writeln(WshNetwork.UserDomain)
> > > > >
> > > > > If these were uncommented, I am assuming they would display the
> > > > > "UserName" and "UserDomain." I guess there should be a semicolon at
> > > > > the end of the second line. :-P At this point though, I
> > > > wouldn't want
> > > > > to display this info, just assign it to a variable or
> > > > cookie so i can
> > > > > get at it with PHP. I suppose in this case I can always echo the JS
> > > > > within PHP to get it to assign to a PHP variable. Maybe?
> > > > >
> > > > > document.forms[0].lookupNBID.value = WshNetwork.UserName
> > > > > document.forms[0].submit()
> > > > >
> > > > > Here is where I am confused. Generally speaking, at this
> > > > point, I just
> > > > > want to get the username assigned to a PHP variable. But
> > > > what happens
> > > > > here? I guess you are naming a form element and then
> > > > comparing that to
> > > > > the current username upon submit, but what good is that if
> > > > you do not
> > > > > also authenticate the password?
> > > > >
> > > > > I guess I'm missing the second part of my question which is
> > > > to get the
> > > > > username assigned to a PHP variable. How do I do this?
> > > > > -Aaron
> > > > >
> > > > >
> > > > > On 3/1/06, Wagner, Aaron <[EMAIL PROTECTED]> wrote:
> > > > > > > -----Original Message-----
> > > > > > > From: Aaron Kenney [mailto:[EMAIL PROTECTED]
> > > > > > > Sent: Tuesday, February 28, 2006 16:10
> > > > > > > To: [email protected]
> > > > > > > Subject: [PHP-WIN] NEWB: get username that is currently
> > > > > > > logged in to Windows workstation.
> > > > > > >
> > > > > > > I am sorry but I am somewhat new to interfacing Windows
> > > > through PHP.
> > > > > > > What I am trying to do is to get the username (or
> > > > otherwise unique
> > > > > > > identifier) of the user that is currently logged into the local
> > > > > > > Windows workstation, and then assign the username to a
> > > > variable. Can
> > > > > > > it be done?
> > > > > > > Originally what I considered doing was, in ASP, obtain
> > > > the username
> > > > > > > and write it to a cookie. Then use PHP to parse the
> > > > cookie to get the
> > > > > > > username.
> > > > > > > -Aaron
> > > > > > >
> > > > > > > --
> > > > > > > PHP Windows Mailing List (http://www.php.net/)
> > > > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > > > >
> > > > > > >
> > > > > >
> > > > > > I'm working on the same kind of issue. The problem I'm
> > > > having is that
> > > > > > PHP is a server-side script and can only see what is
> > > > passed back to it
> > > > > > in the browser. You can try to run a phpinfo and see
> > > > what is passed
> > > > > > back to PHP.
> > > > > >
> > > > > > I've actually had to go to a client-side script to see the user
> > > > > > information and pass that back to the server. ActiveX
> > > > and VBScript(I
> > > > > > know, I hate it too) are the only processes I found that
> > > > can get out of
> > > > > > the 'sandbox' and read local user info.
> > > > > >
> > > > > > *****this queries active directory and gets your full name******
> > > > > > <script language="VBScript">
> > > > > > Set sysinfo = CreateObject("ADSystemInfo")
> > > > > > Set oUser = GetObject("LDAP://" & sysinfo.UserName & "")
> > > > > > Document.writeln("Name: <b>" & oUser.FirstName & " " &
> > > > > > oUser.LastName & "</b><br>")
> > > > > > //Document.writeln(sysinfo.UserName)
> > > > > > </script>
> > > > > >
> > > > > > ************this gets username and domain**************
> > > > > > <script language=javascript>
> > > > > > var WshNetwork = new ActiveXObject("WScript.Network");
> > > > > > //document.write(WshNetwork.UserName);
> > > > > > //document.writeln(WshNetwork.UserDomain)
> > > > > > document.forms[0].lookupNBID.value = WshNetwork.UserName
> > > > > > document.forms[0].submit()
> > > > > > </script>
> > > > > >
> > > > > > Thanx
> > > > > > Aaron N Wagner
> > > > > > Monitoring Systems and Network Tools
> > > > > > CCO-Command Center Operations
> > > > > > 804.515.6298
> > > > > >
> > > > >
> > > >
> > >
> > > Yea, I have a hidden frame that I autosubmit with the submit() line
> > >
> > > ************************
> > > <IFRAME name='userProcess' src='about:blank' width=0 height=0></IFRAME>
> > > <form action='UserGroupDBProc.php' method=POST target='userProcess'>
> > > <input type=hidden name=lookupNBID value=''>
> > > <input type=hidden name=lookupNBIDgroup value=1>
> > > </form>
> > >
> > > <script language=javascript>
> > > var WshNetwork = new ActiveXObject("WScript.Network");
> > > //document.write(WshNetwork.UserName);
> > > //document.writeln(WshNetwork.UserDomain)
> > > document.forms[0].lookupNBID.value = WshNetwork.UserName
> > > document.forms[0].submit()
> > > </script>
> > >
> > > ***********************
> > >
> > >
> > > Thanx
> > > Aaron N Wagner
> > > Monitoring Systems and Network Tools
> > > CCO-Command Center Operations
> > > 804.515.6298
> > >
> >
>
--- End Message ---
--- Begin Message ---
oh...
On 3/1/06, Wagner, Aaron <[EMAIL PROTECTED]> wrote:
> > -----Original Message-----
> > From: Aaron Kenney [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, March 01, 2006 16:43
> > To: Wagner, Aaron
> > Cc: [email protected]
> > Subject: Re: [PHP-WIN] NEWB: get username that is currently
> > logged in to Windows workstation.
> >
> > Eh... POST didn't work. Here's my code to try and get this to work,
> > but I'm sure it's way off. My first issue is that the form is not
> > auto-submitting unto itself.
> >
> > <?PHP
> > if (isset($_POST['username']))
> > {
> > $username = $_POST['username'];
> > echo "returned<br>";
> > echo $username;
> > }
> > else {
> > echo "go";
> > echo "
> > <html>
> > <head>
> > <title>testing username script</title>
> > <script language=javascript><!--
> > var WshNetwork = new ActiveXObject(\"WScript.Network\");
> > document.postvars.username.value = WshNetwork.UserName;
> > document.postvars.submit();
> >
> > //--></script>
> > </head>
> > <body>
> > <form name='postvars' method='POST' action='test.php'
> > onsubmit='submitform()'>
> > <input type='hidden' name='username' value=''>
> > </form>
> > </body>
> > </html>";
> > }
> > ?>
> >
> >
> > On 3/1/06, Aaron Kenney <[EMAIL PROTECTED]> wrote:
> > > I was going to POST instead of GET or use a cookie so that the user
> > > wouldn't try to get smart and modify the value of the user
> > name. Then
> > > I would just use "document.goPostBack.submit();" in a function as my
> > > action to submit the page automatically, provided that the value of
> > > $username hasn't been set by PHP. I let you know what happens.
> > > -Aaron (Kenney)... so many Aarons.
> > >
> > > On 3/1/06, Wagner, Aaron <[EMAIL PROTECTED]> wrote:
> > > >
> > > > > -----Original Message-----
> > > > > From: Aaron Kenney [mailto:[EMAIL PROTECTED]
> > > > > Sent: Wednesday, March 01, 2006 13:12
> > > > > To: Wagner, Aaron
> > > > > Subject: Re: [PHP-WIN] NEWB: get username that is currently
> > > > > logged in to Windows workstation.
> > > > >
> > > > > I'm realizing something at this point that I never
> > considered before.
> > > > > In the last two lines of the script, you are naming a
> > form element
> > > > > "lookupNBID" so that you can use this form element to pass the
> > > > > username to PHP via submit. This "solves" the client
> > side VS server
> > > > > side script problem, although in a very dirty way. Does the
> > > > > "document.forms[0].submit()" line autosubmit the form,
> > or is there
> > > > > something else I have to do to automatically submit?
> > > > > -Aaron
> > > > >
> > > > > On 3/1/06, Aaron Kenney <[EMAIL PROTECTED]> wrote:
> > > > > > The Javascript idea would work, but I don't understand what
> > > > > is really
> > > > > > going on in the script.
> > > > > >
> > > > > > var WshNetwork = new ActiveXObject("WScript.Network");
> > > > > >
> > > > > > I guess this declares a variable, but I know nothing of
> > > > > ActiveX, since
> > > > > > it's about to be deprecated anyway, I never bothered to
> > > > > learn it. I am
> > > > > > going to assume that WScript.Network is a "superglobal"
> > > > > ActiveX array.
> > > > > >
> > > > > > //document.write(WshNetwork.UserName);
> > > > > > //document.writeln(WshNetwork.UserDomain)
> > > > > >
> > > > > > If these were uncommented, I am assuming they would
> > display the
> > > > > > "UserName" and "UserDomain." I guess there should be
> > a semicolon at
> > > > > > the end of the second line. :-P At this point though, I
> > > > > wouldn't want
> > > > > > to display this info, just assign it to a variable or
> > > > > cookie so i can
> > > > > > get at it with PHP. I suppose in this case I can
> > always echo the JS
> > > > > > within PHP to get it to assign to a PHP variable. Maybe?
> > > > > >
> > > > > > document.forms[0].lookupNBID.value =
> > WshNetwork.UserName
> > > > > > document.forms[0].submit()
> > > > > >
> > > > > > Here is where I am confused. Generally speaking, at this
> > > > > point, I just
> > > > > > want to get the username assigned to a PHP variable. But
> > > > > what happens
> > > > > > here? I guess you are naming a form element and then
> > > > > comparing that to
> > > > > > the current username upon submit, but what good is that if
> > > > > you do not
> > > > > > also authenticate the password?
> > > > > >
> > > > > > I guess I'm missing the second part of my question which is
> > > > > to get the
> > > > > > username assigned to a PHP variable. How do I do this?
> > > > > > -Aaron
> > > > > >
> > > > > >
> > > > > > On 3/1/06, Wagner, Aaron
> > <[EMAIL PROTECTED]> wrote:
> > > > > > > > -----Original Message-----
> > > > > > > > From: Aaron Kenney [mailto:[EMAIL PROTECTED]
> > > > > > > > Sent: Tuesday, February 28, 2006 16:10
> > > > > > > > To: [email protected]
> > > > > > > > Subject: [PHP-WIN] NEWB: get username that is currently
> > > > > > > > logged in to Windows workstation.
> > > > > > > >
> > > > > > > > I am sorry but I am somewhat new to interfacing Windows
> > > > > through PHP.
> > > > > > > > What I am trying to do is to get the username (or
> > > > > otherwise unique
> > > > > > > > identifier) of the user that is currently logged
> > into the local
> > > > > > > > Windows workstation, and then assign the username to a
> > > > > variable. Can
> > > > > > > > it be done?
> > > > > > > > Originally what I considered doing was, in ASP, obtain
> > > > > the username
> > > > > > > > and write it to a cookie. Then use PHP to parse the
> > > > > cookie to get the
> > > > > > > > username.
> > > > > > > > -Aaron
> > > > > > > >
> > > > > > > > --
> > > > > > > > PHP Windows Mailing List (http://www.php.net/)
> > > > > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > > I'm working on the same kind of issue. The problem I'm
> > > > > having is that
> > > > > > > PHP is a server-side script and can only see what is
> > > > > passed back to it
> > > > > > > in the browser. You can try to run a phpinfo and see
> > > > > what is passed
> > > > > > > back to PHP.
> > > > > > >
> > > > > > > I've actually had to go to a client-side script to
> > see the user
> > > > > > > information and pass that back to the server. ActiveX
> > > > > and VBScript(I
> > > > > > > know, I hate it too) are the only processes I found that
> > > > > can get out of
> > > > > > > the 'sandbox' and read local user info.
> > > > > > >
> > > > > > > *****this queries active directory and gets your
> > full name******
> > > > > > > <script language="VBScript">
> > > > > > > Set sysinfo = CreateObject("ADSystemInfo")
> > > > > > > Set oUser = GetObject("LDAP://" &
> > sysinfo.UserName & "")
> > > > > > > Document.writeln("Name: <b>" &
> > oUser.FirstName & " " &
> > > > > > > oUser.LastName & "</b><br>")
> > > > > > > //Document.writeln(sysinfo.UserName)
> > > > > > > </script>
> > > > > > >
> > > > > > > ************this gets username and domain**************
> > > > > > > <script language=javascript>
> > > > > > > var WshNetwork = new
> > ActiveXObject("WScript.Network");
> > > > > > > //document.write(WshNetwork.UserName);
> > > > > > > //document.writeln(WshNetwork.UserDomain)
> > > > > > > document.forms[0].lookupNBID.value =
> > WshNetwork.UserName
> > > > > > > document.forms[0].submit()
> > > > > > > </script>
> > > > > > >
> > > > > > > Thanx
> > > > > > > Aaron N Wagner
> > > > > > > Monitoring Systems and Network Tools
> > > > > > > CCO-Command Center Operations
> > > > > > > 804.515.6298
> > > > > > >
> > > > > >
> > > > >
> > > >
> > > > Yea, I have a hidden frame that I autosubmit with the
> > submit() line
> > > >
> > > > ************************
> > > > <IFRAME name='userProcess' src='about:blank' width=0
> > height=0></IFRAME>
> > > > <form action='UserGroupDBProc.php' method=POST
> > target='userProcess'>
> > > > <input type=hidden name=lookupNBID value=''>
> > > > <input type=hidden name=lookupNBIDgroup value=1>
> > > > </form>
> > > >
> > > > <script language=javascript>
> > > > var WshNetwork = new ActiveXObject("WScript.Network");
> > > > //document.write(WshNetwork.UserName);
> > > > //document.writeln(WshNetwork.UserDomain)
> > > > document.forms[0].lookupNBID.value = WshNetwork.UserName
> > > > document.forms[0].submit()
> > > > </script>
> > > >
> > > > ***********************
> > > >
> > > >
> > > > Thanx
> > > > Aaron N Wagner
> > > > Monitoring Systems and Network Tools
> > > > CCO-Command Center Operations
> > > > 804.515.6298
> > > >
> > >
> >
>
>
> <?PHP
> if (isset($_POST['username']))
> {
> $username = $_POST['username'];
> echo "returned<br>";
> echo $username;
> }
> else
> {
> echo "go";
> echo "
> <html>
> <head>
> <title>testing username script</title>
> </head>
> <body>
> <form name='postvars' method='POST' action='test.php'
> onsubmit='submitform()'>
> <input type='hidden' name='username' value=''>
> </form>
>
> <script language=javascript><!--
> var WshNetwork = new ActiveXObject(\"WScript.Network\");
> document.postvars.username.value = WshNetwork.UserName;
> document.postvars.submit();
> //--></script>
>
> </body>
> </html>
> ";
> }
> ?>
>
> You need to move the submit() below the form object.
> You can't submit a form that hasn't been sent(drawn) to the page yet.
>
>
> Thanx
> Aaron N Wagner
> Monitoring Systems and Network Tools
> CCO-Command Center Operations
> 804.515.6298
>
--- End Message ---
--- Begin Message ---
Thanks. That worked. Shows how much I know once I leave the world of
PHP and try to do other stuff.
-Aaron Kenney
On 3/1/06, Wagner, Aaron <[EMAIL PROTECTED]> wrote:
> > -----Original Message-----
> > From: Aaron Kenney [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, March 01, 2006 16:43
> > To: Wagner, Aaron
> > Cc: [email protected]
> > Subject: Re: [PHP-WIN] NEWB: get username that is currently
> > logged in to Windows workstation.
> >
> > Eh... POST didn't work. Here's my code to try and get this to work,
> > but I'm sure it's way off. My first issue is that the form is not
> > auto-submitting unto itself.
> >
> > <?PHP
> > if (isset($_POST['username']))
> > {
> > $username = $_POST['username'];
> > echo "returned<br>";
> > echo $username;
> > }
> > else {
> > echo "go";
> > echo "
> > <html>
> > <head>
> > <title>testing username script</title>
> > <script language=javascript><!--
> > var WshNetwork = new ActiveXObject(\"WScript.Network\");
> > document.postvars.username.value = WshNetwork.UserName;
> > document.postvars.submit();
> >
> > //--></script>
> > </head>
> > <body>
> > <form name='postvars' method='POST' action='test.php'
> > onsubmit='submitform()'>
> > <input type='hidden' name='username' value=''>
> > </form>
> > </body>
> > </html>";
> > }
> > ?>
> >
> >
> > On 3/1/06, Aaron Kenney <[EMAIL PROTECTED]> wrote:
> > > I was going to POST instead of GET or use a cookie so that the user
> > > wouldn't try to get smart and modify the value of the user
> > name. Then
> > > I would just use "document.goPostBack.submit();" in a function as my
> > > action to submit the page automatically, provided that the value of
> > > $username hasn't been set by PHP. I let you know what happens.
> > > -Aaron (Kenney)... so many Aarons.
> > >
> > > On 3/1/06, Wagner, Aaron <[EMAIL PROTECTED]> wrote:
> > > >
> > > > > -----Original Message-----
> > > > > From: Aaron Kenney [mailto:[EMAIL PROTECTED]
> > > > > Sent: Wednesday, March 01, 2006 13:12
> > > > > To: Wagner, Aaron
> > > > > Subject: Re: [PHP-WIN] NEWB: get username that is currently
> > > > > logged in to Windows workstation.
> > > > >
> > > > > I'm realizing something at this point that I never
> > considered before.
> > > > > In the last two lines of the script, you are naming a
> > form element
> > > > > "lookupNBID" so that you can use this form element to pass the
> > > > > username to PHP via submit. This "solves" the client
> > side VS server
> > > > > side script problem, although in a very dirty way. Does the
> > > > > "document.forms[0].submit()" line autosubmit the form,
> > or is there
> > > > > something else I have to do to automatically submit?
> > > > > -Aaron
> > > > >
> > > > > On 3/1/06, Aaron Kenney <[EMAIL PROTECTED]> wrote:
> > > > > > The Javascript idea would work, but I don't understand what
> > > > > is really
> > > > > > going on in the script.
> > > > > >
> > > > > > var WshNetwork = new ActiveXObject("WScript.Network");
> > > > > >
> > > > > > I guess this declares a variable, but I know nothing of
> > > > > ActiveX, since
> > > > > > it's about to be deprecated anyway, I never bothered to
> > > > > learn it. I am
> > > > > > going to assume that WScript.Network is a "superglobal"
> > > > > ActiveX array.
> > > > > >
> > > > > > //document.write(WshNetwork.UserName);
> > > > > > //document.writeln(WshNetwork.UserDomain)
> > > > > >
> > > > > > If these were uncommented, I am assuming they would
> > display the
> > > > > > "UserName" and "UserDomain." I guess there should be
> > a semicolon at
> > > > > > the end of the second line. :-P At this point though, I
> > > > > wouldn't want
> > > > > > to display this info, just assign it to a variable or
> > > > > cookie so i can
> > > > > > get at it with PHP. I suppose in this case I can
> > always echo the JS
> > > > > > within PHP to get it to assign to a PHP variable. Maybe?
> > > > > >
> > > > > > document.forms[0].lookupNBID.value =
> > WshNetwork.UserName
> > > > > > document.forms[0].submit()
> > > > > >
> > > > > > Here is where I am confused. Generally speaking, at this
> > > > > point, I just
> > > > > > want to get the username assigned to a PHP variable. But
> > > > > what happens
> > > > > > here? I guess you are naming a form element and then
> > > > > comparing that to
> > > > > > the current username upon submit, but what good is that if
> > > > > you do not
> > > > > > also authenticate the password?
> > > > > >
> > > > > > I guess I'm missing the second part of my question which is
> > > > > to get the
> > > > > > username assigned to a PHP variable. How do I do this?
> > > > > > -Aaron
> > > > > >
> > > > > >
> > > > > > On 3/1/06, Wagner, Aaron
> > <[EMAIL PROTECTED]> wrote:
> > > > > > > > -----Original Message-----
> > > > > > > > From: Aaron Kenney [mailto:[EMAIL PROTECTED]
> > > > > > > > Sent: Tuesday, February 28, 2006 16:10
> > > > > > > > To: [email protected]
> > > > > > > > Subject: [PHP-WIN] NEWB: get username that is currently
> > > > > > > > logged in to Windows workstation.
> > > > > > > >
> > > > > > > > I am sorry but I am somewhat new to interfacing Windows
> > > > > through PHP.
> > > > > > > > What I am trying to do is to get the username (or
> > > > > otherwise unique
> > > > > > > > identifier) of the user that is currently logged
> > into the local
> > > > > > > > Windows workstation, and then assign the username to a
> > > > > variable. Can
> > > > > > > > it be done?
> > > > > > > > Originally what I considered doing was, in ASP, obtain
> > > > > the username
> > > > > > > > and write it to a cookie. Then use PHP to parse the
> > > > > cookie to get the
> > > > > > > > username.
> > > > > > > > -Aaron
> > > > > > > >
> > > > > > > > --
> > > > > > > > PHP Windows Mailing List (http://www.php.net/)
> > > > > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > > I'm working on the same kind of issue. The problem I'm
> > > > > having is that
> > > > > > > PHP is a server-side script and can only see what is
> > > > > passed back to it
> > > > > > > in the browser. You can try to run a phpinfo and see
> > > > > what is passed
> > > > > > > back to PHP.
> > > > > > >
> > > > > > > I've actually had to go to a client-side script to
> > see the user
> > > > > > > information and pass that back to the server. ActiveX
> > > > > and VBScript(I
> > > > > > > know, I hate it too) are the only processes I found that
> > > > > can get out of
> > > > > > > the 'sandbox' and read local user info.
> > > > > > >
> > > > > > > *****this queries active directory and gets your
> > full name******
> > > > > > > <script language="VBScript">
> > > > > > > Set sysinfo = CreateObject("ADSystemInfo")
> > > > > > > Set oUser = GetObject("LDAP://" &
> > sysinfo.UserName & "")
> > > > > > > Document.writeln("Name: <b>" &
> > oUser.FirstName & " " &
> > > > > > > oUser.LastName & "</b><br>")
> > > > > > > //Document.writeln(sysinfo.UserName)
> > > > > > > </script>
> > > > > > >
> > > > > > > ************this gets username and domain**************
> > > > > > > <script language=javascript>
> > > > > > > var WshNetwork = new
> > ActiveXObject("WScript.Network");
> > > > > > > //document.write(WshNetwork.UserName);
> > > > > > > //document.writeln(WshNetwork.UserDomain)
> > > > > > > document.forms[0].lookupNBID.value =
> > WshNetwork.UserName
> > > > > > > document.forms[0].submit()
> > > > > > > </script>
> > > > > > >
> > > > > > > Thanx
> > > > > > > Aaron N Wagner
> > > > > > > Monitoring Systems and Network Tools
> > > > > > > CCO-Command Center Operations
> > > > > > > 804.515.6298
> > > > > > >
> > > > > >
> > > > >
> > > >
> > > > Yea, I have a hidden frame that I autosubmit with the
> > submit() line
> > > >
> > > > ************************
> > > > <IFRAME name='userProcess' src='about:blank' width=0
> > height=0></IFRAME>
> > > > <form action='UserGroupDBProc.php' method=POST
> > target='userProcess'>
> > > > <input type=hidden name=lookupNBID value=''>
> > > > <input type=hidden name=lookupNBIDgroup value=1>
> > > > </form>
> > > >
> > > > <script language=javascript>
> > > > var WshNetwork = new ActiveXObject("WScript.Network");
> > > > //document.write(WshNetwork.UserName);
> > > > //document.writeln(WshNetwork.UserDomain)
> > > > document.forms[0].lookupNBID.value = WshNetwork.UserName
> > > > document.forms[0].submit()
> > > > </script>
> > > >
> > > > ***********************
> > > >
> > > >
> > > > Thanx
> > > > Aaron N Wagner
> > > > Monitoring Systems and Network Tools
> > > > CCO-Command Center Operations
> > > > 804.515.6298
> > > >
> > >
> >
>
>
> <?PHP
> if (isset($_POST['username']))
> {
> $username = $_POST['username'];
> echo "returned<br>";
> echo $username;
> }
> else
> {
> echo "go";
> echo "
> <html>
> <head>
> <title>testing username script</title>
> </head>
> <body>
> <form name='postvars' method='POST' action='test.php'
> onsubmit='submitform()'>
> <input type='hidden' name='username' value=''>
> </form>
>
> <script language=javascript><!--
> var WshNetwork = new ActiveXObject(\"WScript.Network\");
> document.postvars.username.value = WshNetwork.UserName;
> document.postvars.submit();
> //--></script>
>
> </body>
> </html>
> ";
> }
> ?>
>
> You need to move the submit() below the form object.
> You can't submit a form that hasn't been sent(drawn) to the page yet.
>
>
> Thanx
> Aaron N Wagner
> Monitoring Systems and Network Tools
> CCO-Command Center Operations
> 804.515.6298
>
--- End Message ---
--- Begin Message ---
OK... now that I've obtained the username for one project, I have
another project, but this one looks rough.
Here's the goal:
1. When the user visits the page, find the user that is logged in locally.
2. Use the info from step #1 to obtain any e-mail address(es) from the
Active Directory.
3. Pass the e-mail address(es) to PHP and send an e-mail to the
address using mail().
#3 is cake. #1 and #2 are the parts I need help with. I have tried to
do this through PHP LDAP functions and have failed miserably. Anyone
know a way I can get the info I need?
-Aaron Kenney
--- End Message ---
--- Begin Message ---
Hi list,
i took this tutorial for creating xml file from scratch. toturial is is
present at sitepoint. www.sitepoint.com/print/management-system-php.
ok i dont know how to enable DOM/XML feature, when i do phpinfo(); it does
give that DOM/XML is enable but i cant run this tutorial. i try to debug and
found out that i cant create document root. ie. $doc =
domxml_new_doc("1.0"); [this part comes when u create addArticle.php file]it
gives me blank page.
any idea what is wrong?
my configuration is
webserver: Apache 2.0.53
php: PHP 5.0.3
thx in advance.
Faisal
--- End Message ---