Getting windows username into php/mysql

Getting windows username into php/mysql

am 20.03.2006 21:45:42 von Alex Blundell

HI, I have been searching the internet for days trying to find a way of
getting the windows username (%username%) of the current logged on user and
submitting it, along side some other information (entered into the form by
the user), to a MysQl database. This will enable me to know who has
submitted the form on my intranet.

I have quite a bit of php/mysql knowledge, and i know the windows variable
is %username% (easy i know) i just dont know how to get the variable into an
array so i can post it to mysql db


Any help would be great as im all out of place to look....

Thanks in advance



--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Getting windows username into php/mysql

am 21.03.2006 17:30:42 von David Collard

I tried it using getenv('username') and it worked ok
http://php.net/manual/en/function.getenv.php

Alex Blundell wrote:
> HI, I have been searching the internet for days trying to find a way of
> getting the windows username (%username%) of the current logged on user and
> submitting it, along side some other information (entered into the form by
> the user), to a MysQl database. This will enable me to know who has
> submitted the form on my intranet.
>
> I have quite a bit of php/mysql knowledge, and i know the windows variable
> is %username% (easy i know) i just dont know how to get the variable into an
> array so i can post it to mysql db
>
>
> Any help would be great as im all out of place to look....
>
> Thanks in advance
>
>
>
>

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: Getting windows username into php/mysql

am 21.03.2006 19:08:39 von Matt Murphy

That seems to grab the user that apache is running under, any idea about
the client's windows username?

Matt=20

