php-windows Digest 4 Sep 2004 04:44:04 -0000 Issue 2382

Topics (messages 24511 through 24516):

Re: Converting a dos console batch file to aphp shell script
        24511 by: Gryffyn, Trevor
        24514 by: Frank M. Kromann

Re: NT username detectable?
        24512 by: Gryffyn, Trevor
        24513 by: Gryffyn, Trevor
        24515 by: Manuel Lemos

Help required for developing word reports.
        24516 by: CBharadwaj

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 ---
Good to know. But wouldn't "flush()" or something still have worked?

Maybe try isolating the issue, Jim.  Write a test script and slowly add
things to it until you get to the point where it's buffering too much.
Maybe it internally buffers whatever commands you're trying to run (you
using exec or something?) and doesn't hold it in the "output buffer" per
se.  Maybe it's in a different buffer.  I don't know.

Mind posting some sample code for us to look at?

-TG

> -----Original Message-----
> From: Frank M. Kromann [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, September 02, 2004 9:10 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] Converting a dos console batch file to 
> aphp shell script
> 
> 
> There is another directive too:
> 
> ; Implicit flush tells PHP to tell the output layer to flush itself
> ; automatically after every output block.  This is equivalent 
> to calling
> the
> ; PHP function flush() after each and every call to print() 
> or echo() and
> each
> ; and every HTML block.  Turning this option on has serious 
> performance
> ; implications and is generally recommended for debugging 
> purposes only.
> implicit_flush = Off
> 
> When you are using the CGI version this is off by default and the CLI
> version sets this to on by default.
> 
> - Frank
> 
> 
> > Silly response, but did you try the "flush()" command?  
> > 
> > There's also a setting in the PHP.INI:
> > output_buffering = Off
> > 
> > Also check the Output Control Functions:
> > http://us4.php.net/manual/en/ref.outcontrol.php
> > 
> > Hope this helps!
> > 
> > -TG
> > 
> > > -----Original Message-----
> > > From: Jim MacDiarmid [mailto:[EMAIL PROTECTED] 
> > > Sent: Thursday, September 02, 2004 11:31 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: [PHP-WIN] Converting a dos console batch file to a 
> > > php shell script
> > > 
> > > 
> > > 
> > > Hi everyone,
> > > 
> > > I've been searching for info to help me troubleshoot an issue 
> > > I'm having
> > > with displaying output to the console during script 
> > > processing, but I'm not
> > > having much luck. I'm hoping someone can shed some light on 
> > > this or point me
> > > in right direction.
> > > 
> > > I have a foreach construct that loops through an associative 
> > > array and calls
> > > a nested function. Inside the foreach loop I would like to display
> the
> > > current array information that is being processed prior to 
> > > passing to the
> > > nested function call. The problem I'm running into is that 
> > > the output to the
> > > console window is delayed till after the forloop as 
> > > completed, as if it's
> > > being buffered then flushed at the end.
> > > 
> > > Any ideas how I can display information as processing occurs?
> > > 
> > > Thanks in advance,
> > > 
> > > Jim
> > > 
> > > -- 
> > > 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
> 
> 

--- End Message ---
--- Begin Message ---
Hello,

Yes flush() would do the trick, but the CLI version is designed for
command line usage. One thing I like about that is the error messages (and
other output from PHP) is stripped from HTML tags and HTTP headers.

- Frank

> Good to know. But wouldn't "flush()" or something still have worked?
> 
> Maybe try isolating the issue, Jim.  Write a test script and slowly add
> things to it until you get to the point where it's buffering too much.
> Maybe it internally buffers whatever commands you're trying to run (you
> using exec or something?) and doesn't hold it in the "output buffer"
per
> se.  Maybe it's in a different buffer.  I don't know.
> 
> Mind posting some sample code for us to look at?
> 
> -TG
> 
> > -----Original Message-----
> > From: Frank M. Kromann [mailto:[EMAIL PROTECTED] 
> > Sent: Thursday, September 02, 2004 9:10 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: [PHP-WIN] Converting a dos console batch file to 
> > aphp shell script
> > 
> > 
> > There is another directive too:
> > 
> > ; Implicit flush tells PHP to tell the output layer to flush itself
> > ; automatically after every output block.  This is equivalent 
> > to calling
> > the
> > ; PHP function flush() after each and every call to print() 
> > or echo() and
> > each
> > ; and every HTML block.  Turning this option on has serious 
> > performance
> > ; implications and is generally recommended for debugging 
> > purposes only.
> > implicit_flush = Off
> > 
> > When you are using the CGI version this is off by default and the CLI
> > version sets this to on by default.
> > 
> > - Frank
> > 
> > 
> > > Silly response, but did you try the "flush()" command?  
> > > 
> > > There's also a setting in the PHP.INI:
> > > output_buffering = Off
> > > 
> > > Also check the Output Control Functions:
> > > http://us4.php.net/manual/en/ref.outcontrol.php
> > > 
> > > Hope this helps!
> > > 
> > > -TG
> > > 
> > > > -----Original Message-----
> > > > From: Jim MacDiarmid [mailto:[EMAIL PROTECTED] 
> > > > Sent: Thursday, September 02, 2004 11:31 AM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [PHP-WIN] Converting a dos console batch file to a 
> > > > php shell script
> > > > 
> > > > 
> > > > 
> > > > Hi everyone,
> > > > 
> > > > I've been searching for info to help me troubleshoot an issue 
> > > > I'm having
> > > > with displaying output to the console during script 
> > > > processing, but I'm not
> > > > having much luck. I'm hoping someone can shed some light on 
> > > > this or point me
> > > > in right direction.
> > > > 
> > > > I have a foreach construct that loops through an associative 
> > > > array and calls
> > > > a nested function. Inside the foreach loop I would like to
display
> > the
> > > > current array information that is being processed prior to 
> > > > passing to the
> > > > nested function call. The problem I'm running into is that 
> > > > the output to the
> > > > console window is delayed till after the forloop as 
> > > > completed, as if it's
> > > > being buffered then flushed at the end.
> > > > 
> > > > Any ideas how I can display information as processing occurs?
> > > > 
> > > > Thanks in advance,
> > > > 
> > > > Jim
> > > > 
> > > > -- 
> > > > 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
> > 
> > 
> 

--- End Message ---
--- Begin Message ---
Probably not the most reliable way (actually, I know it's not 100%
reliable), but the way I use for quick and dirty, informal usage logging
is this:

$ipaddress = $_SERVER["REMOTE_ADDR"];

$nbtstat = "nbtstat -A ". $ipaddress;
exec ($nbtstat,$result);
foreach ($result as $row) {
  if (strpos($row,"<03>")) $username = strtok($row," ");
}


This only works if you're on the same network and the users are logging
into their box.

It seems to fail when someone is logged into multiple machines at once,
you end up getting the computer name or something.  Probably does this
under other circumstances as well.  But there's some little 80% reliable
way of doing it.

If you find a better way, by all means let me know!

-TG

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, September 02, 2004 3:49 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] NT username detectable?
> 
> 
> In the html headers, the server sees the clients OS, user agent, IP 
> address etc. Is there a way on a local LAN a server might be 
> able to know 
> the username of the client that sends a request?
> 
> I've checked all $_SERVER variables, PHP_AUTH_USER  etc 
> require the auth 
> box to be displayed. I'm thinking it might be possible to 
> know which user 
> is logged in when the request is made, possibly by using COM or even 
> (gasp) .NET, without having to ask the user his username.
> 
> Any ideas if this can be accomplished at all?
> 
> Right now we have Firefox clients and Apache with PHP in an Active 
> Directory domain with NT4 compatibility, but we can move to IE6 with 
> IIS+PHP if that will work.
> 

--- End Message ---
--- Begin Message ---
Won't "GetEnv" get the environment of the machine the script is run on?
So wouldn't that end up giving you the login of the user logged into the
web server, not the remote user?

I just did a test and it didn't work.  And I don't see my domain
username anywhere in the $_ENV variable either.

Here's a way to do it without calling NBTSTAT, but essentially the same
method with the same flaws:
http://www.experts-exchange.com/Web/Web_Languages/PHP/Q_20562144.html


On this site:
http://vanlandw.no-ip.com/php/test2.php

The PHPINFO shows a LOGON_USER but mine doesn't.  How odd.  Their
LOGON_USER is blank, but it still shows up where it doesn't on my
server.  Wonder why?  Anyone have any thoughts?  (Maybe it's blank
because it's trying to get MY username and that doesn't work across the
internet?  Still not sure why it shows up on their PHPINFO and not
mine).


Looks like "Integrated Windows Authentication" needs to be turned ON on
the server in order to access these variables.  Which makes sense.  I
need to talk to our IT guys and see if they can switch that ON for me.

Here's some info:
http://forums.devshed.com/t66723/s.html
http://www.microsoft.com/windows2000/en/server/iis/default.asp
http://www.microsoft.com/windows2000/en/server/iis/htm/core/iiabasc.htm?
id=75#challenge

Hope this helps!

-TG



> -----Original Message-----
> From: Manuel Lemos [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, September 02, 2004 6:02 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Re: NT username detectable?
> 
> 
> Hello,
> 
> On 09/02/2004 04:48 PM, [EMAIL PROTECTED] wrote:
> > In the html headers, the server sees the clients OS, user agent, IP 
> > address etc. Is there a way on a local LAN a server might 
> be able to know 
> > the username of the client that sends a request?
> > 
> > I've checked all $_SERVER variables, PHP_AUTH_USER  etc 
> require the auth 
> > box to be displayed. I'm thinking it might be possible to 
> know which user 
> > is logged in when the request is made, possibly by using 
> COM or even 
> > (gasp) .NET, without having to ask the user his username.
> > 
> > Any ideas if this can be accomplished at all?
> > 
> > Right now we have Firefox clients and Apache with PHP in an Active 
> > Directory domain with NT4 compatibility, but we can move to 
> IE6 with 
> > IIS+PHP if that will work.
> 
> If the Web server is configured to request NTLM authentication, your 
> script may access the authenticated user via GetEnv("LOGON_USER") .
> 
> -- 
> 
> Regards,
> Manuel Lemos
> 
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
> 
> PHP Reviews - Reviews of PHP books and other products
> http://www.phpclasses.org/reviews/
> 
> Metastorage - Data object relational mapping layer generator
> http://www.meta-language.net/metastorage.html
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
Hello,

On 09/03/2004 11:12 AM, Trevor Gryffyn wrote:
Won't "GetEnv" get the environment of the machine the script is run on?
So wouldn't that end up giving you the login of the user logged into the
web server, not the remote user?

No, that is an environment variable set by IIS for pages on which it is requesting NTLM authentication. This means that IIS already has successfully authenticated the remote user. The LOGON_USER contains the user name.



I just did a test and it didn't work.  And I don't see my domain
username anywhere in the $_ENV variable either.

You need to configure IIS to require NTLM authentication for that page or else nothing happens.



The PHPINFO shows a LOGON_USER but mine doesn't.  How odd.  Their
LOGON_USER is blank, but it still shows up where it doesn't on my
server.  Wonder why?  Anyone have any thoughts?  (Maybe it's blank
because it's trying to get MY username and that doesn't work across the
internet?  Still not sure why it shows up on their PHPINFO and not
mine).

It will only work if the remote user has logged in the same Windows domain.


--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

--- End Message ---
--- Begin Message ---
Dear All,

I want to developing reports using PHP.
These reports i have to develop on MS WORD.

I have a database with multiple records

                 VAL 1 | VAL 2
                 -----------------
                 VAL3 | VAL 4
                 ----------------
                 VAL 5 | VAL 6
How to print these multiple rows on word in this format.



Thanks in advance.
Bharadwaj.

--- End Message ---

Reply via email to