php-general Digest 2 Aug 2003 11:39:33 -0000 Issue 2212

Topics (messages 158019 through 158039):

Re: A long float number.
        158019 by: zavaboy

strings
        158020 by: Anthony Ritter
        158024 by: Curt Zirzow
        158028 by: Anthony Ritter
        158032 by: Curt Zirzow
        158037 by: Anthony Ritter

Re: weird php error
        158021 by: Jim Lucas
        158035 by: Matt Giddings
        158036 by: Matt Giddings

Test a zip file for validity
        158022 by: Ivo Pletikosic
        158023 by: Chris W. Parker
        158025 by: Curt Zirzow

strange issue: cygwin- why can't I configure the php.ini ?
        158026 by: kalmen
        158034 by: Jason Wong

Verisign PFPRO API & PHP: How to ensure hitting "STOP" in the browser will not kill 
the transcation
        158027 by: e
        158029 by: Curt Zirzow

plPHP released.. yes PostgreSQL functions in PHP
        158030 by: Joshua D. Drake
        158033 by: Curt Zirzow

embedding php in C
        158031 by: April

Pushing array onto array
        158038 by: Hank TT

LDAP_connect()
        158039 by: Ron Allen

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 ---
Thanks! number_format() fixed it!

"Bogdan Stancescu" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Keeping it on one line doesn't affect the calculations (as it
> shouldn't). Try using either sprintf() or number_format() for this
> purpose (the latter is generally preferred, but I don't know exactlt
> what you're after).
>
> Bogdan
>



--- End Message ---
--- Begin Message ---
In the following snippet, I'm trying to open and read a URL into the
variable $contents.
I'd like to use preg_replace() to return only part of that string beginning
with say - regional and ending with new - but I get the complete URL string
returned.

Thank you for any assistance.
Tony Ritter
...............................

<?
$theurl="http://weather.noaa.gov/pub/data/summaries/regional/ny/albany.txt";;
if (!($fp=fopen($theurl, "r")))
 {
  echo "Could not open the URL.";
  exit;
 }
$contents=fread($fp, 1000000);
$newtext= preg_replace("/.*?(regional.*new).*/","1",$contents);
fclose($fp);
echo $newtext;
?>




--- End Message ---
--- Begin Message ---
* Thus wrote Anthony Ritter ([EMAIL PROTECTED]):
> In the following snippet, I'm trying to open and read a URL into the
> variable $contents.
> I'd like to use preg_replace() to return only part of that string beginning
> with say - regional and ending with new - but I get the complete URL string
> returned.
>
> [...]
>
> $newtext= preg_replace("/.*?(regional.*new).*/","1",$contents);


This exact thing was talked about earlier today, with the subject
'Using eregi_replace()'.

http://marc.theaimsgroup.com/?t=105974851200006&r=1&w=2

HTH,

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
Curt Zirzow wrote in message:

> This exact thing was talked about earlier today, with the subject
> 'Using eregi_replace()'.
........................

Right.

However, I've tried using the following code in which the text from the URL
is printed out completely and then I change the variable from $contents to
$text and using the line with preg_replace(), it still outputs the complete
text without the pattern match.

Any advice will be helpful.
Thank you.
TR
............................

<?
$theurl="http://weather.noaa.gov/pub/data/summaries/regional/ny/albany.txt";;
if (!($fp=fopen($theurl, "r")))
 {
  echo "Could not open the URL.";
  exit;
 }
$contents=fread($fp, 1000000);
fclose($fp);
echo $contents;
echo "<br>";
$text=$contents;
$newtext= preg_replace("!.*?(REGIONAL.*YORK).*!","$1",$text);
echo $newtext;  // outputs the same text as above
?>
..............................



--- End Message ---
--- Begin Message ---
* Thus wrote Anthony Ritter ([EMAIL PROTECTED]):
> Curt Zirzow wrote in message:
> 
> > This exact thing was talked about earlier today, with the subject
> > 'Using eregi_replace()'.
> ........................
> 
> Right.
> 
> However, I've tried using the following code in which the text from the URL
> is printed out completely and then I change the variable from $contents to
> $text and using the line with preg_replace(), it still outputs the complete
> text without the pattern match.
 
hm.. I sort of misunderstood, preg_replace isn't what you need. use
preg_match instead.

I did some testing you can see the code and results here:
http://zirzow.dyndns.org/html/php/tests/preg/parse_doc.php

> $newtext= preg_replace("!.*?(REGIONAL.*YORK).*!","$1",$text);
btw, there these should be single quotes ~~~~~~~~~~^  ^

or "\$1" so php doesn't expand the variable (even though its an
illagal php var name.)