> -----Original Message-----
> From: David Collard [mailto:meizawotmeiz@gmail.com]=20
> Sent: Tuesday, March 21, 2006 10:31 AM
> To: Alex Blundell
> Cc: php-windows@lists.php.net
> Subject: Re: [PHP-WIN] Getting windows username into php/mysql
>=20
> I tried it using getenv('username') and it worked ok=20
> http://php.net/manual/en/function.getenv.php
>=20
> Alex Blundell wrote:
> > HI, I have been searching the internet for days trying to=20
> find a way=20
> > of getting the windows username (%username%) of the current=20
> logged on=20
> > user and submitting it, along side some other information (entered=20
> > into the form by the user), to a MysQl database. This will=20
> enable me=20
> > to know who has submitted the form on my intranet.
> >
> > I have quite a bit of php/mysql knowledge, and i know the windows=20
> > variable is %username% (easy i know) i just dont know how=20
> to get the=20
> > variable into an array so i can post it to mysql db
> >
> >
> > Any help would be great as im all out of place to look....
> >
> > Thanks in advance
> >
> >
> >
> > =20
>=20
> --
> PHP Windows Mailing List (http://www.php.net/) To=20
> unsubscribe, visit: http://www.php.net/unsub.php
>=20
>=20

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Getting windows username into php/mysql

am 22.03.2006 06:21:31 von Aaron Kenney

I've had no luck with $_ENV['username'] or getenv('username').

Here's a page that I put together through suggestions using an Active
X object. Name the page test.php. It requires IE so beware:


if (isset($_POST['username']))
{
$username =3D $_POST['username'];
echo "returned
";
echo $username;
}
else
{
echo "go";
echo "


testing username script



onsubmit=3D'submitform()'>








";
}
?>


-Aaron Kenney



On 3/20/06, Alex Blundell wrote:
> HI, I have been searching the internet for days trying to find a way of
> getting the windows username (%username%) of the current logged on user a=
nd
> submitting it, along side some other information (entered into the form b=
y
> the user), to a MysQl database. This will enable me to know who has
> submitted the form on my intranet.
>
> I have quite a bit of php/mysql knowledge, and i know the windows variabl=
e
> is %username% (easy i know) i just dont know how to get the variable into=
an
> array so i can post it to mysql db
>
>
> Any help would be great as im all out of place to look....
>
> Thanks in advance
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: Getting windows username into php/mysql

am 22.03.2006 15:11:32 von kgrinberg

I believe what you're looking for is:

$_SERVER["REMOTE_USER"]

However, it'll only work if the client is authenticated - if you allow
anonymous access to the web site, the client will not be authenticated, so
there's no Windows username to get (you can check the logs to find out).
The details vary depending on your web server and client - IIS/IE is easiest
(on Windows), but I have it working with Apache/Firefox, so it's not
platform-exclusive. E-mail me directly if you're having issues with that,
as it doesn't really belong on this list...


-----Original Message-----
From: Matt Murphy [mailto:mmurphy@tc-tech.com]
Sent: Tuesday, March 21, 2006 1:09 PM
To: php-windows@lists.php.net
Subject: RE: [PHP-WIN] Getting windows username into php/mysql


That seems to grab the user that apache is running under, any idea about the
client's windows username?

Matt

> -----Original Message-----
> From: David Collard [mailto:meizawotmeiz@gmail.com]
> Sent: Tuesday, March 21, 2006 10:31 AM
> To: Alex Blundell
> Cc: php-windows@lists.php.net
> Subject: Re: [PHP-WIN] Getting windows username into php/mysql
>
> I tried it using getenv('username') and it worked ok
> http://php.net/manual/en/function.getenv.php
>
> Alex Blundell wrote:
> > HI, I have been searching the internet for days trying to
> find a way
> > of getting the windows username (%username%) of the current
> logged on
> > user and submitting it, along side some other information (entered
> > into the form by the user), to a MysQl database. This will
> enable me
> > to know who has submitted the form on my intranet.
> >
> > I have quite a bit of php/mysql knowledge, and i know the windows
> > variable is %username% (easy i know) i just dont know how
> to get the
> > variable into an array so i can post it to mysql db
> >
> >
> > Any help would be great as im all out of place to look....
> >
> > Thanks in advance
> >
> >
> >
> >
>
> --
> PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
> http://www.php.net/unsub.php
>
>

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Getting windows username into php/mysql

am 22.03.2006 16:15:17 von Aaron Kenney

I just tried my JS/ActiveX/PHP script on a PHP5 server using the ISAPI
module in IIS and it didn't work at all. Works fine under my PHP4
server using the CGI module. I don't understand what the difference
would be, but maybe someone could fill me in. Until further notice, I
retract my code because it doesn't work consistently on all PHP
servers.

The $_SERVER["REMOTE_USER"] method works ok, but returns the old Win
2000 style DOMAIN\username, rather than the new Windows 2003
username@domain.ext. I would be interested to see how this formatting
would fare when used to log in to a Windows 2003 server via the LDAP
functions.

-Aaron Kenney


On 3/22/06, Grinberg, Kevin wrote:
> I believe what you're looking for is:
>
> $_SERVER["REMOTE_USER"]
>
> However, it'll only work if the client is authenticated - if you allow
> anonymous access to the web site, the client will not be authenticated, s=
o
> there's no Windows username to get (you can check the logs to find out).
> The details vary depending on your web server and client - IIS/IE is easi=
est
> (on Windows), but I have it working with Apache/Firefox, so it's not
> platform-exclusive. E-mail me directly if you're having issues with that=
,
> as it doesn't really belong on this list...
>
>
> -----Original Message-----
> From: Matt Murphy [mailto:mmurphy@tc-tech.com]
> Sent: Tuesday, March 21, 2006 1:09 PM
> To: php-windows@lists.php.net
> Subject: RE: [PHP-WIN] Getting windows username into php/mysql
>
>
> That seems to grab the user that apache is running under, any idea about =
the
> client's windows username?
>
> Matt
>
> > -----Original Message-----
> > From: David Collard [mailto:meizawotmeiz@gmail.com]
> > Sent: Tuesday, March 21, 2006 10:31 AM
> > To: Alex Blundell
> > Cc: php-windows@lists.php.net
> > Subject: Re: [PHP-WIN] Getting windows username into php/mysql
> >
> > I tried it using getenv('username') and it worked ok
> > http://php.net/manual/en/function.getenv.php
> >
> > Alex Blundell wrote:
> > > HI, I have been searching the internet for days trying to
> > find a way
> > > of getting the windows username (%username%) of the current
> > logged on
> > > user and submitting it, along side some other information (entered
> > > into the form by the user), to a MysQl database. This will
> > enable me
> > > to know who has submitted the form on my intranet.
> > >
> > > I have quite a bit of php/mysql knowledge, and i know the windows
> > > variable is %username% (easy i know) i just dont know how
> > to get the
> > > variable into an array so i can post it to mysql db
> > >
> > >
> > > Any help would be great as im all out of place to look....
> > >
> > > Thanks in advance
> > >
> > >
> > >
> > >
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
> > http://www.php.net/unsub.php
> >
> >
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: Getting windows username into php/mysql

am 22.03.2006 16:49:41 von Matt Murphy

Hmm... I'm guessing you could take that variable, do an explode on the
\ and add the @domain.ext, that is if you know the extension. That
should work for my purposes at least.=20

Thanks,

Matt
=20
> The $_SERVER["REMOTE_USER"] method works ok, but returns the=20
> old Win 2000 style DOMAIN\username, rather than the new=20
> Windows 2003 username@domain.ext. I would be interested to=20
> see how this formatting would fare when used to log in to a=20
> Windows 2003 server via the LDAP functions.

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Getting windows username into php/mysql

am 28.03.2006 19:32:18 von Mike Milano

Alex Blundell wrote:
> HI, I have been searching the internet for days trying to find a way of
> getting the windows username (%username%) of the current logged on user and
> submitting it, along side some other information (entered into the form by
> the user), to a MysQl database. This will enable me to know who has
> submitted the form on my intranet.
>
> I have quite a bit of php/mysql knowledge, and i know the windows variable
> is %username% (easy i know) i just dont know how to get the variable into an
> array so i can post it to mysql db
>
>
> Any help would be great as im all out of place to look....
>
> Thanks in advance
>
>

It was a long time ago when I was working with this, but I believe I had
to go into IIS -> default website -> properties -> directory security

check 'Integrated Windows Authentication'

I don't recall if Anonomous access had to be turned off or not.

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php