OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 4 Aug 2005 17:53:46 -0000 Issue 3606

php-general-digest-helplists.php.net
Date: Thu Aug 04 2005 - 12:53:46 CDT


php-general Digest 4 Aug 2005 17:53:46 -0000 Issue 3606

Topics (messages 219974 through 220024):

Re: can't find the parser error
        219974 by: Dean Maunder
        219989 by: hope

code generation
        219975 by: Johan Grobler
        219977 by: Ligaya Turmelle
        219978 by: sub.pudlz.com
        219979 by: Jochem Maas
        219985 by: Johan Grobler
        219987 by: Shaw, Chris - Accenture

Re: Regex help
        219976 by: Lizet Pena de Sola

The Naming of Directories
        219980 by: Tom Chubb
        219981 by: Mark Rees
        220023 by: Satyam
        220024 by: Shaw, Chris - Accenture

Knowledge Management
        219982 by: Roger Thomas
        219983 by: Rory McKinley
        219984 by: Roger Thomas

To count number of vists of one particular Website
        219986 by: suma parakala
        219988 by: Jochem Maas
        220021 by: Dotan Cohen

Using File to count number of lines
        219990 by: Tom Chubb
        219992 by: Sebastian
        219993 by: Tom Chubb
        219995 by: Jay Blanchard
        219996 by: Sebastian
        219997 by: Sebastian
        219998 by: Al
        220016 by: Brandon Ryan
        220022 by: Al

Do I need to use --with-pic with configure?
        219991 by: Denis Solovyov

Re: Setting up a new box from scratch?
        219994 by: Jim Moseby

PHP mysql Apache install on FC3
        219999 by: robert.littlebitlost.com
        220003 by: Vidyut Luther

Re: very simple, yet can't think how.
        220000 by: Jochem Maas

strip out too many newlines
        220001 by: Sebastian
        220002 by: Marco Tabini
        220004 by: Sebastian
        220005 by: Marco Tabini
        220008 by: Sebastian
        220013 by: Marco Tabini

Is gethostbyaddr() slow?
        220006 by: Dotan Cohen
        220007 by: Jochem Maas
        220009 by: Kristen G. Thorson
        220011 by: kalinga
        220012 by: kalinga
        220014 by: kalinga
        220017 by: Kristen G. Thorson
        220020 by: kalinga

ICMP Checksum, calculation
        220010 by: Philip Birk

Interesting Referer behaviour- how to copy it?
        220015 by: Dotan Cohen