HTH,

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
Curt Zirzow writes:
> I did some testing you can see the code and results here:
> http://zirzow.dyndns.org/html/php/tests/preg/parse_doc.php
..................

Thanks Curt.

I checked it out and I still pick up the following lines which I was looking
to delete on the pattern match.

They are:
.............
Expires:No;;725283  //line 1
AWUS41 KALY 012014 //line 2
RWSALB // line 3
.................

It could be that when the URL file is being opened and read that these
characters are on _three_ different_ lines as opposed to one line/string and
the match is not being met.

I was looking to delete those lines and to start the match at REGIONAL.

Best...
TR




--- End Message ---
--- Begin Message ---
yes it could be in the httpd.conf file.

look in your VirtualHost block and see if something there refers to a file
called loging.php

Jim Lucas
----- Original Message -----
From: "Matt Giddings" <[EMAIL PROTECTED]>
To: "'David Nicholson'" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, August 01, 2003 4:33 PM
Subject: RE: [PHP] weird php error


David,

  This is what my php.ini file looks like and I don't seem to have any
.htaccess files.  Could it be something in the httpd.conf file that’s
pointing to an invalid file/directory?

; Automatically add files before or after any PHP document.
auto_prepend_file =
auto_append_file =

Matt


> -----Original Message-----
> From: David Nicholson [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 01, 2003 7:13 PM
> To: Matt Giddings
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] weird php error
>
> Hello,
>
> This is a reply to an e-mail that you wrote on Sat, 2 Aug 2003 at
> 00:10, lines prefixed by '>' were originally written by you.
> > Hello,
> >   I'm getting a weird warning message from a php script that I'm
> > working
> > on.  Right now the script does not contain any include or require
> > statements and is basically a very simple straight forward script.
>
> > But
> > when I try to execute via the browser I get the following error:
> > Warning: Failed opening '/var/www/main/htdocs/login.php' for
> inclusion
> > (include_path='.:/usr/share/pear') in Unknown on line 0
> > Any clues?  I can send a copy of the script if anybody would
> like.
>
> You have your auto_prepend_file value set to a file that does not
> exist in your php.ini file or a .htaccess file.  I just tested it and
> it gives this exact error.
>
> HTH
>
> David.
>
> --
> phpmachine :: The quick and easy to use service providing you with
> professionally developed PHP scripts :: http://www.phpmachine.com/
>
>           Professional Web Development by David Nicholson
>                     http://www.djnicholson.com/
>
>     QuizSender.com - How well do your friends actually know you?
>                      http://www.quizsender.com/
>                     (developed entirely in PHP)
>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.504 / Virus Database: 302 - Release Date: 7/24/2003
>

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.504 / Virus Database: 302 - Release Date: 7/24/2003



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




--- End Message ---
--- Begin Message ---
Haven't found anything yet.  The login.php file is the one I'm trying to
view when I get that error.  I have a second file "info.php" that works
fine, but all it contains is "<?php phpinfo(); ?>".  So I know
apache/php is working, I just don't know why it isn't working with my
login script.

Matt

