php-general Digest 24 Mar 2008 13:38:16 -0000 Issue 5365

Topics (messages 272020 through 272031):

Re: De-Duplicate A Query Result List
        272020 by: Greg Bowser

ob_start: Capturing STDOUT and STDERR
        272021 by: Greg Sims
        272022 by: Casey
        272023 by: Jonesy

Date math
        272024 by: Ron Piggott
        272025 by: Simon Welsh
        272026 by: Casey

This beats me (variable not being passed through pages)
        272027 by: Mário Gamito

restricting access to folders on server
        272028 by: Sudhakar
        272029 by: n3or
        272030 by: Richard Heyes

Stored Procedure Question
        272031 by: admin.buskirkgraphics.com

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 ---
Sounds like you want something like the following:

SELECT DISTINCT category FROM `contacts` WHERE state='california';

--GREG

--- End Message ---
--- Begin Message ---
Hey There,

I looked at the ob_start manual and found a segment of code that can be used
to capture the output of a shell script and place it into a log file.  One
of the entries indicates this should work for both STDOUT and STDERR
(29-Mar-2007).  I wrote the following piece of code to test it out.

function logger($buffer)
      {
                $handle = fopen('/var/log/test.log', 'a');
                fwrite($handle, $buffer);
                fclose($handle);
      }

      ob_start("logger");

This will capture the output buffer until the shell terminates when the
buffer is dumped to the test.log file.  This is a simple mechanism and it
works really well to keep STDOUT from going to the console and logging it.
Unfortunately, STDERR continues to go to the console which is what I am
working to avoid.  

I would like to capture STDOUT and STDERR using this technique. I am working
to create a self contained script that does not rely on some external script
to capture the output.  The actual application needs to perform some
post-processing of the output buffer at the end of the script.

Any pointers in the correct direction would be helpful!  Thanks, Greg


--- End Message ---
--- Begin Message ---
On Sun, Mar 23, 2008 at 6:08 PM, Greg Sims <[EMAIL PROTECTED]> wrote:
> Hey There,
>
>  I looked at the ob_start manual and found a segment of code that can be used
>  to capture the output of a shell script and place it into a log file.  One
>  of the entries indicates this should work for both STDOUT and STDERR
>  (29-Mar-2007).  I wrote the following piece of code to test it out.
>
>  function logger($buffer)
>       {
>                 $handle = fopen('/var/log/test.log', 'a');
>                 fwrite($handle, $buffer);
>                 fclose($handle);
>       }
>
>       ob_start("logger");
>
>  This will capture the output buffer until the shell terminates when the
>  buffer is dumped to the test.log file.  This is a simple mechanism and it
>  works really well to keep STDOUT from going to the console and logging it.
>  Unfortunately, STDERR continues to go to the console which is what I am
>  working to avoid.
>
>  I would like to capture STDOUT and STDERR using this technique. I am working
>  to create a self contained script that does not rely on some external script
>  to capture the output.  The actual application needs to perform some
>  post-processing of the output buffer at the end of the script.
>
>  Any pointers in the correct direction would be helpful!  Thanks, Greg
>
>
>  --
>  PHP General Mailing List (http://www.php.net/)
>  To unsubscribe, visit: http://www.php.net/unsub.php
>
>

You could use set_error_handler() and make your own function to echo
out the error.

-- 
-Casey

--- End Message ---
--- Begin Message ---
On Sun, 23 Mar 2008 18:08:19 -0700, Greg Sims wrote:
> Hey There,
>
> I looked at the ob_start manual and found a segment of code that can be used
> to capture the output of a shell script and place it into a log file.  One
> of the entries indicates this should work for both STDOUT and STDERR
> (29-Mar-2007).  I wrote the following piece of code to test it out.
>
> function logger($buffer)
>       {
>               $handle = fopen('/var/log/test.log', 'a');
>               fwrite($handle, $buffer);
>               fclose($handle);
>       }
>
>       ob_start("logger");

        ob_start("logger 2>&1");

???

Jonesy
-- 
  Marvin L Jones    | jonz          | W3DHJ  | linux
   38.24N  104.55W  |  @ config.com | Jonesy |  OS/2
    *** Killfiling google posts: <http://jonz.net/ng.htm>


--- End Message ---
--- Begin Message ---
I have this math equation this list helped me generate a few weeks ago.
The purpose is to calculate how many days have passed between 2 dates.  

Right now my output ($difference) is 93.9583333333 days.  

I am finding this a little weird.  Does anyone see anything wrong with
the way this is calculated:

$date1 = strtotime($date1); (March 21st 2008)
$date2 = strtotime($date2); (December 18th 2007)

echo $date1 => 1206072000
echo $date2 => 1197954000

#86400 is 60 seconds x 60 minutes x 24 hours (in other words 1 days
worth of seconds)

$factor = 86400;

$difference = (($date1 - $date2) / $factor);



--- End Message ---
--- Begin Message ---

On 24/03/2008, at 5:17, Ron Piggott wrote:
I have this math equation this list helped me generate a few weeks ago.
The purpose is to calculate how many days have passed between 2 dates.

Right now my output ($difference) is 93.9583333333 days.

I am finding this a little weird.  Does anyone see anything wrong with
the way this is calculated:

$date1 = strtotime($date1); (March 21st 2008)
$date2 = strtotime($date2); (December 18th 2007)

echo $date1 => 1206072000
echo $date2 => 1197954000

#86400 is 60 seconds x 60 minutes x 24 hours (in other words 1 days
worth of seconds)

$factor = 86400;

$difference = (($date1 - $date2) / $factor);

Depending on what you want, wrap it in round() ceil() or floor()



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


---
Simon Welsh
Admin of http://simon.geek.nz/

Windows is a joke operating system. Hell, it's not even an operating system. NT is Not Tough enough for me either. 95 is how may times it will crash an hour.

http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e



--- End Message ---
--- Begin Message ---
On Sun, Mar 23, 2008 at 9:17 PM, Ron Piggott <[EMAIL PROTECTED]> wrote:
> I have this math equation this list helped me generate a few weeks ago.
>  The purpose is to calculate how many days have passed between 2 dates.
>
<snip>
>
>  $date1 = strtotime($date1); (March 21st 2008)
>  $date2 = strtotime($date2); (December 18th 2007)
>
>  echo $date1 => 1206072000
>  echo $date2 => 1197954000

Seems to be a time zone issue.1206057600 is the actual timestamp for
March 21st, 2008 GMT. I don't know what time zone 1206072000 is is.

-- 
-Casey

--- End Message ---
--- Begin Message ---
Hi,

I have a ASP.NET / C# page calling a webmail Linux server:

 WebRequest request =
WebRequest.Create("http://192.168.1.4/horde/imp/index.php?username=gamito";);
 (etc...)

 It seems to work as in my Linux Apache logs, i get:
 (...) "GET /horde/imp/index.php?username=gamito HTTP/1.1" 200 223

 File index.php is:

 <?php
 $username_from_iis = $_REQUEST['username'];
 print('Hello ' . $username_from_iis);
 ?>

But index.php only shows "Hello" and not "Hello gamito" as I'd expect.

Any ideias ?

Any help would be appreciated.

Warm Regards,
Mário Gamito

--- End Message ---
--- Begin Message ---
i am using apache server and presently when i try accessing any folders of
my website i am able to browse the files ex = www.website.com/images which
is a serious security risk as i am building a forum website using php and
mysql.

in the root directory i have created a .htaccess file and whenever someone
access a file which is not on the server i have created a user friendly
message that the file does not exist instead of a 404 error message
displayed by the browser.

similar to this how can i go about restricting users to browse all my
folders in the toot directory. if anyone accesses for ex =
www.website.com/phpscripts an alert should appear asking them to enter a
username and password.

1. how can i do this using apache.
2. where do i write the username and password information and will this
apply to all the folders in the root directory or specific directories.

please advice.

thanks.

--- End Message ---
--- Begin Message ---
Sudhakar schrieb:
i am using apache server and presently when i try accessing any folders of
my website i am able to browse the files ex = www.website.com/images which
is a serious security risk as i am building a forum website using php and
mysql.

in the root directory i have created a .htaccess file and whenever someone
access a file which is not on the server i have created a user friendly
message that the file does not exist instead of a 404 error message
displayed by the browser.

similar to this how can i go about restricting users to browse all my
folders in the toot directory. if anyone accesses for ex =
www.website.com/phpscripts an alert should appear asking them to enter a
username and password.

1. how can i do this using apache.
2. where do i write the username and password information and will this
apply to all the folders in the root directory or specific directories.

please advice.

thanks.

Hey,
I think that should be the right Thing for you: http://httpd.apache.org/docs/2.0/howto/auth.html

Have a nice Day
n3or

--- End Message ---
--- Begin Message ---
i am using apache server and presently when i try accessing any folders of
my website i am able to browse the files ex = www.website.com/images which
is a serious security risk as i am building a forum website using php and
mysql.

Assuming your images are for public consumption and that that dir only contains those images, then it's not a security risk.

in the root directory i have created a .htaccess file and whenever someone
access a file which is not on the server i have created a user friendly
message that the file does not exist instead of a 404 error message
displayed by the browser.

similar to this how can i go about restricting users to browse all my
folders in the toot directory. if anyone accesses for ex =
www.website.com/phpscripts an alert should appear asking them to enter a
username and password.

You could put this in a .htaccess file:

AuthType Basic
AuthName "Administration Area"
AuthUserFile "acl/admin.acl"
Require valid-user

acl/admin.acl is relative to the server root. You can create it using the htpasswd command.

2. where do i write the username and password information and will this
apply to all the folders in the root directory or specific directories.

If you put that in .htaccess file, it will apply to that directory and any subdirectories.

--
Richard Heyes
Employ me:
http://www.phpguru.org/cv

--- End Message ---
--- Begin Message ---
I am very aware most of you do not use a stored procedure in mysql. 

However with my latest C++ programming I have created a few that make life a 
dream. 

The issue I am having. When I call the stored procedure I would like the end of 
the procedure to call or invoke a php script.

I have read many MySQL Stored Procedure documents, nothing as of yet that 
describes what the best practic syntax or structure of a php script call.




"Reality is a delusion brought on by alcohol deficiency $1000"
"Fixing the GUI between the chair and the keyboard Priceless"

--- End Message ---

Reply via email to