Re: shell_exec("zip.. ?
        220018 by: Matthew Weier O'Phinney

Re: syntax highlighting your php code on a web page
        220019 by: Matthew Weier O'Phinney

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


You missed a semi-colon.......

<?php

print "<p>You want to add an event called
       <b>{$_POST['name']}</b> which takes place on: <br />";

if (is_array ($_POST['weekdays'])) {

   foreach ($_POST['weekdays'] as $day) {
   print "$day"; // <-------here

}
}
 
else {

   print 'Please select at least one weekday for this event!';

}

print '</p>';

?>

-----Original Message-----
From: Support [mailto:supportpasseycorp.com]
Sent: Thursday, 4 August 2005 3:47 PM
To: Dean Maunder
Subject: Re: [PHP] can't find the parser error

Thanks Dean,

Here is the parse error...but when i attempt to correct it, the parse
error seems to jump down to the next command line.

Parse error: parse error, unexpected '}'
------snip

attached mail follows:


well u have a parse error in ur TESTARRAY.PHP file

within the foreach loop
u hav writen

              print "$day"

while here u must also terminate it through semi-colon like this

            print "$day";

This wil solve the problem
Now it wil work

zedleon wrote:

> I am having trouble finding the parser error in this small test script. Any
> help would be appreciated
> I am pulling in an array from this html form.

> <form action="/testarray.php" method="post">
> <p>Event Name: <input type="text" name="name" size="30" /></p>
> <p>Week Days</p>
> <input type="checkbox" name="weekdays[]" value="Sunday" />S
> <input type="checkbox" name="weekdays[]" value="Monday" />M
> <input type="checkbox" name="weekdays[]" value="Tuesday" />T
> <input type="checkbox" name="weekdays[]" value="Wednesday" />W
> <input type="checkbox" name="weekdays[]" value="Thursday" />T
> <input type="checkbox" name="weekdays[]" value="Friday" />F
> <input type="checkbox" name="weekdays[]" value="Saturday" />S
> </P>
> <input type="submit" name="submit" value="Add the Event!" /></form>

> testarray.php

> <?php

> print "<p>You want to add an event called
> <b>{$_POST['name']}</b> which takes place on: <br />";

> if (is_array ($_POST['weekdays'])) {

> foreach ($_POST['weekdays'] as $day) {
> print "$day"

> }

> } else {

> print 'Please select at least one weekday for this event!';

> }

> print '</p>';

> ?>

attached mail follows:


is there a way to limit the time a website is available in php?, if you want to have a database driven website but you would only like it to be active for 6 months for instance, i'm doing a project at univirsity and this is part of the specs, but i cant think of a good way how to do it...
--------------------------------------------------------------------
Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Peninsula University of
Technology or the sender of this e-mail be liable to any party for
any direct, indirect, special or other consequential damages for any
use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

attached mail follows:


Maybe have a cron job that deletes/changes perms to make inaccessible
the script after the given date.

Johan Grobler wrote:

> is there a way to limit the time a website is available in php?, if you want to have a database driven website but you would only like it to be active for 6 months for instance, i'm doing a project at univirsity and this is part of the specs, but i cant think of a good way how to do it...
> --------------------------------------------------------------------
> Disclaimer
> This e-mail transmission contains confidential information,
> which is the property of the sender.
> The information in this e-mail or attachments thereto is
> intended for the attention and use only of the addressee.
> Should you have received this e-mail in error, please delete
> and destroy it and any attachments thereto immediately.
> Under no circumstances will the Cape Peninsula University of
> Technology or the sender of this e-mail be liable to any party for
> any direct, indirect, special or other consequential damages for any
> use of this e-mail.
> For the detailed e-mail disclaimer please refer to
> http://www.ctech.ac.za/polic or call +27 (0)21 460 3911
>

--
Respectfully,
Ligaya Turmelle

"Life is a game.... so have fun"

attached mail follows:


Couldn't you use a date check with date()?

if(todays date < end date)
{
load the site
}
else
{
the site has expired
}

Andrew Darrow
Kronos1 Productions
www.pudlz.com

----- Original Message -----
From: "Johan Grobler" <groblerjcput.ac.za>
To: <php-generallists.php.net>
Sent: Wednesday, August 03, 2005 11:04 PM
Subject: [PHP] code generation

is there a way to limit the time a website is available in php?, if you want
to have a database driven website but you would only like it to be active
for 6 months for instance, i'm doing a project at univirsity and this is
part of the specs, but i cant think of a good way how to do it...
--------------------------------------------------------------------
Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Peninsula University of
Technology or the sender of this e-mail be liable to any party for
any direct, indirect, special or other consequential damages for any
use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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

--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.9/62 - Release Date: 8/2/2005

attached mail follows:


btw - what has 'code generation' got to do with the question?
a oneliner to check 2 dates is not considered code generation -
I'd call it 'writing a oneliner' or something similiar :-)

subpudlz.com wrote:
> Couldn't you use a date check with date()?
>
> if(todays date < end date)
> {
> load the site
> }
> else
> {
> the site has expired
> }
>

indeed, also checkout time(), mktime(), strtotime() etc.
also ...

if ($timeIsUp) {
        // delete site files
        exit;
}

// show the site...

> Andrew Darrow
> Kronos1 Productions
> www.pudlz.com
>
>
> ----- Original Message -----
> From: "Johan Grobler" <groblerjcput.ac.za>
> To: <php-generallists.php.net>
> Sent: Wednesday, August 03, 2005 11:04 PM
> Subject: [PHP] code generation
>
>
> is there a way to limit the time a website is available in php?, if you want
> to have a database driven website but you would only like it to be active
> for 6 months for instance, i'm doing a project at univirsity and this is
> part of the specs, but i cant think of a good way how to do it...
> --------------------------------------------------------------------
> Disclaimer
> This e-mail transmission contains confidential information,
> which is the property of the sender.
> The information in this e-mail or attachments thereto is
> intended for the attention and use only of the addressee.
> Should you have received this e-mail in error, please delete
> and destroy it and any attachments thereto immediately.
> Under no circumstances will the Cape Peninsula University of
> Technology or the sender of this e-mail be liable to any party for
> any direct, indirect, special or other consequential damages for any
> use of this e-mail.
> For the detailed e-mail disclaimer please refer to
> http://www.ctech.ac.za/polic or call +27 (0)21 460 3911
>

attached mail follows:


yes sorry about that, i was going to ask about code generation but then rephrased the question without changing the subject...

thanx for the responses, i thought of that but wouldn't changing the system date on your machine be a way of getting around that?

>>> Jochem Maas <jochemiamjochem.com> 08/04/05 9:34 AM >>>
btw - what has 'code generation' got to do with the question?
a oneliner to check 2 dates is not considered code generation -
I'd call it 'writing a oneliner' or something similiar :-)

subpudlz.com wrote:
> Couldn't you use a date check with date()?
>
> if(todays date < end date)
> {
> load the site
> }
> else
> {
> the site has expired
> }
>

indeed, also checkout time(), mktime(), strtotime() etc.
also ...

if ($timeIsUp) {
        // delete site files
        exit;
}

// show the site...

> Andrew Darrow
> Kronos1 Productions
> www.pudlz.com
>
>
> ----- Original Message -----
> From: "Johan Grobler" <groblerjcput.ac.za>
> To: <php-generallists.php.net>
> Sent: Wednesday, August 03, 2005 11:04 PM
> Subject: [PHP] code generation
>
>
> is there a way to limit the time a website is available in php?, if you want
> to have a database driven website but you would only like it to be active
> for 6 months for instance, i'm doing a project at univirsity and this is
> part of the specs, but i cant think of a good way how to do it...
> --------------------------------------------------------------------
> Disclaimer
> This e-mail transmission contains confidential information,
> which is the property of the sender.
> The information in this e-mail or attachments thereto is
> intended for the attention and use only of the addressee.
> Should you have received this e-mail in error, please delete
> and destroy it and any attachments thereto immediately.
> Under no circumstances will the Cape Peninsula University of
> Technology or the sender of this e-mail be liable to any party for
> any direct, indirect, special or other consequential damages for any
> use of this e-mail.
> For the detailed e-mail disclaimer please refer to
> http://www.ctech.ac.za/polic or call +27 (0)21 460 3911
>

--------------------------------------------------------------------
Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Peninsula University of
Technology or the sender of this e-mail be liable to any party for
any direct, indirect, special or other consequential damages for any
use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

attached mail follows:


<snip>
thanx for the responses, i thought of that but wouldn't changing the system
date on your machine be a way of getting around that?
</snip>

Time and Date functions are dependent on the locale settings of your server.

************************

This message has been delivered to the Internet by the Revenue Internet e-mail service

*************************

attached mail follows:


Ok, it's not the regexp for detecting email addresses what I need,
that's widely published, thanks. I'm using ereg to match this regular
expression:

(On)[\s\w\d\W\S\D\n]*(wr[i|o]te[s]?:)

That will match phrases like
"On 8/3/05, Carol Swinehart <cshartgreenapple.edu> wrote:"
the type "On date, name <email> wrote or writes:"

The thing is I tried this regexp with Regex Coach and it matches fine,
but ereg returns no match

ereg($regexpstr, $str, $regs)

I know there are some comments at php.net about how ereg has some bugs,
any idea if this could be one?

Tia,
Lizet
-----Original Message-----
From: Marcus Bointon [mailto:marcussynchromedia.co.uk]
Sent: Wednesday, August 03, 2005 8:57 AM
To: PHP General
Subject: Re: [PHP] Regex help

On 2 Aug 2005, at 15:12, Robin Vickery wrote:

> I don't suppose this is the place for a rant about the futility of
> checking email addresses with a regexp?

Though I will agree with you to some extent, I've had quite a lot of
success with this, which is pretty thorough:

^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-
\/\=\?\^\`\{\|\}\~]+(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}
[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|
(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]
\d|25[0-5])\]))$

Which I got from here:

http://www.hexillion.com/samples/#Regex

Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
marcussynchromedia.co.uk | http://www.synchromedia.co.uk

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

attached mail follows:


This may be slightly OT, but I've modified a gallery script that I had
written for me which reads directories and echos the dir name as a
gallery.
Unfortunately, it doesn't look very nice with say picsofsomething so I
renamed the folder 'pics of something'
When this is read, the string inserts %20 for the spaces, which is
fine, but are there any reasons why I shouldn't be doing this?
Many thanks,

Tom

--
Tom Chubb
tomps-promo.co.uk
07915 053312

attached mail follows:


"Tom Chubb" <tomchubbgmail.com> wrote in message
news:4577934f05080401142d97de96mail.gmail.com...
This may be slightly OT, but I've modified a gallery script that I had
written for me which reads directories and echos the dir name as a
gallery.
Unfortunately, it doesn't look very nice with say picsofsomething so I
renamed the folder 'pics of something'
When this is read, the string inserts %20 for the spaces, which is
fine, but are there any reasons why I shouldn't be doing this?
Many thanks,

--------------

A while back, this would have been liable to cause problems in Netscape
(v3/4). I don't think it makes so much difference these days, but I just
avoid it out of habit. You can get a more readable effect wihout spaces by
using an underscore, say, in the directory name, and when you need to print
it to screen, replace the underscores with spaces
--------------
Tom

--
Tom Chubb
tomps-promo.co.uk
07915 053312

attached mail follows:


""Mark Rees"" <mreesitsagoodprice.com> wrote in message
news:37.06.04646.FB1D1F24pb1.pair.com...
> "Tom Chubb" <tomchubbgmail.com> wrote in message
> news:4577934f05080401142d97de96mail.gmail.com...
> This may be slightly OT, but I've modified a gallery script that I had
> written for me which reads directories and echos the dir name as a
> gallery.
> Unfortunately, it doesn't look very nice with say picsofsomething so I
> renamed the folder 'pics of something'
> When this is read, the string inserts %20 for the spaces, which is
> fine, but are there any reasons why I shouldn't be doing this?
> Many thanks,
>
> --------------
>
> A while back, this would have been liable to cause problems in Netscape
> (v3/4). I don't think it makes so much difference these days, but I just
> avoid it out of habit. You can get a more readable effect wihout spaces by
> using an underscore, say, in the directory name, and when you need to
> print
> it to screen, replace the underscores with spaces
> --------------
> Tom
Wasn't the plus sign the replacement for a space? Pics+of+something is more
readable.

Satyam

attached mail follows:


I believe %20 and + are used to replace spaces.

See RFC 1738 - Uniform Resource Locators (URL)

http://www.faqs.org/rfcs/rfc1738.html

C.

-----Original Message-----
From: Satyam [mailto:satyamsatyam.com.ar]
Sent: 04 August 2005 18:07
To: php-generallists.php.net
Subject: [PHP] Re: The Naming of Directories

*************************************

This e-mail has been received by the Revenue Internet e-mail service.

*************************************

""Mark Rees"" <mreesitsagoodprice.com> wrote in message
news:37.06.04646.FB1D1F24pb1.pair.com...
> "Tom Chubb" <tomchubbgmail.com> wrote in message
> news:4577934f05080401142d97de96mail.gmail.com...
> This may be slightly OT, but I've modified a gallery script that I had
> written for me which reads directories and echos the dir name as a
> gallery.
> Unfortunately, it doesn't look very nice with say picsofsomething so I
> renamed the folder 'pics of something'
> When this is read, the string inserts %20 for the spaces, which is
> fine, but are there any reasons why I shouldn't be doing this?
> Many thanks,
>
> --------------
>
> A while back, this would have been liable to cause problems in Netscape
> (v3/4). I don't think it makes so much difference these days, but I just
> avoid it out of habit. You can get a more readable effect wihout spaces by
> using an underscore, say, in the directory name, and when you need to
> print
> it to screen, replace the underscores with spaces
> --------------
> Tom
Wasn't the plus sign the replacement for a space? Pics+of+something is more
readable.

Satyam

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

************************

This message has been delivered to the Internet by the Revenue Internet e-mail service

*************************

attached mail follows:


I am trying to find a suitable opensource Knowledge Management System to be used in my organisation; at least with document management, project management group collaboration capabilities, like http://cortexpro.com/

Any clues ?

--
Roger

---------------------------------------------------
Sign Up for free Email at http://ureg.home.net.my/
---------------------------------------------------

attached mail follows:


Roger Thomas wrote:
> I am trying to find a suitable opensource Knowledge Management System to be used in my organisation; at least with document management, project management group collaboration capabilities, like http://cortexpro.com/
>
> Any clues ?
>
<snip>

Hi Roger

KnowledgeTree comes highly recommended - our company was reviewing it,
but needed something that comes with project management stuff as well.
Based on PHP & MySQL:

http://sourceforge.net/projects/kt-dms/

Rory

attached mail follows:


OK thanks Rory. I will certainly evaluate it.

--
Roger

Quoting Rory McKinley <rorymnebula.co.za>:

> Roger Thomas wrote:
> > I am trying to find a suitable opensource Knowledge Management System to be
> used in my organisation; at least with document management, project
> management group collaboration capabilities, like http://cortexpro.com/
> >
> > Any clues ?
> >
> <snip>
>
> Hi Roger
>
> KnowledgeTree comes highly recommended - our company was reviewing it,
> but needed something that comes with project management stuff as well.
> Based on PHP & MySQL:
>
> http://sourceforge.net/projects/kt-dms/
>
> Rory
>
>
>
>

---------------------------------------------------
Sign Up for free Email at http://ureg.home.net.my/
---------------------------------------------------

attached mail follows:


Hi
Can anyone tell me how can I count how many times my website has been viewed
using php
Thanks
Suma

_________________________________________________________________
Post FREE Classifieds.
http://www.sulekha.com/classifieds/cllist.aspx?nma=IN&ref=msn Reach out to
over a million NRIs.

attached mail follows:


suma parakala wrote:
> Hi
> Can anyone tell me how can I count how many times my website has been
> viewed using php

you'd think someone had done this before - try google first - there are
1000's of scripts that do this, have a look at some and see how they do it.

e.g.: http://www.google.com/search?q=website+counter+script+php

or use your fingers - but that could get problematic if you get slashdotted. ;-)

> Thanks
> Suma
>
> _________________________________________________________________
> Post FREE Classifieds.
> http://www.sulekha.com/classifieds/cllist.aspx?nma=IN&ref=msn Reach out
> to over a million NRIs.
>

attached mail follows:


On 8/4/05, suma parakala <sumaparkalahotmail.com> wrote:
> Hi
> Can anyone tell me how can I count how many times my website has been viewed
> using php
> Thanks
> Suma

Suma,
I am working on that now. I will soon have a script ready under GPL.
There are two versions, one with mysql and one with flat files. Do you
have mysql?

Dotan Cohen
http://lyricslist.com/lyrics/artist_albums/119/clapton_eric.php
Clapton, Eric Song Lyrics

attached mail follows:


I'm having a problem with the following code:

<?php
$file = "http://www.mysite.co.uk/mailing_list_database.list";
$lines = count(file($file));
echo "$lines ";
?>

I'm trying to show the number of subscribers to my visitors from a
text file, but it returns a value of 1 when it should be 5000.
I think it's to do with recognising the line break but I don't know
how to make it work!?!

(I've looked on php.net for the file, fopen & count functions and
can't find anything, although fopen mentions using the -t mode.
Any ideas?

Thanks,

Tom

attached mail follows:


you sure each is on its own line (\n) ?

if you're only getting a value of 1 it is likely putting everything on a
single array key..

Tom Chubb wrote:

>I'm having a problem with the following code:
>
><?php
>$file = "http://www.mysite.co.uk/mailing_list_database.list";
>$lines = count(file($file));
>echo "$lines ";
>?>
>
>I'm trying to show the number of subscribers to my visitors from a
>text file, but it returns a value of 1 when it should be 5000.
>I think it's to do with recognising the line break but I don't know
>how to make it work!?!
>
>(I've looked on php.net for the file, fopen & count functions and
>can't find anything, although fopen mentions using the -t mode.
>Any ideas?
>
>Thanks,
>
>Tom
>
>
>

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.9/62 - Release Date: 8/2/2005

attached mail follows:


When I open the list in notepad everything is on one line with a
square box character.
When I open it in wordpad, it's one email address on each line.

On 04/08/05, Sebastian <sebastianbroadbandgaming.net> wrote:
> you sure each is on its own line (\n) ?
>
> if you're only getting a value of 1 it is likely putting everything on a
> single array key..
>
>
>
> Tom Chubb wrote:
>
> >I'm having a problem with the following code:
> >
> ><?php
> >$file = "http://www.mysite.co.uk/mailing_list_database.list";
> >$lines = count(file($file));
> >echo "$lines ";
> >?>
> >
> >I'm trying to show the number of subscribers to my visitors from a
> >text file, but it returns a value of 1 when it should be 5000.
> >I think it's to do with recognising the line break but I don't know
> >how to make it work!?!
> >
> >(I've looked on php.net for the file, fopen & count functions and
> >can't find anything, although fopen mentions using the -t mode.
> >Any ideas?
> >
> >Thanks,
> >
> >Tom
> >
> >
> >
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.338 / Virus Database: 267.9.9/62 - Release Date: 8/2/2005
>
>

--
Tom Chubb
tomps-promo.co.uk
07915 053312

attached mail follows:


[snip]
When I open the list in notepad everything is on one line with a
square box character.
When I open it in wordpad, it's one email address on each line.
[/snip]

Sounds like that there are not any newline characters in the file. You
could do something like this...

$theFile = fopen("http://www.mysite.co.uk/mailing_list_database.list",
"r");
while(!feof($theFile)){
   $theLine = fgets($theFile, 4096);
   $theCount++;
}
fclose($theFile);

echo $theCount;

attached mail follows:


do this:

$file = 'http://www.mysite.co.uk/mailing_list_database.list';

echo '<pre>';
print_r($file);
echo '</pre>';

im pretty sure you'll only see 1 key..
if each has its own line, you would see something like:

Array
(
    [0] => foo
    [1] => foo
    [2] => foo
    [3] => foo
)

etc...

Tom Chubb wrote:

>When I open the list in notepad everything is on one line with a
>square box character.
>When I open it in wordpad, it's one email address on each line.
>
>
>On 04/08/05, Sebastian <sebastianbroadbandgaming.net> wrote:
>
>
>>you sure each is on its own line (\n) ?
>>
>>if you're only getting a value of 1 it is likely putting everything on a
>>single array key..
>>
>>
>>
>>Tom Chubb wrote:
>>
>>
>>
>>>I'm having a problem with the following code:
>>>
>>><?php
>>>$file = "http://www.mysite.co.uk/mailing_list_database.list";
>>>$lines = count(file($file));
>>>echo "$lines ";
>>>?>
>>>
>>>I'm trying to show the number of subscribers to my visitors from a
>>>text file, but it returns a value of 1 when it should be 5000.
>>>I think it's to do with recognising the line break but I don't know
>>>how to make it work!?!
>>>
>>>(I've looked on php.net for the file, fopen & count functions and
>>>can't find anything, although fopen mentions using the -t mode.
>>>Any ideas?
>>>
>>>Thanks,
>>>
>>>Tom
>>>
>>>
>>>
>>>
>>>
>>--
>>No virus found in this outgoing message.
>>Checked by AVG Anti-Virus.
>>Version: 7.0.338 / Virus Database: 267.9.9/62 - Release Date: 8/2/2005
>>
>>
>>
>>
>
>
>
>

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.9/62 - Release Date: 8/2/2005

attached mail follows:


sorry, i forgot to put file();

Sebastian wrote:

> do this:
>
> $file = 'http://www.mysite.co.uk/mailing_list_database.list';
>
> echo '<pre>';
> print_r($file);
> echo '</pre>';
>
> im pretty sure you'll only see 1 key..
> if each has its own line, you would see something like:
>
> Array
> (
> [0] => foo
> [1] => foo
> [2] => foo
> [3] => foo
> )
>
> etc...
>
>
> Tom Chubb wrote:
>
>> When I open the list in notepad everything is on one line with a
>> square box character.
>> When I open it in wordpad, it's one email address on each line.
>>
>>
>> On 04/08/05, Sebastian <sebastianbroadbandgaming.net> wrote:
>>
>>
>>> you sure each is on its own line (\n) ?
>>>
>>> if you're only getting a value of 1 it is likely putting everything
>>> on a
>>> single array key..
>>>
>>>
>>>
>>> Tom Chubb wrote:
>>>
>>>
>>>
>>>> I'm having a problem with the following code:
>>>>
>>>> <?php
>>>> $file = "http://www.mysite.co.uk/mailing_list_database.list";
>>>> $lines = count(file($file));
>>>> echo "$lines ";
>>>> ?>
>>>>
>>>> I'm trying to show the number of subscribers to my visitors from a
>>>> text file, but it returns a value of 1 when it should be 5000.
>>>> I think it's to do with recognising the line break but I don't know
>>>> how to make it work!?!
>>>>
>>>> (I've looked on php.net for the file, fopen & count functions and
>>>> can't find anything, although fopen mentions using the -t mode.
>>>> Any ideas?
>>>>
>>>> Thanks,
>>>>
>>>> Tom
>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> No virus found in this outgoing message.
>>> Checked by AVG Anti-Virus.
>>> Version: 7.0.338 / Virus Database: 267.9.9/62 - Release Date: 8/2/2005
>>>
>>>
>>>
>>
>>
>>
>>
>>
>
>

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.9/62 - Release Date: 8/2/2005

attached mail follows:


Tom Chubb wrote:
> I'm having a problem with the following code:
>
> <?php
> $file = "http://www.mysite.co.uk/mailing_list_database.list";
> $lines = count(file($file));
> echo "$lines ";
> ?>
>
> I'm trying to show the number of subscribers to my visitors from a
> text file, but it returns a value of 1 when it should be 5000.
> I think it's to do with recognising the line break but I don't know
> how to make it work!?!
>
> (I've looked on php.net for the file, fopen & count functions and
> can't find anything, although fopen mentions using the -t mode.
> Any ideas?
>
> Thanks,
>
> Tom

$count= substr_count($file_str, "\n");

attached mail follows:


 Are you running this php code in windows, where a line break is made up of
a carriage return and a line feed? The file was probably created on
unix/linux where the line break is just a line feed. If you try to read this
file in windows, it will think everything is on one line. You either have to
replace all line feeds with carriage return and then line feed, or read it
in and parse it.
 Brandon
 On 8/4/05, Al <newsridersite.org> wrote:
>
> Tom Chubb wrote:
> > I'm having a problem with the following code:
> >
> > <?php
> > $file = " http://www.mysite.co.uk/mailing_list_database.list";
> > $lines = count(file($file));
> > echo "$lines ";
> > ?>
> >
> > I'm trying to show the number of subscribers to my visitors from a
> > text file, but it returns a value of 1 when it should be 5000.
> > I think it's to do with recognising the line break but I don't know
> > how to make it work!?!
> >
> > (I've looked on php.net <http://php.net/> for the file, fopen & count
> functions and
> > can't find anything, although fopen mentions using the -t mode.
> > Any ideas?
> >
> > Thanks,
> >
> > Tom
>
> $count= substr_count($file_str, "\n");
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Brandon Ryan wrote:
> Are you running this php code in windows, where a line break is made up of
> a carriage return and a line feed? The file was probably created on
> unix/linux where the line break is just a line feed. If you try to read this
> file in windows, it will think everything is on one line. You either have to
> replace all line feeds with carriage return and then line feed, or read it
> in and parse it.
> Brandon
> On 8/4/05, Al <newsridersite.org> wrote:
>
>>Tom Chubb wrote:
>>
>>>I'm having a problem with the following code:
>>>
>>><?php
>>>$file = " http://www.mysite.co.uk/mailing_list_database.list";
>>>$lines = count(file($file));
>>>echo "$lines ";
>>>?>
>>>
>>>I'm trying to show the number of subscribers to my visitors from a
>>>text file, but it returns a value of 1 when it should be 5000.
>>>I think it's to do with recognising the line break but I don't know
>>>how to make it work!?!
>>>
>>>(I've looked on php.net <http://php.net/> for the file, fopen & count
>>
>>functions and
>>
>>>can't find anything, although fopen mentions using the -t mode.
>>>Any ideas?
>>>
>>>Thanks,
>>>
>>>Tom
>>
>>$count= substr_count($file_str, "\n");
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
Windows is \r\n; unix/linux \n; MAC \r. So the \n gets Windows and Unix/linux/ If it's MAC or can be. then replace all

\r with \n first.

e.g., $str= preg_replace("%(\r\n|\r|\n)%", "\n", $str);

attached mail follows:


I have a question I can't answer by myself. :)

Do I need to use "--with-pic" option when configuring php 4?

I'm going to build it as an Apache 1.3 DSO module and going to
run multiple instances of Apache (under different users). I
use Linux (kernel 2.4.30).

Generally, when one may need to use "--with-pic"?

Denis Solovyov

attached mail follows:


>
>
> Hey all -
>
> I have an unused Pentium box here, recent, well loaded with RAM and
> HD. I want to turn it into a LAMP box. Never done that before; is
> there a preferred one-stop-shop installer CD or anything (easy -
> knock on wood)? It would be nice to end up with some kind of decent
> web GUI for admin.
>
> Thanks....
>

You should be able to set up a LAMP box directly from the distro's install
CD. Grab the distro of your choice, run the install, and during the phase
of the install where you choose the packages you want, choose Apache, MySQL,
and PHP. That will get you going with LAMP.

On the other hand, there are real benefits to doing it yourself. Install a
base Linux system, then go get the latest-greatest from the Apache, MySQL,
and PHP websites, and install them seperately. You will not only get the
latest versions that way, but you will gain a better understanding of how
they fit together.

JM

attached mail follows:


Hello,

    I am not quite sure if this is the correct mailing list to post this
question, but here I go anyway. I have a vanilla Fedora Core 3
installation, and I am trying to run a php script through a local
website that has calls into a MySQL database. I can run this script
at the command line using the php PHPScript.php command, and it runs
perfectly. When I run it through the firefox web browser, I get an
error that says:

[client 127.0.0.1] PHP Warning: mysql_pconnect(): Can't connect to local
MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in
/var/www/html/index.php on line 4

I have checked the socket, it exists. Again, if I run this script just
using php, it works just fine. However, when running it through Apache or
httpd it does not. What am I doing incorrectly?

Thank you for your time,
Robert

attached mail follows:


Look into the SELinux settings for your system, if you have that
enabled, by default PHP is not allowed to get that file via the user
nobody.
If you look into /var/log/messages you'll see some selinux messages.

You either need to disable selinux, or set your policy...http://
fedora.redhat.com/docs/selinux-faq-fc3/

that url should help.

On Aug 4, 2005, at 9:26 AM, robertlittlebitlost.com wrote:

> Hello,
>
> I am not quite sure if this is the correct mailing list to post
> this
> question, but here I go anyway. I have a vanilla Fedora Core 3
> installation, and I am trying to run a php script through a local
> website that has calls into a MySQL database. I can run this script
> at the command line using the php PHPScript.php command, and it runs
> perfectly. When I run it through the firefox web browser, I get an
> error that says:
>
> [client 127.0.0.1] PHP Warning: mysql_pconnect(): Can't connect to
> local
> MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in
> /var/www/html/index.php on line 4
>
> I have checked the socket, it exists. Again, if I run this script
> just
> using php, it works just fine. However, when running it through
> Apache or
> httpd it does not. What am I doing incorrectly?
>
> Thank you for your time,
> Robert
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Esteamedpwaol.com wrote:
>
> Thanks Mark and Sonu... as much as I've learned over the last few months I
> think I'm still a little confused about some of this stuff. I appreciate the
> Help you've given me :-)
>
> Would any of you know about any tutorials on something like this? books with
> tutorials, etc? If I knew what it was called I would google it - I'm just
> not sure exactly what it might be called lol

trying googling for something like 'automated [web]site generation tool'

and/or read up on sites that offer commercials versions of what you want to do
in order in order to determine what terminology they use. e.g.:

http://www.sw-soft.com/en/products/sitebuilder/

>
> Thanks again fellas :-D
>
>
> In a message dated 8/1/2005 10:45:14 P.M. Central Standard Time,
> markmarkcain.com writes:
>
> I have coded this type of website for many years and have run the gamut of
> trying different things -- originally, 8 years ago, I used perl with flat
> files and physical folders but in the recent past I have used PHP, MySQL and
> dynamic folders.
>
> In my opinion the best way to build this site is with dynamic folders via
> custom 404 error handling. Here how it works:
>
> You build the pages for things like "contact us" "my store" "my stuff" or
> whatever. Then you send someone to the site with an address like:
> mydomain.com/joe which doesn't exist. A custom 404 error handler picks up
> the error and parses the URL to identify "joe" as a unique ID. The 404
> script pulls "joe's" info from a database and populates the pages with his
> custom contact info then delivers the page. Joe's ID usually gets stuffed
> into a cookie and then when the person comes back to the site at a later
> date, they are delivered joe's info.
>
> That's it in a nut shell. Be sure that you deliver 200 headers and not 404
> headers when delivering the dynamic folder.
>
> Now you can do the physical folders and every time someone "signs up" you
> can take the template and populate their pages and store these pages in a
> real folder named "joe." But, be aware using this method. Success (if
> having lots of users is your goal) will be your downfall because this system
> is not easily scalable. Just think what happens if you have 500 folders, or
> 5,000 or 50,000 folders with every folder having a copy of the files in
> them.
>
> Here is a 404 script I use:
>
> <?header("HTTP/1.0 200 OK");
> require('/home/pathToLookUp/getinfo.php');
> ?>
>
> And here is the start of the getinfo.php script:
>
> <?
> list($blank, $site, $page) = split("\/", $REDIRECT_URL, 3);
> $query = "select * from stores where stores.name = '$site' and stores.active
> = 'Y' ";
>
> ....
> ?>
>
> Be sure to code the handling of an actual 404 just in case you don't have a
> user named joe or the surfer miss types.
>
> There's a ton of work in getting all of the bases covered - but it's sweet
> when it's done and you will know a lot of how a server works.
>
> Hope this helps.
>
> Mark Cain
>
>
>
>

attached mail follows:


im working on a comment/forum app and when a user enters too many
carriage returns i want to remove them before insert to db.

example, user input:

-----snip-----
[quote=user]
foo
[/quote]

<bunch of extra lines>

more text...
-----snip-----

I to change to:

[quote=user]foo[/quote]

more text...

i try this regexp:

$message =
preg_replace('#(\[quote(=(&quot;|"|\'|)([^\]]*)\\3)?\])\s+#i', "\\1\n",
$_POST['message']);

doesn't remove / replace anything.
I need for it to work when they use [quote=xx] or [quote] and ends with
[/quote]
any help?

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.9/62 - Release Date: 8/2/2005

attached mail follows:


Don't know much about the app you're writing, but does this do the trick for
you?

echo preg_replace ('!
                     (
                      \[quote
                      (?:=[^\]]*)?
                      \]
                     ) # Capture the [quote=xxx] part
                   
                     \n* # Eliminate any extra newlines here
                   
                     (.+) # Get contents
                   
                     \n* # Eliminate any extra newlines here
                   
                     (\[/quote\]) # Capture this part
                   
                     \n* # Eliminate any extra newlines here
                   
                    !x', "\$1\$2\$3\n\n", $string);

HTH,

Marco

--
BeebleX - The PHP Search Engine
http://beeblex.com

On 8/4/05 9:44 AM, "Sebastian" <sebastianbroadbandgaming.net> wrote:

> [quote=user]
> foo
> [/quote]
>
> <bunch of extra lines>
>
> more text...

attached mail follows:


thanx for the reply, but 1 problem. there is not only \n there are \r in
the POST too (carriage returns) so a string can look like this:

$string = '[quote=xx]\r\nfoo\r\n[/quote]\r\nmore text\r\n\r\n\r\n\r\n';

and your regexp will only catch if there is just \n
any solution for \r\n in combination too?

ty.

Marco Tabini wrote:

>Don't know much about the app you're writing, but does this do the trick for
>you?
>
>echo preg_replace ('!
> (
> \[quote
> (?:=[^\]]*)?
> \]
> ) # Capture the [quote=xxx] part
>
> \n* # Eliminate any extra newlines here
>
> (.+) # Get contents
>
> \n* # Eliminate any extra newlines here
>
> (\[/quote\]) # Capture this part
>
> \n* # Eliminate any extra newlines here
>
> !x', "\$1\$2\$3\n\n", $string);
>
>HTH,
>
>
>Marco
>
>--
>BeebleX - The PHP Search Engine
>http://beeblex.com
>
>On 8/4/05 9:44 AM, "Sebastian" <sebastianbroadbandgaming.net> wrote:
>
>
>
>>[quote=user]
>>foo
>>[/quote]
>>
>><bunch of extra lines>
>>
>>more text...
>>
>>
>
>
>
>
>
>
>
>

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.0/63 - Release Date: 8/3/2005

attached mail follows:


Try changing the

\n*

patterns to

(?:\r?\n)*

Cheers,

Marco

--
BeebleX - The PHP Search Engine
http://beeblex.com

On 8/4/05 10:39 AM, "Sebastian" <sebastianbroadbandgaming.net> wrote:

>>> [quote=user]
>>> foo
>>> [/quote]
>>>
>>> <bunch of extra lines>
>>>
>>> more text...

attached mail follows:


that works for my orginal request, but i found something else:

$string = '[quote=xx]foo[/quote]\nmore text\r\n\r\n\r\n\r\nmore text';

now if they enter more carriage returns i get the results from above.
its no big deal, but you always have someone trying to 'break' the system.

thanks, i really need to learn some regexp.

Marco Tabini wrote:

>Try changing the
>
>\n*
>
>patterns to
>
>(?:\r?\n)*
>
>Cheers,
>
>
>Marco
>
>--
>BeebleX - The PHP Search Engine
>http://beeblex.com
>
>
>On 8/4/05 10:39 AM, "Sebastian" <sebastianbroadbandgaming.net> wrote:
>
>
>
>>>>[quote=user]
>>>>foo
>>>>[/quote]
>>>>
>>>><bunch of extra lines>
>>>>
>>>>more text...
>>>>
>>>>
>
>
>

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.0/63 - Release Date: 8/3/2005

attached mail follows:


On 8/4/05 10:56 AM, "Sebastian" <sebastianbroadbandgaming.net> wrote:

> that works for my orginal request, but i found something else:
>
> $string = '[quote=xx]foo[/quote]\nmore text\r\n\r\n\r\n\r\nmore text';
>

Try removing double-instances of \r\n (or \n) before running the regex.

Marco

> now if they enter more carriage returns i get the results from above.
> its no big deal, but you always have someone trying to 'break' the system.
>
> thanks, i really need to learn some regexp.
>
> Marco Tabini wrote:
>
>> Try changing the
>>
>> \n*
>>
>> patterns to
>>
>> (?:\r?\n)*
>>
>> Cheers,
>>
>>
>> Marco
>>
>> --
>> BeebleX - The PHP Search Engine
>> http://beeblex.com
>>
>>
>> On 8/4/05 10:39 AM, "Sebastian" <sebastianbroadbandgaming.net> wrote:
>>
>>
>>
>>>>> [quote=user]
>>>>> foo
>>>>> [/quote]
>>>>>
>>>>> <bunch of extra lines>
>>>>>
>>>>> more text...
>>>>>
>>>>>
>>
>>
>>
>

attached mail follows:


Hi all, I just discovered the gethostbyaddr() function. By reading the
user contributed notes, I get the impression that either this function
may cause performance problems, or a user-contributed function based
upon it may be slow. So, is gethostbyaddr() slow? Is it dangerous?
Thanks!

Dotan Cohen
http://lyricslist.com/lyrics/artist_albums/56/bangles.php
The Bangles Song Lyrics

attached mail follows:


Dotan Cohen wrote:
> Hi all, I just discovered the gethostbyaddr() function. By reading the
> user contributed notes, I get the impression that either this function
> may cause performance problems, or a user-contributed function based
> upon it may be slow. So, is gethostbyaddr() slow? Is it dangerous?

I'm guessing that the speed is very much dependent on the speed of the
underlying dns query mechanism - so probably yes, it's relatively slow.
and not something you want to be doing many times within a single request.

probably someone will now declare me a retard ;-)

> Thanks!
>
> Dotan Cohen
> http://lyricslist.com/lyrics/artist_albums/56/bangles.php
> The Bangles Song Lyrics
>

attached mail follows:


I can say from personal experience that gethostbyaddr() and
gethostbyname() can seem almost randomly slow, depending on machine, OS,
software, who knows. I'm not smart enough to figure out the reason why
it can vary so much on machines with nearly the same configuration, but
I can tell you that it works perfectly fast most of the time. Then
there's that other 5% where something makes it slow as molasses.

I have two machines that are so similar it's not funny, but
gethostbyname() takes 1/10 s on one, and 5 s on the other. I have yet
to figure out what's the difference between them that causing this.

kgt

Dotan Cohen wrote:

>Hi all, I just discovered the gethostbyaddr() function. By reading the
>user contributed notes, I get the impression that either this function
>may cause performance problems, or a user-contributed function based
>upon it may be slow. So, is gethostbyaddr() slow? Is it dangerous?
>Thanks!
>
>Dotan Cohen
>http://lyricslist.com/lyrics/artist_albums/56/bangles.php
>The Bangles Song Lyrics
>
>
>

attached mail follows:


On 8/4/05, Kristen G. Thorson <kthorsonallegroconsultants.com> wrote:
> I can say from personal experience that gethostbyaddr() and
> gethostbyname() can seem almost randomly slow, depending on machine, OS,
> software, who knows. I'm not smart enough to figure out the reason why
> it can vary so much on machines with nearly the same configuration, but
> I can tell you that it works perfectly fast most of the time. Then
> there's that other 5% where something makes it slow as molasses.
>
> I have two machines that are so similar it's not funny, but
> gethostbyname() takes 1/10 s on one, and 5 s on the other. I have yet
> to figure out what's the difference between them that causing this.
>
>
> kgt
>
>
>
> Dotan Cohen wrote:
>
> >Hi all, I just discovered the gethostbyaddr() function. By reading the
> >user contributed notes, I get the impression that either this function
> >may cause performance problems, or a user-contributed function based
> >upon it may be slow. So, is gethostbyaddr() slow? Is it dangerous?
> >Thanks!
> >
> >Dotan Cohen
> >http://lyricslist.com/lyrics/artist_albums/56/bangles.php
> >The Bangles Song Lyrics
> >
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


On 8/4/05, kalinga <kalingagmail.com> wrote:
> On 8/4/05, Kristen G. Thorson <kthorsonallegroconsultants.com> wrote:
> > I can say from personal experience that gethostbyaddr() and
> > gethostbyname() can seem almost randomly slow, depending on machine, OS,
> > software, who knows. I'm not smart enough to figure out the reason why
> > it can vary so much on machines with nearly the same configuration, but
> > I can tell you that it works perfectly fast most of the time. Then
> > there's that other 5% where something makes it slow as molasses.
> >
> > I have two machines that are so similar it's not funny, but
> > gethostbyname() takes 1/10 s on one, and 5 s on the other. I have yet
> > to figure out what's the difference between them that causing this.

if you are quering a external host, the bad network conditions may
cause delay in results.

if your server is connected to a heavily loaded hub/ cheap switch, or
the target hosts DNS servers are poorly configured/ slow in responce
it adds further delay to your result.

try dig/ nslookup on your server for the target hostname/address, you
may experience the same delay as with the php function.

~viraj.

> >
> >
> > kgt
> >
> >
> >
> > Dotan Cohen wrote:
> >
> > >Hi all, I just discovered the gethostbyaddr() function. By reading the
> > >user contributed notes, I get the impression that either this function
> > >may cause performance problems, or a user-contributed function based
> > >upon it may be slow. So, is gethostbyaddr() slow? Is it dangerous?
> > >Thanks!
> > >
> > >Dotan Cohen
> > >http://lyricslist.com/lyrics/artist_albums/56/bangles.php
> > >The Bangles Song Lyrics
> > >
> > >
> > >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>

attached mail follows:


i missed another keypoint..

if you are running unix/linux server, you need to have a properly
setup resolv.conf

or if you experience a slowness while you quering your own domains,
check whether you DNS servers are providing "authoritative" answers to
your domains.

~viraj.

On 8/4/05, kalinga <kalingagmail.com> wrote:
> On 8/4/05, kalinga <kalingagmail.com> wrote:
> > On 8/4/05, Kristen G. Thorson <kthorsonallegroconsultants.com> wrote:
> > > I can say from personal experience that gethostbyaddr() and
> > > gethostbyname() can seem almost randomly slow, depending on machine, OS,
>
> > > software, who knows. I'm not smart enough to figure out the reason why
>
> > > it can vary so much on machines with nearly the same configuration, but
>
> > > I can tell you that it works perfectly fast most of the time. Then
> > > there's that other 5% where something makes it slow as molasses.
> > >
> > > I have two machines that are so similar it's not funny, but
> > > gethostbyname() takes 1/10 s on one, and 5 s on the other. I have yet
> > > to figure out what's the difference between them that causing this.
>
> if you are quering a external host, the bad network conditions may
> cause delay in results.
>
> if your server is connected to a heavily loaded hub/ cheap switch, or
> the target hosts DNS servers are poorly configured/ slow in responce
> it adds further delay to your result.
>
> try dig/ nslookup on your server for the target hostname/address, you
> may experience the same delay as with the php function.
>
>
> ~viraj.
>
> > >
> > >
> > > kgt
> > >
> > >
> > >
> > > Dotan Cohen wrote:
> > >
> > > >Hi all, I just discovered the gethostbyaddr() function. By reading the
> > > >user contributed notes, I get the impression that either this function
> > > >may cause performance problems, or a user-contributed function based
> > > >upon it may be slow. So, is gethostbyaddr() slow? Is it dangerous?
> > > >Thanks!
> > > >
> > > >Dotan Cohen
> > > >http://lyricslist.com/lyrics/artist_albums/56/bangles.php
> > > >The Bangles Song Lyrics
> > > >
> > > >
> > > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
>

attached mail follows:


kalinga wrote:

> if you are quering a external host, the bad network conditions may
>
>cause delay in results.
>
>if your server is connected to a heavily loaded hub/ cheap switch, or
>the target hosts DNS servers are poorly configured/ slow in responce
>it adds further delay to your result.
>
>try dig/ nslookup on your server for the target hostname/address, you
>may experience the same delay as with the php function.
>
>
>

Thanks for the reply. The problem I had - and that I was trying to
briefly describe - is not quite explained by slow DNS lookup, at least
not so far. I have one script, run on the same machine:

takes less than 1 second on CLI:

# php gethostbyname.php
Content-type: text/html
X-Powered-By: PHP/4.3.2

gethostbyname(www.imakenews.com) took 0.0010 s and resolved to
208.254.39.65<br>
gethostbyname(rssnewsapps.ziffdavis.com) took 0.0005 s and resolved to
63.87.252.162<br>
gethostbyname(itpapers.zdnet.com) took 0.1922 s and resolved to
216.239.113.159<br>
gethostbyname(rssnewsapps.ziffdavis.com) took 0.0005 s and resolved to
63.87.252.162<br>

Running CLI again, host names are apparently cached, because then they
all return in .0005 seconds.

takes 20 seconds under Apache 2.0.46:

gethostbyname(www.imakenews.com) took 5.0071 s and resolved to
208.254.39.65
gethostbyname(rssnewsapps.ziffdavis.com) took 5.0099 s and resolved to
63.87.252.162
gethostbyname(itpapers.zdnet.com) took 5.0097 s and resolved to
216.239.113.159
gethostbyname(rssnewsapps.ziffdavis.com) took 5.0099 s and resolved to
63.87.252.162

This will happen consistently, with less than 1/100 s variation in time
for each lookup.

Any DNS lookup tools are perfectly fast when run from the command line.
Also, other machines in the same subnet, using the same DNS servers,
using 99% same apache config files (I diff'ed 'em) run just as fast
under same apache/php version as they do command line. It's hard to
imagine what external DNS problem could exist that would affect only one
of our servers, and on that one, only apache/php and nothing command
line. Something else is going on, but my initial tries of
downgrading/upgrading both php and apache haven't made a different yet.
Perhaps you have another suggestion?

Thanks,

kgt

attached mail follows:


On 8/4/05, Kristen G. Thorson <kthorsonallegroconsultants.com> wrote:
> kalinga wrote:
>
> > if you are quering a external host, the bad network conditions may
> >
> >cause delay in results.
> >
> >if your server is connected to a heavily loaded hub/ cheap switch, or
> >the target hosts DNS servers are poorly configured/ slow in responce
> >it adds further delay to your result.
> >
> >try dig/ nslookup on your server for the target hostname/address, you
> >may experience the same delay as with the php function.
> >
> >
> >
>
> Thanks for the reply. The problem I had - and that I was trying to
> briefly describe - is not quite explained by slow DNS lookup, at least
> not so far. I have one script, run on the same machine:
>
> takes less than 1 second on CLI:
>
> # php gethostbyname.php
> Content-type: text/html
> X-Powered-By: PHP/4.3.2
>
> gethostbyname(www.imakenews.com) took 0.0010 s and resolved to
> 208.254.39.65<br>
> gethostbyname(rssnewsapps.ziffdavis.com) took 0.0005 s and resolved to
> 63.87.252.162<br>
> gethostbyname(itpapers.zdnet.com) took 0.1922 s and resolved to
> 216.239.113.159<br>
> gethostbyname(rssnewsapps.ziffdavis.com) took 0.0005 s and resolved to
> 63.87.252.162<br>
>
>
> Running CLI again, host names are apparently cached, because then they
> all return in .0005 seconds.
>
> takes 20 seconds under Apache 2.0.46:
>
> gethostbyname(www.imakenews.com) took 5.0071 s and resolved to
> 208.254.39.65
> gethostbyname(rssnewsapps.ziffdavis.com) took 5.0099 s and resolved to
> 63.87.252.162
> gethostbyname(itpapers.zdnet.com) took 5.0097 s and resolved to
> 216.239.113.159
> gethostbyname(rssnewsapps.ziffdavis.com) took 5.0099 s and resolved to
> 63.87.252.162
>
>
> This will happen consistently, with less than 1/100 s variation in time
> for each lookup.
>
>
> Any DNS lookup tools are perfectly fast when run from the command line.
> Also, other machines in the same subnet, using the same DNS servers,
> using 99% same apache config files (I diff'ed 'em) run just as fast
> under same apache/php version as they do command line. It's hard to
> imagine what external DNS problem could exist that would affect only one
> of our servers, and on that one, only apache/php and nothing command
> line. Something else is going on, but my initial tries of
> downgrading/upgrading both php and apache haven't made a different yet.
> Perhaps you have another suggestion?

could you please mention the environment, i mean, the os, and the
versions of php? is it binary install or a compile?

>
>
> Thanks,
>
> kgt
>
>
>
>
>

attached mail follows:


I've wanted to make a ping 'program' in PHP, so after reading up on
this, it occured to me that the only difficult thing was to calculate
the ICMP checksum. So after some heavy reading I could calculate this by
pen and paper. And after some hours trying to make my calculations into
PHP code, I discovered this piece of code in the online doc:

(by Khaless [at] bigpond [dot] com)
http://dk2.php.net/manual/en/ref.sockets.php
<?PHP
// Computes Internet Checksum for $data
// will return a 16-bit internet checksum for $data
function inetChecksum($data)
{
    // 32-bit accumilator, 16 bits at a time, adds odd bit on at end
    for($i=0;$i<strlen($data);$i += 2)
    {
        if($data[$i+1]) $bits = unpack('n*',$data[$i].$data[$i+1]);
        else $bits = unpack('C*',$data[$i]);
        $sum += $bits[1];
    }

    // Fold 32-bit sum to 16 bits
    while ($sum>>16) $sum = ($sum & 0xffff) + ($sum >> 16);
    $checksum = pack('n1',~$sum);
    return $checksum;
}
?>

Now, after discovering the unpack function it all became a lot easier,
so I've made my own checksum calculator, which works approximatly 5
times as fast (and it dosn't have the for loop limitation of data
length), and all the tests I've done it gives the same result as above:

<?php
function myChecksum($data)
{
     $bit = unpack('n*', $data);
     $sum = array_sum($bit);

     if (strlen($data)%2) {
         $temp = unpack('C*',$data[strlen($data)-1]);
         $sum += $temp[1];
     }

     // The next 2 lines of code, is stolen from the
     // original ping program written in C
     // Stolen code start:
     $sum = ($sum >> 16) + ($sum & 0xffff);
     $sum += ($sum >> 16);
     // End of stolen code

     return pack('n*', ~$sum);
}
?>

Can anyone tell me, if there will be any example, where the 2 functions
wont give the same output? The piece of code I think could be the most
trouble is the piece I've stolen, in the other function there's a while
loop, so if I a very long data input, it wouldn't be the same output,
but I've tried with large strings and they still give the same.

So to sum up, will the 2 functions always calculate the same.

--
Philip Birk-Jensen
URL: http://birk-jensen.dk
ICQ: 14789099

attached mail follows:


I creating a out.php file that will record clicks, and the redirect
the user to the site that he wanted. I am currently using
header("Location: $url"); which works as expected. The only problem
is, that the browser does not send $HTTP_REFERER info to the recieving
site.

However, that particular site is also linking to me via a out.php
file, and the browser DOES set $HTTP_REFERER on my site. So I've been
googleing for two days, and came up with this: There is a site that
displays the server reesponse of any server. So I put both of our
out.php files to the test. First, his server response:
HTTP/1.1 302 Found
Connection: close
Date: Thu, 04 Aug 2005 15:19:01 GMT
Location: http://lyricslist.com
Server: Apache/2.0.50 (FreeBSD) PHP/5.0.0
Vary: Accept-Encoding
Content-Length: 0
Content-Type: text/html; charset=ISO-8859-1
Client-Date: Thu, 04 Aug 2005 15:32:32 GMT
Client-Response-Num: 1
X-Powered-By: PHP/5.0.0

This redirects to lyricslist.com and correctly sets the $HTTP_REFERER
variable. Now, my server response:
HTTP/1.1 302 Found
Connection: close
Date: Thu, 04 Aug 2005 15:39:25 GMT
Location: http://lyricslist.com
Server: Apache/1.3.33 (Unix) mod_auth_passthrough/1.8
mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.3.11 FrontPage/5.0.2.2635
mod_ssl/2.8.22 OpenSSL/0.9.7a
Vary: Accept-Encoding
Content-Length: 0
Content-Type: text/html; charset=ISO-8859-1
Client-Date: Thu, 04 Aug 2005 15:39:29 GMT
Client-Response-Num: 1
X-Powered-By: PHP/4.3.11

This just does not set the $HTTP_REFERER variable! The referer
variable is even set to the original page that linked to out.php, and
not out.php itself! I have tried in IE 6.x, Firefox 1.0.6, Pheonix 0.7
(remember that!), and Opera 8.0. What could be the difference?

Thanks to all who rack thier brains on this one! It's been a fruitless
two days for me...

Dotan Cohen
http://lyricslist.com/lyrics/artist_albums/118/chumbawamba.php
Chumbawamba Song Lyrics

attached mail follows:


* Sam Smith <phpitab.com>:
>
> shell_exec("zip -r ddd ddd"); // don't work

Many version of zip won't append the .zip extension. In such a case,
what you have above will try to name the zip file the same as the
existing directory, which obviously won't work. Try:

    shell_exec("zip -r ddd.zip ddd");

--
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/

attached mail follows:


* Steve Turnbull <sturnbullyhgfl.net>:
> Is there a class or some code out there which enables you to print your
> PHP code to a web page and make it appear with syntax highlighting?
>
> As an example of what I am after, have a look here;
>
> http://www.phpfreaks.com/phpmanual/page/function.ldap-add.html
>
> Please note this is just an example page which highlights what I am after...

There's a few ways. highlight_file() and highlight_string() will do it.
Another way is to symlink to the .php file as extension .phps -- and
provide a link to the .phps file.

--
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/