> -----Original Message-----
> From: Jim Lucas [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 01, 2003 8:02 PM
> To: Matt Giddings; 'David Nicholson'
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] weird php error
> 
> yes it could be in the httpd.conf file.
> 
> look in your VirtualHost block and see if something there refers to a
file
> called loging.php
> 
> Jim Lucas
> ----- Original Message -----
> From: "Matt Giddings" <[EMAIL PROTECTED]>
> To: "'David Nicholson'" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Friday, August 01, 2003 4:33 PM
> Subject: RE: [PHP] weird php error
> 
> 
> David,
> 
>   This is what my php.ini file looks like and I don't seem to have any
> .htaccess files.  Could it be something in the httpd.conf file that’s
> pointing to an invalid file/directory?
> 
> ; Automatically add files before or after any PHP document.
> auto_prepend_file =
> auto_append_file =
> 
> Matt
> 
> 
> > -----Original Message-----
> > From: David Nicholson [mailto:[EMAIL PROTECTED]
> > Sent: Friday, August 01, 2003 7:13 PM
> > To: Matt Giddings
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP] weird php error
> >
> > Hello,
> >
> > This is a reply to an e-mail that you wrote on Sat, 2 Aug 2003 at
> > 00:10, lines prefixed by '>' were originally written by you.
> > > Hello,
> > >   I'm getting a weird warning message from a php script that I'm
> > > working
> > > on.  Right now the script does not contain any include or require
> > > statements and is basically a very simple straight forward script.
> >
> > > But
> > > when I try to execute via the browser I get the following error:
> > > Warning: Failed opening '/var/www/main/htdocs/login.php' for
> > inclusion
> > > (include_path='.:/usr/share/pear') in Unknown on line 0
> > > Any clues?  I can send a copy of the script if anybody would
> > like.
> >
> > You have your auto_prepend_file value set to a file that does not
> > exist in your php.ini file or a .htaccess file.  I just tested it
and
> > it gives this exact error.
> >
> > HTH
> >
> > David.
> >
> > --
> > phpmachine :: The quick and easy to use service providing you with
> > professionally developed PHP scripts :: http://www.phpmachine.com/
> >
> >           Professional Web Development by David Nicholson
> >                     http://www.djnicholson.com/
> >
> >     QuizSender.com - How well do your friends actually know you?
> >                      http://www.quizsender.com/
> >                     (developed entirely in PHP)
> >
> >
> > ---
> > Incoming mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.504 / Virus Database: 302 - Release Date: 7/24/2003
> >
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.504 / Virus Database: 302 - Release Date: 7/24/2003
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> 
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.504 / Virus Database: 302 - Release Date: 7/24/2003
> 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.504 / Virus Database: 302 - Release Date: 7/24/2003
 


--- End Message ---
--- Begin Message ---
Duh, I figured it out.  I had the permissions screwed up on the file.
Thanks for your help and sorry for bothering everybody else with my
ignorance.

Matt

> -----Original Message-----
> From: Matt Giddings [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 01, 2003 11:25 PM
> To: 'Jim Lucas'; 'David Nicholson'
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP] weird php error
> 
> Haven't found anything yet.  The login.php file is the one I'm trying
to
> view when I get that error.  I have a second file "info.php" that
works
> fine, but all it contains is "<?php phpinfo(); ?>".  So I know
> apache/php is working, I just don't know why it isn't working with my
> login script.
> 
> Matt
> 
> > -----Original Message-----
> > From: Jim Lucas [mailto:[EMAIL PROTECTED]
> > Sent: Friday, August 01, 2003 8:02 PM
> > To: Matt Giddings; 'David Nicholson'
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP] weird php error
> >
> > yes it could be in the httpd.conf file.
> >
> > look in your VirtualHost block and see if something there refers to
a
> file
> > called loging.php
> >
> > Jim Lucas
> > ----- Original Message -----
> > From: "Matt Giddings" <[EMAIL PROTECTED]>
> > To: "'David Nicholson'" <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>
> > Sent: Friday, August 01, 2003 4:33 PM
> > Subject: RE: [PHP] weird php error
> >
> >
> > David,
> >
> >   This is what my php.ini file looks like and I don't seem to have
any
> > .htaccess files.  Could it be something in the httpd.conf file
that’s
> > pointing to an invalid file/directory?
> >
> > ; Automatically add files before or after any PHP document.
> > auto_prepend_file =
> > auto_append_file =
> >
> > Matt
> >
> >
> > > -----Original Message-----
> > > From: David Nicholson [mailto:[EMAIL PROTECTED]
> > > Sent: Friday, August 01, 2003 7:13 PM
> > > To: Matt Giddings
> > > Cc: [EMAIL PROTECTED]
> > > Subject: Re: [PHP] weird php error
> > >
> > > Hello,
> > >
> > > This is a reply to an e-mail that you wrote on Sat, 2 Aug 2003 at
> > > 00:10, lines prefixed by '>' were originally written by you.
> > > > Hello,
> > > >   I'm getting a weird warning message from a php script that I'm
> > > > working
> > > > on.  Right now the script does not contain any include or
require
> > > > statements and is basically a very simple straight forward
script.
> > >
> > > > But
> > > > when I try to execute via the browser I get the following error:
> > > > Warning: Failed opening '/var/www/main/htdocs/login.php' for
> > > inclusion
> > > > (include_path='.:/usr/share/pear') in Unknown on line 0
> > > > Any clues?  I can send a copy of the script if anybody would
> > > like.
> > >
> > > You have your auto_prepend_file value set to a file that does not
> > > exist in your php.ini file or a .htaccess file.  I just tested it
> and
> > > it gives this exact error.
> > >
> > > HTH
> > >
> > > David.
> > >
> > > --
> > > phpmachine :: The quick and easy to use service providing you with
> > > professionally developed PHP scripts :: http://www.phpmachine.com/
> > >
> > >           Professional Web Development by David Nicholson
> > >                     http://www.djnicholson.com/
> > >
> > >     QuizSender.com - How well do your friends actually know you?
> > >                      http://www.quizsender.com/
> > >                     (developed entirely in PHP)
> > >
> > >
> > > ---
> > > Incoming mail is certified Virus Free.
> > > Checked by AVG anti-virus system (http://www.grisoft.com).
> > > Version: 6.0.504 / Virus Database: 302 - Release Date: 7/24/2003
> > >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.504 / Virus Database: 302 - Release Date: 7/24/2003
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
> >
> > ---
> > Incoming mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.504 / Virus Database: 302 - Release Date: 7/24/2003
> >
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.504 / Virus Database: 302 - Release Date: 7/24/2003
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.504 / Virus Database: 302 - Release Date: 7/24/2003
> 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.504 / Virus Database: 302 - Release Date: 7/24/2003
 


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

How do I go about checking if a file is a zip file?

Wrapping the zipinfo utility in php did not help since it does not return an
exit code whether it succeeded or not.

Thanks,

IP




--- End Message ---
--- Begin Message ---
Ivo Pletikosic <mailto:[EMAIL PROTECTED]>
    on Friday, August 01, 2003 5:10 PM said:

> Wrapping the zipinfo utility in php did not help since it does not
> return an exit code whether it succeeded or not.

Well if zipinfo returns anything at all it's probably valid. If it
doesn't then it's probably not since it can't read the file properly.

But then again I've never heard of the "zipinfo utility" so I could be
totally wrong.


Chris.

--- End Message ---
--- Begin Message ---
* Thus wrote Ivo Pletikosic ([EMAIL PROTECTED]):
> Hello all,
> 
> How do I go about checking if a file is a zip file?
> 
> Wrapping the zipinfo utility in php did not help since it does not return an
> exit code whether it succeeded or not.

I'm assuming the zipinfo your talking about is part of the unzip
package. You should use unzip to test the files

unzip -t file.zip

will check the checksum for each file.

'man unzip' for further details.

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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

 I have installed the latest cygwin - php4.2 with apache, but looking at the
configuration file for
php.ini , I tried to change value , restart apache and it didn't work
then I went and totally rename the php.ini to aaa.bak and restart apache
which I expecting the
error reading og the php.ini , but still no Error message and seems that
php4apache still can
read the php.ini , but don know from where ...
can any one help ?
Thanks,
kalmen




      System CYGWIN_NT-5.0 ARTEMIS 1.3.10(0.51/3/2) 2002-02-25 11:14 i686
unknown
      Build Date May 5 2002 17:14:06
      Configure Command './configure' '--with-apxs=/usr/sbin/apxs'
'--with-gettext' '--with-mysql=/usr/local' '--with-pgsql' '--with-bz2'
'--with-openssl' '--with-dom' '--with-zlib'
      Server API Apache
      Virtual Directory Support disabled
      Configuration File (php.ini) Path /usr/local/lib
      Debug Build no
      Thread Safety disabled



--- End Message ---
--- Begin Message ---
On Saturday 02 August 2003 09:00, kalmen wrote:

>  I have installed the latest cygwin - php4.2 with apache, but looking at
> the configuration file for
> php.ini , I tried to change value , restart apache and it didn't work
> then I went and totally rename the php.ini to aaa.bak and restart apache
> which I expecting the
> error reading og the php.ini , but still no Error message and seems that
> php4apache still can
> read the php.ini , but don know from where ...
> can any one help ?

Read this thread:

 http://marc.theaimsgroup.com/?l=php-general&m=105817862712836&w=2

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Hodie natus est radici frater.
*/


--- End Message ---
--- Begin Message ---
 
 
I've not been able to find anywhere a good use of the pfpro
functionality in PHP. No where do any of the scripts ensure that the
script goes through it's full execution.
 
One person's solution was just to exec the pfpro binary in the
background, passing it the necessary arguments. This seems insecure.
I'd like to use PHP's pcntl_fork(), however, I read that using it in PHP
where PHP is an Apache module could produce unpredictable results.. Is
anyone using pcntl_fork with the pfpro stuff in a PHP compiled as a
module.....successfully?
 
 
 
Thanks
 
Erik Osterman
 
 
 

--- End Message ---
--- Begin Message ---
* Thus wrote e ([EMAIL PROTECTED]):
>  
>  
> I've not been able to find anywhere a good use of the pfpro
> functionality in PHP. No where do any of the scripts ensure that the
> script goes through it's full execution.
>  
> One person's solution was just to exec the pfpro binary in the
> background, passing it the necessary arguments. This seems insecure.
> I'd like to use PHP's pcntl_fork(), however, I read that using it in PHP
> where PHP is an Apache module could produce unpredictable results.. Is
> anyone using pcntl_fork with the pfpro stuff in a PHP compiled as a
> module.....successfully?


You cant use pcntl_fork() within a web processes, what might be
useful:

http://php.net/features.connection-handling

You'll be able to handle everything upto the point that you call
the pfpro->process function.  Once that happens the payment will go
through. But if you are keeping track of results from the pfpro you
could flag the database that the user hit cancel.

What I would do instead would be to issue a ignore_user_abort(true)
and record the results in a database (since the output will not be
garenteed.) And not worry about what happens if the user does press
escape.

To be user friendly I would put a disclaimer, clearly visible, next
to the submit button 'Once pressing submit there is no turning
back', or something to that effect.


HTH,

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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

As a recent flurry of activity has commenced within Command Prompt we have released upon this rather unround earth, plPHP. Yes it is trigger safe, yes you can write UDF's in PostgreSQL with PHP now.

Find it here:

http://www.commandprompt.com/entry.lxp?lxpe=260

Have a glorius weekend.

Sincerely,

Joshua D. Drake



--- End Message ---
--- Begin Message ---
* Thus wrote Joshua D. Drake ([EMAIL PROTECTED]):
> Hello,
> 
> As a recent flurry of activity has commenced within Command Prompt we 
> have released upon this rather unround earth, plPHP. Yes it is trigger 
> safe, yes you can write UDF's in PostgreSQL with PHP now.

I have yet to know what it does, even after visiting your site.

I'm not sure what php-general's policy is on posting releases of
new software, i hope that it is  discuraged.  I can understand
plugs or promotional sigs but other than that I believe it is OT.
There are other avenues to promote your software and this list
(IMHO) isn't one of them.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
This was last asked: in 2001
 2. 2001-07-31  Embedding PHP into another application...
The solution suggested was to adopt a commericial package.

I have experimented with a javascript library, but I think the licensing
of php is more favourable; I am not lawyer though!

I have seen somewhere that someone wrote a C library to link to php.
Has this been done?  I have searched the MARC archives for several
variations of embedded/link/lib to no avail

Thank you,
April White



--- End Message ---
--- Begin Message ---
In comparing Perl's push to array_push in "PHP Developer's Cookbook" (2/e,
p. 76), the authors note that pushing an array onto another produces a
two-dimensional array.  However, I have not been able to reproduce their
example result, and php.net/array_push does not document this behavior.

Just curious.



--- End Message ---
--- Begin Message ---
Everytime I try to run this function it says that it is an undefined
function LDAP_connection



--- End Message ---

Reply via email to