Re: [PHP] why so slow?

2006-11-01 Thread Robin Vickery

On 01/11/06, Mel <[EMAIL PROTECTED]> wrote:

Thank you so much.

Yes, I was afraid of putting my passwords...
I can move the include file outside the directory, but what do you
mean by "include the file directly"


Please respond to the list

What I meant was to do this:

  include('/path/to/my/include/misc.inc');

rather than this:

  include('http://www.squareinch.net/include/misc.inc');

The first includes the file directly, the second makes an http request
to www.squareinch.net and includes the response.

-robin

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



Re: [PHP] why so slow?

2006-11-01 Thread Robin Vickery

On 01/11/06, Mel <[EMAIL PROTECTED]> wrote:

Here is the code for a testing page: http://www.squareinch.net/
client_testing.php?art=btw_logo.jpg
I am sure it is a mess since it is my first!!!


[]

   include("http://www.squareinch.net/include/misc.inc";);


Don't do that - publishing your passwords on the internet is rarely a
good security policy.

Move your include directory out of the document root, then include the
file directly. It'll speed things up too.

Combine query1 and query2 into a single query by using a join rather
than repeating query2 for every single row of query1 - it should save
you 20-odd database queries per page request.

As others have said - make your html validate.

-robin

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



Re: [PHP] counting records in db

2006-10-31 Thread Robin Vickery

On 30/10/06, Robert Cummings <[EMAIL PROTECTED]> wrote:

On Mon, 2006-10-30 at 12:28 +0100, Robin Vickery wrote:
> On 30/10/06, Ivo F.A.C. Fokkema <[EMAIL PROTECTED]> wrote:
> > On Sun, 29 Oct 2006 23:40:47 -0600, Richard Lynch wrote:
> >
> > > On Fri, October 27, 2006 4:53 pm, Børge Holen wrote:
> > >> On Friday 27 October 2006 19:34, Richard Lynch wrote:
> > >>> And the header("Location: ...") requires a full URL.
> > >>
> > >> No it doesn't. but he's missing an ' at first glance
> > >
> > > Yes, it does:
> > > http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30
> > >
> > > Note the use of 'absolute' within that section.
> >
> > Although I always use a full URL as well, doesn't absolute just mean
> > non-relative? As in:
> > Location: /Protocols/rfc2616/rfc2616-sec14.html#sec14.30
> > (absolute URI)
> >
> > Location: ./rfc2616-sec14.html#sec14.30
> > (relative URI)
>
> If you need contextual information to make sense of the URI (such as
> the server name from a previous request) then it's not absolute.
>
> RFC 2396: Uniform Resource Identifiers
>
> "An absolute identifier refers to a resource independent of the
> context in which the identifier is used. In contrast, a relative
> identifier refers to a resource by describing the difference within a
> hierarchical namespace between the current context and an absolute
> identifier of the resource."

Please note you are quoting from an RFC with the following title:

Uniform Resource Identifiers (URI): Generic Syntax

Pay special attention to "Generic Syntax" in the title.

The RFC linked by Richard clearly indicates that for the Location
response-header that "the field value consists of a single absolute
URI". This currently has the final word for the Location response-header
and therefore is the standard.


What?

Pay special attention to what I wrote.

I wasn't disagreeing with Richard, or the RFC he quoted. The OP
expressed some confusion about what comprised an 'absolute URI' so I
quoted the section of the RFC that defined an 'absolute URI'.

There's no question that a Location header should contain an absolute
URI as its value.

-robin

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



Re: [PHP] counting records in db

2006-10-30 Thread Robin Vickery

On 30/10/06, Ivo F.A.C. Fokkema <[EMAIL PROTECTED]> wrote:

On Sun, 29 Oct 2006 23:40:47 -0600, Richard Lynch wrote:

> On Fri, October 27, 2006 4:53 pm, Børge Holen wrote:
>> On Friday 27 October 2006 19:34, Richard Lynch wrote:
>>> And the header("Location: ...") requires a full URL.
>>
>> No it doesn't. but he's missing an ' at first glance
>
> Yes, it does:
> http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30
>
> Note the use of 'absolute' within that section.

Although I always use a full URL as well, doesn't absolute just mean
non-relative? As in:
Location: /Protocols/rfc2616/rfc2616-sec14.html#sec14.30
(absolute URI)

Location: ./rfc2616-sec14.html#sec14.30
(relative URI)


If you need contextual information to make sense of the URI (such as
the server name from a previous request) then it's not absolute.

RFC 2396: Uniform Resource Identifiers

"An absolute identifier refers to a resource independent of the
context in which the identifier is used. In contrast, a relative
identifier refers to a resource by describing the difference within a
hierarchical namespace between the current context and an absolute
identifier of the resource."

-robin

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



Re: [PHP] regex

2006-10-19 Thread Robin Vickery

On 19/10/06, Bagus Nugroho <[EMAIL PROTECTED]> wrote:

Hi All,

If we have variable like :

$var1 = 'abcde 12';
$var2 = 'abcdefghi 34';
$var3 = 'abc 20 def';

Then we want output like :
$var1 = 'abcde';
$var2 = 'abcdefghi';
$var3 = 'abc def';



$re = '/^\s+|\d+\s*|\s*\d+\s*$/';

$var1 = preg_replace($re, '', $var1);

It may or may not be what you're after, but it handles all your examples.

-robin

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



Re: [PHP] Re: How to recognise url in a block of text

2006-10-19 Thread Robin Vickery

On 18/10/06, AYSERVE.NET <[EMAIL PROTECTED]> wrote:

Hello Guys,
I thought I was home and dry when the program worked fine on my windows
but when I ran from my Linus server, I keep getting a url like:
http://www.website.com/pdf/ED1.pdf%A0 instead of
http://www.website.com/pdf/ED1.pdf.


I'd look at the text that you're working on rather than the regexp. It
looks like some characterset conversion is going wrong - 0xA0 is the
latin-1 non-breaking space character. I'm expect that on your linux
machine that it's being converted to %0A at some point which is
perfectly valid in a URL.

But I'm just guessing.

-robin

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



Re: [PHP] Re: How to recognise url in a block of text

2006-10-18 Thread Robin Vickery

On 18/10/06, Ivo F.A.C. Fokkema <[EMAIL PROTECTED]> wrote:

On Tue, 17 Oct 2006 17:26:42 +0100, Robin Vickery wrote:

> On 17/10/06, Al <[EMAIL PROTECTED]> wrote:
>> AYSERVE.NET wrote:
>> > Please, I need help on how to to recognise url in a block of text being
>> > retrieved from a database and present it as a link within that text.
>> >
>> > I will appreciate any help.
>> > Regards,
>> > Bunmi
>> Show us some examples of URL substrings, with any variations, you want to 
handle.
>>
>> Most likely a regex function will do the job.
>
> In 6 easy steps:
>
> Step 1: Pinch  a regexp from perl...
>
>   perl -e 'use Regexp::Common; print $RE{URI}{HTTP}, "\n";'
>
> Step 2: Double up all backslashes
>
>   M-x replace-string \ \\
>
> Step 3: Escape single quote-marks
>
>   M-x replace-string ' \'
>
> Step 4. modify slightly to cope with the https scheme by adding an
> optional 's' to the http scheme.
>
> Step 5. add angle-brackets as delimiters
>
> Step 6. use in a preg_replace()
>
> 
> $textString = 'orem ipsum dolor sit amet, consectetuer adipiscing
> elit. Proin et urna. Duis quam. Suspendisse potenti. Etiam sem tortor,
> ultricies nec,  http://example.com  imperdiet nec, tempus ac, purus.
> Suspendisse id lectus. Nam vitae quam. Aliquam ligula nisl, vestibulum
> vulputate, tempor nec, https://www.example.com  tincidunt sit amet,
> libero. Suspendisse a justo. Cum sociis natoque penatibus et.';
>
> $url_regexp = 
'<(?:(?:https?)://(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-9]*[a-zA-Z0-9]|[a-zA-Z])[.]?)|(?:[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+)))(?::(?:(?:[0-9]*)))?(?:/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9\\-_.!~*\'():@&=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)(?:;(?:(?:[a-zA-Z0-9\\-_.!~*\'():@&=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*))*)(?:/(?:(?:(?:[a-zA-Z0-9\\-_.!~*\'():@&=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)(?:;(?:(?:[a-zA-Z0-9\\-_.!~*\'():@&=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*))*))*))(?:[?](?:(?:(?:[;/?:@&=+$,a-zA-Z0-9\\-_.!~*\'()]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)))?))?)>';
>
> $output = preg_replace($url_regexp, '$0', $textString);
>
> print $output;
> ?>
>
> If http and https isn't enough for you, there's another more general
> regexp but... well, it's 8.5Kb long.

Holy !!!

I've used regexps for quite a while now, but won't even begin to read
that. I use:

/^(ht|f)tps?:\/\/([0-9]{1,3}(\.[0-9]{1,3}){3}|([0-9a-z][-0-9a-z]*[0-9a-z]\.)+[a-z]{2,4})\/?[%&=#0-9a-z\/._+-]*\??.*$/i

to match an full URL with domain name or IP address, and:

/((ht|f)tps?:\/\/([0-9]{1,3}(\.[0-9]{1,3}){3}|([0-9a-z][-0-9a-z]*[0-9a-z]\.)+[a-z]{2,4})\/?[%&=#0-9a-z\/._+-]*\??[^[:space:]]+)/i

to replace an space delimited URL with preg_replace.

It has worked fine for me, but I just can't read your regexp, so I can't
see why it's better.


Depends what you want it for - the Regexp::Common expression is
precise - it matches a well-formed http or https URI, nothing more or
less. It's also used in thousands of perl applications through
Regexp::Common and has been extremely thoroughly tested.

Yours is an approximation - it probably works fine for this kind of
job, but it will make mistakes at times.

For instance - if the OP is trying to display html source with the links live:

$text='<a href="http://www.example.com">this is a link</a>';

The Regexp::Common expression just matches the URI, whereas yours
matches all the way through to the end of the word "this".

-robin

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



Re: [PHP] Re: How to recognise url in a block of text

2006-10-17 Thread Robin Vickery

On 17/10/06, Al <[EMAIL PROTECTED]> wrote:

AYSERVE.NET wrote:
> Please, I need help on how to to recognise url in a block of text being
> retrieved from a database and present it as a link within that text.
>
> I will appreciate any help.
> Regards,
> Bunmi
Show us some examples of URL substrings, with any variations, you want to 
handle.

Most likely a regex function will do the job.


In 6 easy steps:

Step 1: Pinch  a regexp from perl...

 perl -e 'use Regexp::Common; print $RE{URI}{HTTP}, "\n";'

Step 2: Double up all backslashes

 M-x replace-string \ \\

Step 3: Escape single quote-marks

 M-x replace-string ' \'

Step 4. modify slightly to cope with the https scheme by adding an
optional 's' to the http scheme.

Step 5. add angle-brackets as delimiters

Step 6. use in a preg_replace()

http://example.com  imperdiet nec, tempus ac, purus.
Suspendisse id lectus. Nam vitae quam. Aliquam ligula nisl, vestibulum
vulputate, tempor nec, https://www.example.com  tincidunt sit amet,
libero. Suspendisse a justo. Cum sociis natoque penatibus et.';

$url_regexp = 
'<(?:(?:https?)://(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-9]*[a-zA-Z0-9]|[a-zA-Z])[.]?)|(?:[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+)))(?::(?:(?:[0-9]*)))?(?:/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9\\-_.!~*\'():@&=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)(?:;(?:(?:[a-zA-Z0-9\\-_.!~*\'():@&=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*))*)(?:/(?:(?:(?:[a-zA-Z0-9\\-_.!~*\'():@&=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)(?:;(?:(?:[a-zA-Z0-9\\-_.!~*\'():@&=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*))*))*))(?:[?](?:(?:(?:[;/?:@&=+$,a-zA-Z0-9\\-_.!~*\'()]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)))?))?)>';

$output = preg_replace($url_regexp, '$0', $textString);

print $output;
?>

If http and https isn't enough for you, there's another more general
regexp but... well, it's 8.5Kb long.

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



Re: [PHP] Re: Re: Re: Frustrated trying to get help from your site

2006-10-04 Thread Robin Vickery

On 03/10/06, David Robley <[EMAIL PROTECTED]> wrote:

Michelle Konzack wrote:

> Am 2006-09-27 17:39:25, schrieb David Robley:
>
>> 88 tons!! Point us to an image of that please.
>
> Currently not availlable but it is an ex Pershing II Transporter
> from the US-Army manufactured by the german Enterprise MAN.

You surely don't mean the tracked vehicle that was used to transport the
missiles? How the #&%@ can you register and drive something like that.
Boggle!


Probably not. Try looking for a picture of a MAN M1014 Transporter
Erector Launcher.

ummm... here's one:

http://commons.wikimedia.org/wiki/Image:M-1014_MAN.jpg

-robin

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



Re: [PHP] array_sum($result)=100

2006-09-25 Thread Robin Vickery

On 24/09/06, Ahmad Al-Twaijiry <[EMAIL PROTECTED]> wrote:

Hi everyone

I have array of numbers and I want to get out of it a list of numbers
that if I sum them it will be 100, here is my list (for example ) :

$list = array(10,20,10,10,30,50,33,110,381,338,20,11,200,100);


I want the result to be :

$result = array( 10,20,10,10,50);

as you can see in the array $result , if we array_sum($result) the
result will be 100.

is they any algorithm to do this ?


Ah, the Subset Sum Problem - this isn't school homework by any chance?

http://en.wikipedia.org/wiki/Subset_sum_problem

-robin

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



Re: [PHP] Best way to get PHP5

2006-08-10 Thread Robin Vickery

On 10/08/06, Chris W. Parker <[EMAIL PROTECTED]> wrote:

Jonathan Duncan 
on Wednesday, August 09, 2006 3:55 PM said:

> If you want to really learn Linux, try Gentoo.  If you just want a
> very good and easy to use Linux, go with SuSE.

To keep this related to the question I asked...

Do either of the latest builds of these distros have PHP5?


Why not just look?

http://packages.gentoo.org/packages/?category=dev-lang;name=php
http://www.novell.com/products/linuxpackages/suselinux/php5.html

Although I have to say - if you're scared of compiling PHP, Gentoo's
probably not the distribution for you.

-robin

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



Re: [PHP] The difference between ereg and preg?

2006-08-04 Thread Robin Vickery

On 04/08/06, Dave M G <[EMAIL PROTECTED]> wrote:


It seemed that the main difference was that preg_replace required
forward slashes around the regular expression, like so:
preg_replace("//", "", $htmlPage);


It requires delimiters - slashes are conventional, but other
characters can be used.



But that didn't work, and returned an error.


What you've written here shouldn't return you an error - what did the
message say?

I suspect you were trying to match until  rather than  and
the pcre engine thought the forward slash was the end of your regular
expression.


Part of that code deleted all the unwanted text from the very top of the
page, where it says "" tag.


It won't quite do that.

The (.*) matches as much as possible (it's called greedy matching) -
so it'll match and replace all the way down to the *last* instance of
a "" tag.

To make it match for the shortest length possible, put a question-mark
after the ".*" like so:

  preg_replace("//", "", $htmlPage);


Since ereg was working, though, I figured I would just stick with it.

Still, I thought it worth asking:

Is there any reason why either ereg or preg would be more desirable over
the other?


pcre has a performance advantage, has more features and can use the
many regexps written for perl with few or no changes.

ereg is a posix standard.

 -robin

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



Re: [PHP] SQL injection

2006-08-03 Thread Robin Vickery

On 02/08/06, Jochem Maas <[EMAIL PROTECTED]> wrote:

Russell Jones wrote:
>
> In real life terms, if you walked into the store and saw that the cash
> register was slightly broken and slightly opened, and reached in and pulled
> out a dollar to show the cashier what was wrong, you would not get in
> trouble. It may be bold, but it is not a crime.

technically removing the dollar is a crime regardless of your intention.



Even that depends where you are - in England & Wales you wouldn't be
guilty of theft as defined by the 1968 Theft Act: "a person is guilty
of theft if: he dishonestly appropriates property belonging to another
with the intention of permanently depriving the other of it."

So in that case the intent is very relevant.

-robin

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



Re: [PHP] AES client side

2006-07-31 Thread Robin Vickery

On 31/07/06, Jon Anderson <[EMAIL PROTECTED]> wrote:

Jay Blanchard wrote:
> Yes, but that shouldn't matter. The algorithms for RSA, AES, etc, etc
> are all publicly available, why bother hiding their JavaScript
> implementations? Only the data would be encrypted.
> [/snip]
>
> So, you're suggesting that you can use Ajax or some other mechanism to
> hide the key on the server?
>
There's no "hiding". You could use a secure key exchange mechanism, such
as Diffie-Hellman.

Diffie-Hellman is used to generate a shared key between two hosts (say
"A" and "B") such that each host knows the key, but any third party
listening in on the information is unable to trivially reconstruct the key.

See: http://en.wikipedia.org/wiki/Diffie-Hellman


How about if the third party can control one side of the transaction
by altering the javascript that implements it while in transit -  for
instance by adding a couple of lines that transmit the key to the
third party after the key exchange?

-robin

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



Re: [PHP] Calculations and exponents in languages

2006-06-28 Thread Robin Vickery

On 28/06/06, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:

Huh.. thanks for the illustration Robin.  Can't say that I did much with 
exponents when I've played around with perl or python or C.. and never worked 
with Java.  You've expanded my view.

Ok, now what languages DO use ^ for exponents?


The only one I can think of off the top of my head is BASIC.

Even Bash uses ^ as an xor operator:

  $ echo $(( 7 ^ 2 ))
  5
  $ echo $(( 7 ** 2 ))
  49

-robin

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



Re: [PHP] Calculations

2006-06-28 Thread Robin Vickery

On 28/06/06, tedd <[EMAIL PROTECTED]> wrote:

At 2:30 PM -0400 6/27/06, Kristen G. Thorson wrote:
>
>http://www.php.net/manual/en/language.operators.bitwise.php
>

I wonder why that's true for php when it's common to use ^ in many other 
languages
for powers?


Perl: ^ is the bitwise xor operator
Python: ^ is the bitwise xor operator
C: ^ is the bitwise xor operator
Java: ^ is the bitwise xor operator
...

-robin

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



Re: [PHP] Removing an aspect of a variable...

2006-06-06 Thread Robin Vickery

On 06/06/06, Rob W. <[EMAIL PROTECTED]> wrote:

Say I have a variable setting an ip address of 192.168.100.0

I want to be able to remove the last to chr's of that variable ie: .0

What would be my best solution to do that?



Remove the last two characters of a string?

  $shorterString = substr($string, 0, -2);

Whether that's really what you want to be doing with an IP address is up to you.

-robin

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



Re: [PHP] regex problem

2006-06-01 Thread Robin Vickery

On 01/06/06, Merlin <[EMAIL PROTECTED]> wrote:

Hi there,

I do work on following regex:
^(.*)_a[0-9](.*).htm$

This should be valid for "test_a9393.htm", but not for "9393.htm" as
ther is no leading _a infront of the number.

Unfortunatelly this also works for the 9393.htm file. Can somebody give
me a hint why the regex also is true for text that does not start with
_a infront of the number?



It won't match something without an _a in it. So there's something
you're not mentioning.



'test_a9393.htm' matches.
'a9393.htm' does not match.

-robin

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



Re: [PHP] Why does this preg_replace function not work?

2006-05-26 Thread Robin Vickery

On 26/05/06, Dave M G <[EMAIL PROTECTED]> wrote:

I also tried str_replace(), but predictably that did not help. As far as
I understand it, it does not accept arrays.


It does, and you can do it with str_replace.



What am I doing wrong in the above code?

And can the two preg_replace() commands be achieved in one line?


They can, however you need to build the pattern properly.

', $content);
}

$tags = array ("h3", "em", "strong", "hr");
$content = '[em] this [/em] is converted and [ignore] this [/ignore] is not.';

$content = to_html($content, $tags);
?>

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



Re: [PHP] Serialize

2006-05-24 Thread Robin Vickery

On 24/05/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

Hi,

Is a serialized array a "safe" string to insert into a mysql text field? Or is a
function such as mysql_real_escape_string always needed?


No, it's not at all a safe string to insert into a mysql text field.
mysql_real_escap_string() is needed.

-robin

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



Re: [PHP] Parse error: syntax error, unexpected ',' in

2006-05-23 Thread Robin Vickery

On 24/05/06, Mark Sargent <[EMAIL PROTECTED]> wrote:

Hi All,

this code,

";
echo "My favourite flavours are:";
 foreach ($flavour as $currentValue) {
//these lines will execute as long as there is a value in $flavour
echo $currentValue "\n";
 }
?>


gives this,

*Parse error*: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING,
expecting ',' or ';' in */usr/local/apache2/htdocs/sorting.php* on line *18

*
and adding a , to this line,

   foreach ($flavour, as $currentValue) {


No, you were right the first time. No comma is required there.

Line 18 is the line with the echo statement on it. The items you want
to echo should be separated by commas:

So it should be:

   echo $currentValue, "\n";

-robin

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



Re: [PHP] Fast search

2006-05-17 Thread Robin Vickery

On 17/05/06, René Fournier <[EMAIL PROTECTED]> wrote:

Looking for suggestions on the most compute-efficient way to search
variable-length strings (~200 characters) for the occurrence of one
of about 100 possible needles. In other words:






$needles = array ( 1 => "Hello Jim" , 2 => "Yellow Banana" , 3 =>
"Red Car", ... etc  (100 elements)

$haystack = "Once upon a time there was a programming language that
everyone loved. Its name was PHP, and the people that worked with it
also liked Yellow Bananas. One day...";



What version of php?

If you're using php5  then you could do:



-robin

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



Re: [PHP] Wierd ass code...

2006-05-15 Thread Robin Vickery

On 14/05/06, Gonzalo Monzón <[EMAIL PROTECTED]> wrote:

Satyam escribió:
> Of course, another possibility is that the author does not know how to
> handle multidimensional arrays (just to say it before anyone else
> points an obvious alternative)
>

I don't think the author does not know how to handle multidimensional
arrays. I thought the author was more concerned about performance than
other issues people like as coding "beautifuly"...  Maybe author's
approach is weird, but its twice faster in the worst case!!

Sure the author only needs to loop the whole array and doesn't need
multi-dimensional approach... 'cause its a lot faster to iterate once
the array is filled!!

Look at the test I've done (below) its seems filling multi-dimensional
arrays is n/2 faster than single dimension, but then when you need to
read the array data, a multi-dimensional approach is always worse than
n*6!!


Your setup is odd. I get much more similar results with both php 4 and 5.

You're also using a more than slightly odd way of iterating through the array.

These does exactly the same as your Test functions and are considerably faster:

 $v) {
   foreach ($v as $k2 => $v2);
 }
}
?>

Test results from PHP 5.0.5:

Fill style A, bidimensional array: 3.0747
Iteration style A, bidimensional array: 2.4385
Total time style A: 5.5135

Fill style B, single-dimension array: 4.6502
Iteration style B, single-dimension array: 2.3964
Total time style B: 7.047

Fill style C, bidimensional array: 2.5237
Iteration style C, bidimensional array, foreach loop: 1.3415
Total time style C: 3.8656

Test results from PHP 4.4.0:

Fill style A, bidimensional array: 3.2056
Iteration style A, bidimensional array: 2.3848
Total time style A: 5.5907

Fill style B, single-dimension array: 5.1468
Iteration style B, single-dimension array: 2.4016
Total time style B: 7.5488

Fill style C, bidimensional array: 2.6899
Iteration style C, bidimensional array, foreach loop: 1.4073
Total time style C: 4.0976

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



Re: [PHP] question about using temporary named pipe in the string for system

2006-05-11 Thread Robin Vickery

On 11/05/06, Jochem Maas <[EMAIL PROTECTED]> wrote:

Ginger Cheng wrote:
> Hello, PHP gurus,
> I have a command that I want to run using system function. The
> command exploits temporary named pipes in the place of temporary files.
>   my command is
> paste   <(cut -f1  file1)  <(cut -f2  file2)> final_file
>
>  It works perfectly well if I just type it in my interactive
> shell.  But if I do a
>
> 
> final_file";
> system($cmd);
> ?>
>
>  I got the syntax error msg as
> "sh: -c: line 1: syntax error near unexpected token `('".   I have tried

I notice that the 'sh' shell is being used according to your error output,
I'm guessing that maybe your interactive shell is running something like 'bash'
and that this discrepency might the root cause of the problem. just a guess -
I don't know how you would define another shell for php to use either :-/.


That's exactly what's causing it.

One thing the OP can do is invoke bash to run his command line:

  $cmd = '/bin/bash -c  "paste <(cut -f1 file1) <(cut -f2 file2) > file3"';

Alternatively, arrange the command line more efficiently:

  $cmd = 'paste file1 file2 | cut -f1,6 > file3';

(replacing the '6' with the correct field number)

-robin

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



Re: [PHP] Sanity checker?

2006-05-03 Thread Robin Vickery

On 03/05/06, Ezra Nugroho <[EMAIL PROTECTED]> wrote:


PHP experts everywhere,


Does anyone know of any tools to test the sanity of your php code?

If you were to check the sanity of your code, what would you look for?


Hidden messages encoded in the whitespace.

-robin

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



Re: [PHP] What means "Fatal error: pcntl_fork(): Error 11"?

2006-05-02 Thread Robin Vickery

On 02/05/06, Oz <[EMAIL PROTECTED]> wrote:

Hi,

My script dies with the following line (after a few hours running without other 
errors/warnings/notices):
Fatal error: pcntl_fork(): Error 11 in /home/foo/bar.php on line 297

Is there any documentation for "pcntl_fork(): Error 11"?
Does anybody know what causes "pcntl_fork(): Error 11"?

(It's PHP5 and the scripts source is top secret.)


The 11 is from errno.h and it corresponds to EAGAIN.


From the docs for fork()

The fork() function shall fail if:

[EAGAIN]
The system lacked the necessary resources to create another process, or
 the system-imposed limit on the total number of processes under execution
 system-wide or by a single user {CHILD_MAX} would be exceeded.


Does that help?

-robin

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



Re: [PHP] Natural order of things.

2006-04-27 Thread Robin Vickery
On 27/04/06, tedd <[EMAIL PROTECTED]> wrote:
> >On Wed, 2006-04-26 at 16:57, Robert Cummings wrote:
> >>  On Wed, 2006-04-26 at 16:51, tedd wrote:
> >>  > Hi gang:
> >>  >
> >>  > I posted the following question to the MySQL list, but the only
> >>  > answer I received thus far was a php solution (it didn't work for
> >>  > what I wanted).
> >>  >
> >>  > As such, maybe if I post a MySQL question to the PHP group, then I'll
> >>  > receive a MySQL answer -- so here goes:
> >>  >
> >>  > I'm using the following query, and it works.
> >>  >
> >>  > SELECT id, title, url_image_small
> >>  > FROM $dbtable
> >>  > WHERE type="type_title"
> >>  > ORDER BY title
> >>  > LIMIT $offset, $rowsPerPage"
> >  > >
> >-snip-
> >  > You need ot perform a type conversion from string to integer.
> >
> >Sorry, just realized... "Basel Square" is part of the entry in the table
> >:/ Do you have entries that aren't prefixed with Basel Square?
> >
> >Cheers,
> >Rob.
>
> Rob:
>
> Yes, there are other titles, such as:
>
> Celtic Deco 1
> Lucerne 1
> Dutch Hearth 1
>

Yeah, two items of information in the same column's not really a good
idea, which is why you're finding it so tricky.

So what you can do is this:

SELECT title,
   LEFT(title, LENGTH(title) - LENGTH(SUBSTRING_INDEX(title, ' ', 
-1))) AS name,
   CAST(SUBSTRING_INDEX(title, ' ',  -1) AS UNSIGNED) AS number
FROM $dbtable
ORDER BY name, number;

So that's finding the position of the last space and putting
everything up to that in `name`. Then it's taking everything after
that, turning it into an integer and putting it in `number`.

Then the ORDER BY works as you'd like because it's sorting on an
actual number rather than a string representation of a number.

If you'd had the name and the number in separate columns in the first
place it would be so much simpler.

  -robin

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



Re: [PHP] Session contamination?

2006-04-20 Thread Robin Vickery
On 20/04/06, Ben Liu <[EMAIL PROTECTED]> wrote:
> Hello All,
>
> I'm using a single development server to host multiple client
> projects, many of which require session management. I've noticed that
> sometimes when I test these various web apps (which are simply in
> separate sub directories) I get session leakage where logging in and
> establishing a session on one app allows me access to (automatically
> logs me in) to other app(s) on the same server. Or sometimes a session
> variable will be set across all the apps, like $_SESSION['username'].
>
> Is this due to the fact that sessions are established between client
> browsers and servers, regardless of directory/sub directory?

Yes - that's the default behaviour, although if you set
session.cookie_path separately for each app, they shouldn't share
session cookies. You might also want to look at session.save_path
which will allow each app to save their session files in a different
location.

  -robin

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



Re: [PHP] Re: no offense to Rasmus... are you kidding me

2006-04-19 Thread Robin Vickery
On 19/04/06, Matt Todd <[EMAIL PROTECTED]> wrote:
>
> I know that PHP is a functional language, and secondly, an OO
> language, but I think that you can blend these things better and have
> the OO brought to the forefront a bit more.

PHP is not a functional language, it's an imperative language.

 -robin

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



Re: [PHP] creating a SELECT AND query

2006-04-18 Thread Robin Vickery
On 18/04/06, Ross <[EMAIL PROTECTED]> wrote:
>
> $query1= "select * from $table_name WHERE sname LIKE '$search_string%' ";
>
> if ($area="a")  {
> $query1 .=" AND area='a'";
>  }
>  else {
>   $query1 .="AND area='$area'";
>   }

Firstly, you're assigning "a" to area rather than testing whether
$area is "a". You need a "==" operator, not a "=".

Secondly, even if you were testing $area properly, you're doing the
same thing in both halves of the if-statement. Which isn't very
useful.

Really, you only need the "AND area='?'" part if $area is not equal to "a":

if ($area != "a") {
   $query1 .= " AND area='$area'";
}

  -robin

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



Re: [PHP] Re: String /pattern formatting extraction question

2006-04-10 Thread Robin Vickery
On 10/04/06, Andy <[EMAIL PROTECTED]> wrote:
> >> text1 /ptext2 /otext3
> > Does it always look like that?
> > text1(whitespace)/ptext2(whitespace)/otext3
>
> The ideea is to extract the texts before and between /o and /p.
> $html = "asdäüü ö ö vf /pxtestxx/ostestss";
> eregi("^([^/.*]*)", $html, $reg); print_r($reg); //text is in reg[1]
> eregi("^(.*)/p([^/.*]*)", $html, $reg); print_r($reg); //text is in reg[2]
> eregi("^(.*)/o([^/.*]*)", $html, $reg); print_r($reg); //text is in reg[2]
>
> This example works, but I thought there might be a better way to extract the
> texts, with a single ereg or preg_match.

Well... slightly.

preg_match( '#^(+)/p(.+)/o(.+)$#',
preg_replace('#^(.+)(/o.+)(/p.+)$#', '$1$3$2', $html), $reg);

  -robin

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



Re: [PHP] stripping enclosed text from PHP code

2006-04-10 Thread Robin Vickery
On 09/04/06, Winfried Meining <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I am writing on a script that parses a PHP script and finds all function calls
> to check, if these functions exist. To do this, I needed a function that would
> strip out all text, which is enclosed in apostrophes or quotation marks. This
> is somewhat tricky, as the script needs to be aware of what really is an
> enclosed text and what is PHP code.

So use the built in tokenizer functions which know exactly what's
enclosed text and what is php code. Much quicker and more reliable
than trying to do the same job with regular expressions.

http://se.php.net/tokenizer

  -robin

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



Re: [PHP] simple regex query

2006-04-06 Thread Robin Vickery
On 06/04/06, Angelo Zanetti <[EMAIL PROTECTED]> wrote:
>
> Anyway for a simple query, if I just wanted to check that a variable has only 
> text and numeric characters would I do something like this
> (i want it to fail if it finds a symbol eg: + - { " etc...):
>
> echo  "REG result: " . preg_match('/[a-zA-Z0-9]*/', '{d-fg');
>
> however this resolves to true because there are normal characters 
> (alphabetical characters) so how do I make the expression fail because of the 
> { and - characters in the string?
>
> You can also list which characters you DON'T want -- just use a '^' as the 
> first symbol in a bracket expression
> (i.e., "%[^a-zA-Z]%" matches a string with a character that is not a letter 
> between two percent signs). But that would mean that I would have to list 
> each symbol I dont want and that would be
> undesireable as it would be better to list exactly what the acceptable 
> characters are.

You're pretty much there. Your first example resolved to true because
you didn't anchor the start and end of the expression.

/^[a-z0-9]*$/i

It would be a bit more efficient to use the negated character class
you mentioned.

  /[^a-z0-9]/i

All you need to bear in mind is that preg_match() would then return
true if the string contains an illegal character and false if it is OK
rather than the other way around.

So these should both produce the same result:

preg_match('/^[a-z0-9]*$/i', '{d-fg');
!preg_match('/[^a-z0-9]/i', '{d-fg');

  -robin

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



Re: [PHP] object oriented syntax in php

2006-03-28 Thread Robin Vickery
On 28/03/06, Merlin <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I do have problems with object oriented syntax as this is not familar to me.
> There is following output:

>
>
> Now I would like to retrieve my needed info out of it. How do I do this? 
> (sounds
> a bit silly this question, sorry :-)
>
> I tried:
> $ping_result = $ping->ping('php.net');
> echo $ping_result["net_ping_result"]["_raw_data"][5];

You'd be much better using the interface to Net_Ping_Result that's
provided. Then your code won't break if someone decides to rearrange
the internals of the class.

$ping_result->getMin();
$ping_result->getMax();
$ping_result->getAvg();
$ping_result ->getTransmitted();
$ping_result->getReceived();
$ping_result->getLoss();
...


 -robin

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



Re: [PHP] Is there a mysql newsgroup like this php.general ANYONE?

2006-03-27 Thread Robin Vickery
On 27/03/06, Anasta <[EMAIL PROTECTED]> wrote:
> I need help with an insert using joins.
>

Yes, there is. You'll find all the mysql lists/newsgroups here:

  http://lists.mysql.com/

  -robin

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



Re: [PHP] array_search function bugged? update

2006-03-27 Thread Robin Vickery
On 27/03/06, je killen <[EMAIL PROTECTED]> wrote:
> Hi all
> Here is an update on my problem reported with the array_search function.
> to those who directed me to the bug report page, thanks.
> There are a number of reports specific to this function. Maybe event
> someone else has written a fix.
> here is my solution to my problem.

There are no open bug reports for array_search(). Loads of bogus ones though.

array_search() also completely the wrong tool for the job - the code
you posted is much more complicated and slower than it needs to be.

That whole palaver that you go through to produce $reduced could be
replaced with:

   $reduced = array_merge(array(), array_unique($str));

That nested loop you use to produce $final would be rather simpler and
faster if you just flipped $reduced and used a hash lookup.

   $charmap = array_flip($reduced);
   foreach ($str as $char) { $final[] = $charmap[$char]; }

-robin

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



Re: [PHP] deleting muliple feilds from a table using an array

2006-03-24 Thread Robin Vickery
On 24/03/06, benifactor <[EMAIL PROTECTED]> wrote:
>
> //$del will look like 38, 40, 43
>
> $query = "delete From news where id = '$del'";
>
> This code will only delete the first value of $idd. what i think is wrong is 
> i have the incorrect syntax to delete multiple feilds from a table if some 
> one can help me it would be greatly appreactiated.
>

DELETE FROM news WHERE id IN (38, 40, 43)

 -robin

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



Re: [PHP] Why does this work on one server...(Final comment)

2006-03-24 Thread Robin Vickery
On 24/03/06, tedd <[EMAIL PROTECTED]> wrote:
>
> Storing things in MySQL should not be based upon "If you're going to
> search the field or not". MySQL storage is simply a way to store
> stuff. It's not that much different than storing things on the "file
> system" because all you're storing is 1's and 0's anyway, right? It
> should not make any difference if file's 1's and 0's are stored on a
> file system's hard drive or the files 1's and 0's are stored in a
> MySQL dB, which is also stored on a hard drive, right?
>
> Remember, the only difference here is the overhead architecture of
> how to access the data -- there are no differences between 1's and
> 0's depending on where they are stored on a hard drive.
>
> Now, one can argue that the time it takes to pull an image from MySQL
> is different than from the file system, I've experienced that, and
> it's important to me, and I will be changing my method to the file
> system.
>
> However, using MySQL for storing things does present some advantages
> -- like associating related but different data types together data in
> one record (it's hard to do that using a file system); moving data
> from one server to another (again, it's hard to do that with a file
> system); easier record keeping and editing; and if my memory serves
> me right (which may be in error), there is a limit to the number of
> records you can have in a directory whereas that isn't so in MySQL
> (memory permitting of course).

The technical limit per directory in ReiserFS is slightly more than
half a billion files. Although with the standard hashing function the
practical limit is about 1.2 million. Would you like to hazard a guess
about MySQL's performance with 1.2 million images in the same file?

MySQL stores each table in it's own file which is subject to the
filesystem size limits. For example the maximum file size in ReiserFS
3.5 is 2 Gig. So ignoring all the overheads, to fit more than 1.2
million images in a table, they'd have to average rather less than 2kb
in size.

Each of these images is likely to be a different size so you're stuck
with variable length records, which has a significant performance
impact in MySQL. It'll also result in gaps in the file which will
further restrict the amount you can get in there.

You'd better make sure your indexing on the table is good, because a
sequential scan over that amount of data will give your disk IO a good
workout.

If you'd kept all your files in the filesystem you'd be able to
leverage all the efficient tools honed over the years to manipulate
them, and copying them to another server would involve just a simple
rsync.

If you need to associate the files with a particular record, all you
need to do is store the filename. It's not rocket science.

At the physical level, you're correct; It's all just binary data. At
every other level there's a big difference between using the
filesystem directly and bunging everything in MySQL.

  -robin

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



Re: [PHP] undefined function error with lost password script

2006-03-24 Thread Robin Vickery
On 24/03/06, Barry <[EMAIL PROTECTED]> wrote:
> Robin Vickery wrote:
> > On 24/03/06, Richard Lynch <[EMAIL PROTECTED]> wrote:
> >
> >>In incredibly ancient versions of PHP, you needed to have the:
> >>
> >>function foo () { ... };
> >>
> >>appear BEFORE you called it.
> >>
> >
> >
> > You still do in PHP5 if the function definition is in a conditional
> > block. Like his.
> >
> > But apparently the script was thoroughly tested before he paid for it,
> > so that can't be the problem :-)
> >
> >   -robin
> Well if it was throughly tested then there wouldn't be errors.
> And the error "is" because of the function called before declared.

 I R O N Y 

-robin

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



Re: [PHP] undefined function error with lost password script

2006-03-24 Thread Robin Vickery
On 24/03/06, Richard Lynch <[EMAIL PROTECTED]> wrote:
>
> In incredibly ancient versions of PHP, you needed to have the:
>
> function foo () { ... };
>
> appear BEFORE you called it.
>

You still do in PHP5 if the function definition is in a conditional
block. Like his.

But apparently the script was thoroughly tested before he paid for it,
so that can't be the problem :-)

  -robin

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



Re: [PHP] undefined function error with lost password script

2006-03-23 Thread Robin Vickery
On 23/03/06, Mark <[EMAIL PROTECTED]> wrote:
> Can anyone see a problem with this at a glance. I think i have pushed my
> luck with this forum ( inc. Chris)of late but i paid a lot of money for this
> script and it has a few bugs.
>
> THis is what i get returned---
> Fatal error: Call to undefined function: recover_pw() in
> /home/realt905/public_html/lost_pw.php on line 70
>
> where line 70 is : recover_pw($_POST['email_address']);
>
>
> 
>  include("connect.php");
>
> if (isset($_POST['Submit'])) {
>
>   [...]
>  recover_pw($_POST['email_address']);
>
>  function recover_pw($email_address){
>  [...]
>   }

Normally it doesn't matter if you define a function before or after
you use it., but you're defining the function conditionally - if
$_POST['Submit'] isn't set then recover_pw() will not be defined. In
that case you have to make sure it's defined before it's used.

The manual tells you that.

   http://au.php.net/manual/en/language.functions.php

The solution is to take the function definition out if the if-block.

  -robin

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



Re: [PHP] Inserting data at runtime (php,mysql)

2006-03-21 Thread Robin Vickery
On 21/03/06, sathyashrayan <[EMAIL PROTECTED]> wrote:
>
> - Original Message -
> From: "Dan Parry" <[EMAIL PROTECTED]>
> To: "'sathyashrayan'" <[EMAIL PROTECTED]>; 
> Sent: Tuesday, March 21, 2006 6:12 PM
> Subject: RE: [PHP] Inserting data at runtime (php,mysql)
>
>
> > [snip]
> > $conn=mysql_connect(" ");/*with the required parameters*/
> > if(!conn) <<<
> > {
> > [/snip]
> >
> > You are testing conn in your if condition... should that not be $conn?
> >
>
>   No if conn evaluates to false then error.

Yeah, but it should be $conn, not conn.

PHP treats conn as an unquoted string which evaluates to true, so it's
quite possible that your mysql_connect() is failing and you're not
detecting it.

$ php -r 'if (conn) print "Connected...\n";'
Connected...

You're not checking that you've managed to open the file - if you've
got error_reporting turned down low then you'll miss the warnings from
that.

You've also got problems with the while($funct_var) loop - that return
statement is all that's stopping it looping infinitely and it's still
almost certainly not what you want.

  -robin

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



Re: [PHP] Last array element not found

2006-03-15 Thread Robin Vickery
On 15/03/06, Roman Rumisek <[EMAIL PROTECTED]> wrote:
> Hi,
>
> this code fragment give following result in my error log:
>
> foreach($reg_array as $region_item)
>   $tmp_reg_array[] = $region_item[0];
> $sel_region = explode(',', $_POST[CLIENT_REGION]);
> foreach($sel_region as $sel_region_item)
>   if(!in_array($sel_region_item, $tmp_reg_array))
>   {
> my_error_log("Unknown region: $sel_region_item, region array: ".
>  var_export($tmp_reg_array, TRUE));
> header("Location: ".
>   get_error_result(
>  $state_def[$_SESSION[STATE_VAR]][STATE_REDIR_PAGE])
> );
> exit;
>   }

It's more likely that you've got whitespace before or after the
region, especially if it's the last in the list that's always failing.
 Try trimming the region before passing it to in_array().

Have you ever considered using braces around loop blocks?

  -robin


Re: [PHP] string to integer conversion

2006-03-15 Thread Robin Vickery
On 15/03/06, suresh kumar <[EMAIL PROTECTED]> wrote:
> i am facing one problem in type casting.
> $accno="2927";
> $accno=$accno+1;
> its o/p is 2928. but i want output to be 2928.i am
> waiting response from u.

$accno = sprintf('%08d', $accno+1);

 -robin


Re: [PHP] Is this password protection script secure?

2006-03-14 Thread Robin Vickery
On 14/03/06, IG <[EMAIL PROTECTED]> wrote:
> Hello.
>
> I got a password protected login script of t'internet a while back and
> have implemented it. I just want to make sure it is secure.

It's not.

1. It only works with register_globals turned on. Not a good idea -
register_globals has been off by default for some time now, for good
reason.

2. There's a Cross Site Scripting vulnerability where you're echoing
out the contents of $QUERY_STRING.

3. There's an SQL Injection vulnerability where you're inserting
$username directly into the query without any validation or escaping.

4. You're keeping the passwords in the database unencrypted rather
than using a one way hash which is bad in itself, but then you're
storing also writing them to the session - if you're on a shared
server, it's likely that any other site also on that server is able to
read your session files.

5. You're checking the username and password on every page request -
even after a successful login... which isn't really a security
problem, just wasteful.

  -robin


Re: [PHP] highlight_string()

2006-03-10 Thread Robin Vickery
On 10/03/06, Weber Sites LTD <[EMAIL PROTECTED]> wrote:
> Hi
>
> I'm trying to go with your idea but I'm having difficulties with
> preg_match_all.
> I want the text between . The use of preg_match_all bellow only
> Returns text that is in a single line. If the 
> is
> A few lines bellow, it does not match.
>
> preg_match_all('/<\?php(.*?)\?>/i',$text,$CodeArray,PREG_PATTERN_ORDER);
>

By default a '.' matches any character except for a newline. If you
want it to match *everything* you have to use the 's' pattern modifier
- just stick an 's' on the very end of your pattern, after the 'i'.

   /<\?php(.*?)\?>/is

  -robin


Re: [PHP] Convert all named entities into numeric character references

2006-03-09 Thread Robin Vickery
On 06/03/06, Jacob Friis Saxberg <[EMAIL PROTECTED]> wrote:
> > > Does anyone know of a Php funtion that can do this:
> > > http://golem.ph.utexas.edu/~distler/blog/NumericEntities.html
> > Hi there!
> >
> > http://se.php.net/manual/en/function.htmlentities.php
> >
> > ?
>
> htmlentities converts to named entitites. I want it to numeric entities.

This is probably the simplest way of doing it; write a simple function
that translates entity names to numbers, then start an output buffer
at the beginning of your script using the function as an output
callback function. Then everything after that automatically gets
converted.

In fact it's so simple, I'll do it for you...

Code posted to pastebin:

   http://robinv.pastebin.com/592400

  -robin


Re: [PHP] Re: usort(): The argument should be an array

2006-03-02 Thread Robin Vickery
On 02/03/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Can you inform where precisely I must include, so that neither error is
> displayed or search output is displayed differetly.

Oh, I give up. Where's my Little Book of Calm?...

  -robin


Re: [PHP] Re: usort(): The argument should be an array

2006-03-02 Thread Robin Vickery
Remember14a wrote:
>
>   $i = 0;
>   while ($row = mysql_fetch_row($result)) {
>$res[$i]['title'] = $row[2];
>$res[$i]['url'] = $row[1];
>if ($row[3] != null && $show_meta_description == 1)
> $res[$i]['fulltxt'] = $row[3];
>else
>$res[$i]['fulltxt'] = $row[4];
>
>
>$res[$i]['size'] = $row[5];
>$res[$i]['weight'] = $result_array[$row[0]];
>$i++;
>   }
>
>  usort($res, "cmp");

The var_dump($res) we asked you to insert output "NULL". That means
that $res was undefined.

$res is only defined within your loop and your loop is only executed
if the search comes back with at least one result.

So what you need to do is make sure that $res is an array, even if
there are no results from your query. You do this by initialising $res
to an array before the loop, just like you've done to $i.

All you need to do is add one line, just before the start of the loop that says:

   $res = array();

-robin

(trying hard to remain patient)


Re: [PHP] Failed to open stream

2006-03-01 Thread Robin Vickery
On 01/03/06, tedd <[EMAIL PROTECTED]> wrote:
>
> In any event, considering the Google Police here, I've removed the
> offending code.
>

Google Police? Aye, right!

You asked why your script was failing. It's failing because they
detected you were breaking their terms. Couldn't care less myself;
it's not a php problem.

 -robin


Re: [PHP] Failed to open stream

2006-03-01 Thread Robin Vickery
On 01/03/06, tedd <[EMAIL PROTECTED]> wrote:
> Hi gang:
>
> I have two *identical*l routines residing on two difference hosts --
> one works and the other doesn't.
>
> Please review (this works):
>
> http://www.webbytedd.com/examples/rank.php
>
> However, this doesn't:
>
> http://www.xn--ovg.com/rank.php
>
> Any idea as to what is wrong?

Yes. You're violating google's terms of service.

From your script:

 Warning: 
fopen(http://www.google.com/search?client=navclient-auto&ch=61898169760&features=Rank&q=info:webbytedd.com):
failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden in
/home/tedd/public_html/rank.php on line 124

From the page that gave you the HTTP 403 Forbidden response (surely
that was a a bit of a clue?):

> Forbidden
> Your client does not have permission to get URL
> /search?client=navclient-auto&ch=61898169760&features=Rank&q=info:webbytedd.com
> from this server. (Client IP address: xx.xx.xx.xx)
>
> Please see Google's Terms of Service posted at 
> http://www.google.com/terms_of_service.html

From google's terms of service:
>
> You may not send automated queries of any sort to Google's system without
> express permission in advance from Google. Note that "sending automated
> queries" includes, among other things:
>
>* using any software which sends queries to Google to determine how a
>   website or webpage "ranks" on Google for various queries;

  -robin


Re: [PHP] ftp_get from an IBM Mainframe z/vm system ?

2006-03-01 Thread Robin Vickery
On 01/03/06, Nils Reimann <[EMAIL PROTECTED]> wrote:
>
> $conn_id = ftp_connect($ftp_server);
> $login_result = ftp_login($conn_id, "$ftp_user_name", "$ftp_user_pass");
> $download = ftp_get($conn_id, "$locale", "TEST EXEC", FTP_ASCII);
> ftp_quit($conn_id);
>
> connection workd, but the download did not. i got this error.
>
> Warning: ftp_get(): Error opening in phpfile on line 174

The format of this error message is "Error opening  in

Re: [PHP] Array sort question

2006-02-28 Thread Robin Vickery
On 28/02/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> The array sorting suggestions you provide will not sort based on the
> number of items in each array, which is what the OP wanted.

That's not entirely fair. I would have said his usort() suggestion was
a better pointer than a link to count() - which gives no hint as to
how to sort the list, which is after all what the OP's trying to do.

ObSuggestion:

function byLength($a, $b)
{
   return sizeof($a) - sizeof($b);
}

usort($rgArray, 'byLength');


[PHP] Re: usort(): The argument should be an array

2006-02-28 Thread Robin Vickery
On 28/02/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> No this doesnt solve error.
> let me give you more details to understand problem with the said code.
>
> go to this link, please.
>
> http://www.abcdefg.us/search/search.php
>
> in search enter,
> Justice, you get response without an error.
>
> Now enter law,
>
> you get error, pasted below,
>
> Warning: usort(): The argument should be an array in
> /home2/wwwabcde/public_html/search/searchfuncs.php on line
> 300

Yeah, sure.

So you know $res *isn't* an array, which is why you're getting the
warning that  "The argument should be an array".

So you need to find out what *is* in $res, which is why I suggested
the print_r().

Now do a var_dump($res) and see what *is* in $res. Then you'll have to
work out *why* it's not an array - and the answer to that is somewhere
in those 300 lines of code you can't post.

The few lines at the end of the loop seem to be treating $res as an
array. But as it's *not* an array, either those lines aren't being
executed or you've initialised $res to something silly beforehand,
like a string.

  -robin


Re: [PHP] usort(): The argument should be an array

2006-02-28 Thread Robin Vickery
On 28/02/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Can anyone comment and fix this error
> 
> Warning: usort(): The argument should be an array in
> /home2/wwwabcde/public_html/search/searchfuncs.php on line 300

[...]

>   usort($res, "cmp");

Put a print_r($res) above this line and see what the contents of $res
are. Whatever it is, it's not an array.  Probably because your mysql
result set is empty and you forgot to initialise $res before you
looped through it (assuming the junk above is the tail end of a loop).

  -robin


Re: [PHP] HOW update time and date-fields to mysql....

2006-02-28 Thread Robin Vickery
On 28/02/06, Gustav Wiberg <[EMAIL PROTECTED]> wrote:
> Hi there guys!
>
> I have used a date-field and a time-field in a mysql-database.
>
> How should I update these fields through php?
> This is my code now (it works fine locally with data on a win-machine, but
> not on Linux at my webhotel - Time doesn't work at all)

Doesn't work on Linux in what way?

Have you tried printing out $sql? Does it contain what you expected?

Does the mysql_query() succeed? what does mysql_error() tell you about
what went wrong?

I'd be absolutely amazed if time() really doesn't work.

I'm *guessing* that as you're running stripslashes() on these
variables, you're running your local machine with register_globals set
on, but the Linux machine has register_globals turned off.

  -robin


Re: [PHP] anyone care to explain the logic behind this output ....

2006-02-17 Thread Robin Vickery
On 17/02/06, Jochem Maas <[EMAIL PROTECTED]> wrote:
> THIS CODE
> 
>
> php -r '
> $a = array(0, 1);
> $b = array(1 => 0, 0 => 1);
> var_dump($a < $b); // true
> var_dump($a > $b); // true
> var_dump($b < $a);
> var_dump($b > $a);
> [...]
> OUTPUTS (on php5.0.4):
> 
>
> bool(true)
> bool(true)
> bool(true)
> bool(true)
> [...]
> weird? I think so - but then again I'd never test that array $a is
> greater than array $b because this is meaningless to me (in what way is $a
> greater - how is this quantified, what 'rules' determine 'greatness' in
> this context?)

The rules are simple enough, and listed in the documentation here:

http://www.php.net/manual/en/language.operators.comparison.php#AEN4390

But if you apply those comparison rules to your four expressions,
you'd expect to see

bool(true)
bool(false)
bool(true)
bool(false)

What you need to know to explain your results is that internally, PHP
doesn't do a greater-than comparison, it converts them into
less-than-or-equals by reversing the values. So your expressions
become:

$a < $b
$b <= $a
$b < $a
$a <= $b

Now if you apply the comparison rules to your arrays using those
rewritten operations, you get true every time.

Fun eh?

  -robin


Re: [PHP] Regular expression

2006-02-15 Thread Robin Vickery
On 2/14/06, Patrick <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am trying to validate a password, but havent figured out the pattern for
> it yet.
> The password must contain atleast 6 characters
> a-zA-Z0-9_
> must start with a
> a-zA-Z
> and must have atleast one of the following characters
> !#%&$£


As Curt said, it's probably better to do this programatically - if
only so you can work out what it's doing six months down the road.

However if you want to know to do it as a regexp:

start with the letters a-z.

^[a-z]

At least 5 legal characters following that  (use a lookahead assertion
to check):

(?=[!#%&$£\w]{5})

Zero or more non-punctuation characters, followed by a a punctuation
character, followed zero or more of any valid character.

\w*[!#%&$£][!#%&$£\w]*

And then anchor the end of the string with a $.

Put all that together with a bit of case insensitivity and you get.

$regexp = '/^[a-z](?=[!#%&$£\w]{5})\w*[!#%&$£][!#%&$£\w]*$/i';

$status = preg_match($regexp, $password) ? 'PASS' : 'FAIL';

  -robin


Re: [PHP] Recursive array_push?

2006-01-26 Thread Robin Vickery
On 1/26/06, Kim Christensen <[EMAIL PROTECTED]> wrote:
>
> I would really like PHP to have a function of building expressions
> with strings, and then execute them through a function - but that's
> just me it seems :-)
>

You mean like create_function() ?

  -robin


Re: [PHP] Regular Expression help

2006-01-19 Thread Robin Vickery
On 1/19/06, Chris Boget <[EMAIL PROTECTED]> wrote:
> I've been beating my head against the wall for a while trying to come up
> with the RE I need to use.  I have a camel case word - let's use
> JimJoeBobBriggs.  I need to come up with a RE that will fine all the
> upper case characters and insert an underscore prior to those characters
> with the exception of a possible first character.  So using the
> aforementioned word, the RE would change it to Jim_Joe_Bob_Briggs.
>




Re: [PHP] php .htaccess

2006-01-11 Thread Robin Vickery
On 1/11/06, enediel gonzalez <[EMAIL PROTECTED]> wrote:
> Hello
>
> I've a site with a .htaccess defined, the users have to enter the login and
> password to get in,
> Is it possible on php to ask the apache server wich user is using the
> current session?

$_SERVER['REMOTE_USER']

  -robin


Re: [PHP] select statement with variables ???

2005-12-21 Thread Robin Vickery
On 12/21/05, Anasta <[EMAIL PROTECTED]> wrote:
> Can someone tell me why this select is wrong please---ive tried everything.
> the $cat is the tablename .

You've tried *everything*  ?

Why do you think it's "wrong"? Did you get an error message of some kind?

What do you see if you echo $query? Are the values of $cat and $id
what you expected?

  -robin


Re: [PHP] Write a FIFO file

2005-12-20 Thread Robin Vickery
On 12/20/05, Ruben Rubio Rey <[EMAIL PROTECTED]> wrote:
> Robin Vickery wrote:
>
> >I bet your script will finish as soon as you read from the other end -
> >for example by doing 'cat fifo' from a shell.
> >
> Thats it.
> I would like to use fifo, but thats a problem. If there is not process
> reading, it wont work.
> Is there any way to create process?
> Something like:
> exec("echo \"My text $var\" > fifo &"); //(This idea does not work)

Named pipes are blocking - if you open one for reading and there's
nothing writing then the reading process will be blocked. And as
you've just seen, the same happens if you open one for writing and
there's nothing reading it.

You can change that behaviour by specifying the O_NONBLOCK flag when
opening the pipe - if you're opening it for writing, the attempt will
fail immediately rather than waiting for something to read.

I don't know of a way to do that through fopen(), but you can probably
manage it using dio_open() if you *really* want to.

It might be better to rethink how your processes communicate?

  -robin


Re: [PHP] Write a FIFO file

2005-12-20 Thread Robin Vickery
On 12/20/05, Ruben Rubio Rey <[EMAIL PROTECTED]> wrote:
> Ok, I tried it before, it didn't work:
>
> [...]
>
> Try to execute it and execution never ends... browser is waiting for
> ever ...
> No errors in error php error log.
>
> Any ideas?

I bet your script will finish as soon as you read from the other end -
for example by doing 'cat fifo' from a shell.

-robin


Re: [PHP] Help with the copy command...

2005-12-16 Thread Robin Vickery
On 12/15/05, Tim Meader <[EMAIL PROTECTED]> wrote:
> Okay, this seems like a ridiculously easy question which shouldn't even
> need asking, but I'm having trouble getting the builtin copy command to
> work properly. It seems to work fine as long as I feed it a full
> constant string path for each argument (ie - in the form
> "/the/path/to/the/file"). However, if I try to feed it two variables as
> the arguments, it craps out somewhere along the line. Here are the two
> different sets of calls I'm making:
>
> These two work perfectly:
>
> copy("/usr/local/apache/htdocs/ipreg2/crons/regservice_rep/snapshot.baseline",
> "/usr/local/apache/htdocs/ipreg2/crons/regservice_rep/snapshot.baseline.bak")
> ;
> copy("/usr/local/apache/htdocs/ipreg2/crons/regservice_rep/lastrun.timestamp",
> "/usr/local/apache/htdocs/ipreg2/crons/regservice_rep/lastrun.timestamp.bak");
>
> These two fail:
>
> $l_stLastRun =
> "/usr/local/apache/htdocs/ipreg2/crons/regservice_rep/lastrun.timestamp";
> $l_stSnapshotBase =
> "/usr/local/apache/htdocs/ipreg2/crons/regservice_rep/snapshot.baseline";
>
> copy($l_stSnapshotBase, $l_stSnapshotBase.".bak");
> copy($l_stLastRun, $l_stLastRun.".bak");
>
> Can anyone offer any insight on what the problem might be with this? The
> "unlink" function seems to accept the variable inputs with absolutely no
> problem, so I can't understand the discrepancy between the two.

There's no problem with variable names as parameters to copy() - you
can test that in a few seconds.

   $ touch foo
   $ php -a
   Interactive mode enabled

   

   $ ls
   foo   foo.bak

So the problem is elsewhere.

99 times in 100 you've either messed up the filenames or you've not
got appropriate file permissions to do the copy.

  -robin


Re: [PHP] 4 Digit ID with Leading Zeros

2005-12-15 Thread Robin Vickery
On 12/15/05, Rahul S. Johari <[EMAIL PROTECTED]> wrote:
> Ave,
>
> I want to assign a 4 Digit ID with leading zeros to each record added using
> a form I have created.
>
> The PHP scripts does two things:
> (a) It adds the data to a mySQL table
> (b) it generates a CSV file with the data
>
> The 4 Digit ID (beginning from 0001) will be used in two places:
> (a) It will be the ID for the record in the mySQL table, instead of the
> usual ID that we create in mySQL. It will be a Primary Key, Not Null,
> Auto_Increment
> (b) It will also be the filename for the CSV file.
>
> So basically it has to match the record adding in the mySQL table and the
> filename for the CSV.

Salve,

(a) It won't make a blind bit of difference to MySQL whether you have
leading zeros or not. It gets stored the same way.

(b) If you want to *display* the ID with 4 digits or generate a
filename in that format, use sprintf('%04d', $ID);

  -robin


Re: [PHP] Help with preg_match and windows domain logins...

2005-12-12 Thread Robin Vickery
On 12/13/05, Daevid Vincent <[EMAIL PROTECTED]> wrote:
> I'm trying to do what should be a very simple regex, but can't seem to get
> PHP to work, yet regex-coach and even an XML .XSD work fine:
>
> Valid forms of a windows logon are:
> "foo\bar"
> "\\foo\bar"
> [...]
> //preg_match('/()?.+(\\).+/', $logon, $matches);
> [...]
> Further more, WTF do I get this error:
> "Compilation failed: missing ) at offset 12" (pointing to the commented out
> preg_match.
> WTF should adding a set of parenthesis cause a compilation error?!

WTF do you need so many WTFs?

Adding a set of parenthesis isn't causing the error. Adding an
open-bracket and then an escaped close-bracket is causing your error.
The "missing ) at offset 12" is a bit of a clue there.

Backslashes are special characters to both single-quoted strings AND
regular expressions so if you use them, you're normally going to have
to escape them twice.

So if you want optional double backslashes, followed by any characters
followed by a backslash followed by any characters - which is what I'm
guessing you were aiming at, you'd start off with this:

/^(\\)?.+\.+$/

you need to escape the backslashes for the regular expression engine
so you get this:

/^()?.+\\.+$/

and you're supplying it in a single-quoted string, which also needs
the backslashes escaped, so you get this:

'/^()?.+.+$/'

by which point you should be swearing at Microsoft for choosing such a
stupid character for a login string delimiter.

Clear?

 -robin


Re: [PHP] PKCS#5 padding

2005-12-09 Thread Robin Vickery
U I made a mistake in the second test for validity in the
unpad function. It should be this:

function pkcs5_unpad ($text)
{
  $pad = ord($text{strlen($text)-1});
  if ($pad > strlen($text)) return false;
  if (strspn($text, chr($pad), strlen($text) - $pad) != $pad) return false;
  return substr($text, 0, -1 * $pad);
}

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



Re: [PHP] PKCS#5 padding

2005-12-09 Thread Robin Vickery
On 12/9/05, Binay(Local) <[EMAIL PROTECTED]> wrote:
> Hi All
>
> Has anybody got the working code to apply the PKCS#5 padding to the text for 
> encryption. Please let me know as it seems PHP inbuilt functions do not 
> support this padding at all. Been worried about from past 2 days. Help me out.

The pad function simply returns the text padded to the blocksize.

The unpad function returns the unpadded text, or false if the padding
isn't valid.

function pkcs5_pad ($text, $blocksize)
{
  $pad = $blocksize - (strlen($text) % $blocksize);
  return $text . str_repeat(chr($pad), $pad);
}

function pkcs5_unpad ($text)
{
  $pad = ord($text{strlen($text)-1});
  if ($pad > strlen($text)) return false;
  if (!strspn($text, chr($pad), strlen($text) - $pad)) return false;
  return substr($text, 0, -1 * $pad);
}

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



Re: [PHP] Is echo tag reasonably portable?

2005-11-15 Thread Robin Vickery
On 11/15/05, Greg Donald <[EMAIL PROTECTED]> wrote:
> On Tue, 15 Nov 2005, Jim Moseby wrote:
>
> >> for file in *.php; do
> >> cp $file $file.tmp
> >> sed -e "s/$file
> >> rm $file.tmp
> >> done
> >
> > I maintain: "Better to save the grief and do it right to start with, no?"
>
> Maybe at some point I too will be lucky enough to only work on code that
> I authored.
>
> for file in *.php; do
> cp $file $file.tmp
> php -r 'echo preg_replace("/<\?php=\s*/i"," ",preg_replace("/<\?(?!php)/i"," $file.tmp >$file
> rm $file.tmp
> done

I'd be inclined to do it with the tokenizer functions with something
like this (untested):

';
break;
  default:
print $t[1];
  }
}

?>

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



Re: [PHP] Is echo tag reasonably portable?

2005-11-15 Thread Robin Vickery
On 11/15/05, Greg Donald <[EMAIL PROTECTED]> wrote:
> On Tue, 15 Nov 2005, Jim Moseby wrote:
>
> >> for file in *.php; do
> >> cp $file $file.tmp
> >> sed -e "s/$file
> >> rm $file.tmp
> >> done
> >
> > I maintain: "Better to save the grief and do it right to start with, no?"
>
> Maybe at some point I too will be lucky enough to only work on code that
> I authored.
>
> for file in *.php; do
> cp $file $file.tmp
> php -r 'echo preg_replace("/<\?php=\s*/i"," ",preg_replace("/<\?(?!php)/i"," $file.tmp >$file
> rm $file.tmp
> done
>

$stmt = $mysqli->prepare("SELECT foo FROM bar WHERE bazhttp://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: Re[2]: [PHP] Is echo tag reasonably portable?

2005-11-15 Thread Robin Vickery
Hiyah Richard,

On 11/15/05, Richard Davey <[EMAIL PROTECTED]> wrote:
> Hi Robin,
>
> Tuesday, November 15, 2005, 6:18:06 PM, you wrote:
>
> > Short tags have been deprecated for years. Both the manual and the
> > php.ini file itself advise people not to use them. Personally I
> > think it's about time they were turned off by default, but that's
> > bound to annoy a lot of people who've ignored the warnings.
>
> 1) They are not deprecated.

Granted, deprecated might be putting it a little strong. They are
certainly not encouraged.

I did quote the note concerning them in its entirety. If I had simply
quoted the manual as saying "be sure not to use short tags" then I
could see your point regarding lack of context. But I didn't.

Similarly, what I quoted was the entire text of the php.ini comment.
Short of including the entire php.ini file, I don't see how much more
context I could possibly give.

> I doubt very much if they will be disabled. They are perfectly valid
> SGML processing instructions.

Firstly, I didn't actually suggest they were disabled. I suggested
that they should be off by default. If they're needed then it's simple
to turn them on, but it would discourage new developers from using a
construct which is not compatible with xml and xhtml.

Now I can't argue that it's not valid sgml as I'm not overly familiar
with the sgml standard (in fact I don't recall mentioning sgml at
all), but it's certainly not valid xml or xhtml.

A ' I agree they are a legacy of the PHP3 era, and for re-distributable
> apps you should avoid them. But that is all. Your statements are, in
> their brevity, incorrect.

I would dispute that. In fact, I just have.

  -robin

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



Re: [PHP] Is echo tag reasonably portable?

2005-11-15 Thread Robin Vickery
On 11/15/05, Greg Donald <[EMAIL PROTECTED]> wrote:
> On Tue, 15 Nov 2005, Jim Moseby wrote:
>
> > It will be when you have to sort through 1,000,000 lines of code in 400
> > files to change ' > to start with, no?
>
> for file in *.php; do
> cp $file $file.tmp
> sed -e "s/$file
> rm $file.tmp
> done

eh, what?

You only have 'http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Is echo tag reasonably portable?

2005-11-15 Thread Robin Vickery
On 11/15/05, Roman Ivanov <[EMAIL PROTECTED]> wrote:
> Robin Vickery wrote:
> > On 11/15/05, Roman Ivanov <[EMAIL PROTECTED]> wrote:
> >
> >>Can ' >
> >
> > The manual's reasonably explicit on the subject:
> >
> > "Note:  Using short tags should be avoided when developing
> > applications or libraries that are meant for redistribution, or
> > deployment on PHP servers which are not under your control, because
> > short tags may not be supported on the target server. For portable,
> > redistributable code, be sure not to use short tags."
>
> I've seen this note. But I haven't seen a single server where short tags
> were disabled.

If you've seen this note, then why did you need to ask?

It doesn't really matter whether you've seen a server where short tags
are disabled, just the possibility that they won't work means they're
not portable. Long tags always work.

Many experienced sysadmins automatically disable everything that's not
needed, and short tags definitely come under that heading.

  -robin

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



Re: [PHP] Is echo tag reasonably portable?

2005-11-15 Thread Robin Vickery
On 11/15/05, Jochem Maas <[EMAIL PROTECTED]> wrote:
>
> so how many people actually _need_ to write portable code? ok so many you
> are starting a project which will become a runaway success but until it starts
> receiving alot of attention use of short-open-tags is probably not your 
> biggest
> issue either.

I'm lazy. I prefer to do it right the first time so I don't have to go
through thousands of lines of code correcting it.

> lets assume that everyone should be writing completely portable apps, why 
> does this
> ini setting exist? what is the point of offering a setting that can be set to 
> a
> bad(tm) value by design?

Back-compatibility.

Short tags were around before the long form and millions of scripts
were already using them by the time the xml/xhtml issue became
apparent.

Security really doesn't have anything to do with this.

Short tags have been deprecated for years. Both the manual and the
php.ini file itself advise people not to use them. Personally I think
it's about time they were turned off by default, but that's bound to
annoy a lot of people who've ignored the warnings.

  -robin

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



Re: [PHP] Is echo tag reasonably portable?

2005-11-15 Thread Robin Vickery
On 11/15/05, Roman Ivanov <[EMAIL PROTECTED]> wrote:
> Can 'http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] split or explode quoted strings

2005-11-14 Thread Robin Vickery
On 11/14/05, Ördögh László <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I would like to split or explode strings in a way that
> quoted strings inside the strings should remain.
> e.g.:
>
> "first second \"third third\" fourth \"fifth fifth fifth\""
>
> after the split I need:
>
> "first"
> "second"
> "third third"
> "fourth"
> "fifth fifth fifth"

How about something like this?



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



Re: [PHP] preg for unicode strings?

2005-11-05 Thread Robin Vickery
On 11/5/05, Andy Pieters <[EMAIL PROTECTED]> wrote:
>
> I am doing some data validation and the following regexp fails
> [\W]
> When using characters like £ or €
> The script is encoded in UTF-8

Are you using the 'u' modifier to put PCRE in utf-8 mode?

preg_match( '/\W/u', $text);

  -robin


Re: [PHP] Classes and Functions and If's (Problems Again)

2005-11-03 Thread Robin Vickery
On 11/4/05, Unknown Unknown <[EMAIL PROTECTED]> wrote:
> Hi everyone, i have some code that proccesses a login form. i have an object
> $DB which works only in SOME areas, this is the code:
>
[...]
> $DB="membersp";
> $SQL="SELECT ID FROM membersonline WHERE ID='$ID' ";
> $DB->Query($SQL);
[...]
> i get an error saying:
>
> *Fatal error*: Call to a member function Query() on a non-object in *
> D:\Apache\Apache(re)\Apache2\htdocs\LoginP.php* on line *21*
> but before line 21 i use $DB and it works fine, but line 21 is a problem,
> any help appreciated

You've not indicated which is line 21, but I presume it's the bit
shortly after you assigned a string to $DB. A string is not an object,
hence the error message.

   -robin

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



Re: [PHP] Decompressing a string with zlib problems

2005-10-28 Thread Robin Vickery
On 10/28/05, Graham Anderson <[EMAIL PROTECTED]> wrote:
> I am having problems decompressing a zlib'd string located in a file.
>
> In the file headers, the compression says that it is  zlib.
> But, when I  'gzinflate' the string, I get the error: gzinflate():
> data error in  Is the below NOT a zlib or some strange variant ?
>
>  $hex="C0636D766403DE789C95533B4E [...]

Is this thread any help?

http://lists.apple.com/archives/QuickTime-java/2003/Sep/msg00038.html

Looking at your binary data in a hex editor, you've got what looks
like a cmvd header at the start.  If the next four bytes are the
length of the compressed data, then you've got probably got 990 bytes
following that that you should be decompressing.

-robin

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



Re: [PHP] regex and global vars problem

2005-10-28 Thread Robin Vickery
On 10/28/05, Tom Rogers <[EMAIL PROTECTED]> wrote:
>
> I would do it with a small class like this:
>
>  class mac{
>   var $mac='';
>   var $is_valid = false;
>   function mac($mac){
> $mac = preg_replace('/[^0-9A-F]/','',strtoupper($mac));
> if($this->is_valid = 
> preg_match('/^(\w{2})(\w{2})(\w{2})(\w{2})(\w{2})(\w{2})$/',$mac,$parts)){
>   array_shift($parts); //lose the first bit
>   $this->mac = implode(':',$parts);
> }
>   }
> }
>
> //test
> $mac_list = 
> array("00-aa-11-bb-22-cc","00:aa:11:bb:22:cc","zz:00:11:22:ff:xx","00 aa 11 
> bb 22 cc");
>
> foreach($mac_list as $mac){
>   $mactest = new mac($mac);
>   echo "In:$mac";
>   if($mactest->is_valid){
> echo " valid $mactest->mac\n";
>   }else{
> echo " NOT valid\n";
>   }
> }

$mactest  = new mac("there are a few gotchas for anyone using this");
print $mactest->is_valid ? "valid\n" : "invalid\n";

// valid

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



Re: [PHP] How to account for misspellings and alternatives in searching?

2005-10-28 Thread Robin Vickery
On 10/27/05, Chris W. Parker <[EMAIL PROTECTED]> wrote:
> Hello,
>
> On my site right now if someone searches for "511" (a misspelling of the
> manufacturer 5.11) they are not presented with the right products
> because 511 is not found anywhere in the database.
>
> I've got a few ideas on how to solve this but I want to find one that
> requires as little administrative overhead as possible.

You could use the pspell extension; add your manufacturers to your
personal word-list and use pspell_check() to check the spelling and
pspell_suggest() to suggest alternatives.

http://www.php.net/manual/en/ref.pspell.php

  -robin

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



Re: [PHP] Re: Email Validation built-in? RFC

2005-10-25 Thread Robin Vickery
On 10/25/05, Mark Charette <[EMAIL PROTECTED]> wrote:
> Ben Litton wrote:
>
> > You could certainly write an extension to do so. That's what I did
> > (mostly  I was writing one for another purpose and added a function I
> > stole from  O'Reilly.
>
> As you stated in your article, it isn't rfc822 compliant (it isn't even
> close). Richard was pretty specific in  his needs.

Just in case anyone's inspired to read through the specs; It's
RFC-2822 these days. RFC-822 is obsolete.

  -robin

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



Re: [PHP] Re: Email Validation built-in? RFC

2005-10-25 Thread Robin Vickery
On 10/24/05, Manuel Lemos <[EMAIL PROTECTED]> wrote:
> on 10/23/2005 07:21 PM Robin Vickery said the following:
> >>
> >>> ... would it not make sense for there to be a BUILT-IN PHP function of
> >>> a TRUE email syntactic validation?
> >> I don't see that being much better than passing a good regular
> >> expression to preg_match.
> >
> > 1.  Technically you can't write a regular expression that matches
> > *all* valid email addresses as part of the address specification is
> > recursive.
> >
> >  ccontent   = ctext / quoted-pair / comment
> >  comment  = "(" *([FWS] ccontent) [FWS] ")"
> >
> > Admittedly 99.99% of people don't even know you *can* comment email
> > addresses so it's not a huge problem...
>
> If I am not mistaken, PCRE supports recursive regular expressions.

I'm afraid not. You can hack recursion in Perl with the (??{ }) 
postponed expression construct. But PCRE doesn't support it.

Without recursion, the best you can do is decide on a reasonable depth
of nested comments and hardcode that.

> Anyway, the way I got the RFC that is not quite the form of an address
> but the way it may be presented in message header. Meaning, you can add
> comments in To: or other e-mail header but in reality the comments are
> not part of the address.

I'm not sure exactly what you mean here. It's true that comments don't
affect how mail gets delivered, but they're very definitely part of
the address and may well have a meaning to the recipient that you
can't predict. They could be using it for anti-spam or to disinguish
between users of a mailbox or... well, anything really.

Which is the reason that RFC-2821 recommends that they be passed to
the recipient unchanged.

> > 2. Very few people seem to be capable of recognising a *good* regular
> > expression, let alone writing one. It seems clear that validating an
> > address is a task that many people want to do, but few can do
> > properly. I'd say that's a good reason for making it a built-in
> > function.
>
> Yes. What I meant is that just copying a good enough regular expression
> would be sufficient to use it. There is no need to understand it.

I had a quick look through my email last night and found 14 different
email validation regular expressions posted to this list in the last
few months. All of them would falsely reject valid addresses even
without taking comments into account. 6 of them wouldn't even allow
"judy.o'[EMAIL PROTECTED]" and another 3 would reject mail from the
entire .museum TLD.

What that would indicate to me, is that many people can't even
recognise what a "good enough" regular expression looks like.

> What I meant is that despite I use that regular expression for many
> years without complaints, it could be improved to reject only invalid
> characters, but of course that is not what that expression does.

Possibly because those whose email addresses it rejected couldn't
contact you to complain? :-)

Actually, I have very little problem with your regexp - I'd like it to
handle domain literals, as they can be useful in communicating with
people with broken DNS. But that's about it.

  -robin

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



Re: [PHP] Function that convert national characters into ASCII

2005-10-24 Thread Robin Vickery
On 10/19/05, Wiktor <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Is there a function that will convert any european special characters
> into standard ASCII letters eg. polish "ogonki" into a,e,o or german umlauts 
> into
> ue,oe...?
>

The recode functions are probably your best bet:

   http://pl.php.net/manual/pl/ref.recode.ph

 -robin

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



Re: [PHP] Re: Email Validation built-in? RFC

2005-10-23 Thread Robin Vickery
On 10/23/05, Manuel Lemos <[EMAIL PROTECTED]> wrote:
> Hello,
>
>
> on 10/22/2005 12:58 AM Richard Lynch said the following:
> > Checking MX records is not reliable at all.
>
> I agree that it is less useful today, but it still help catches many
> domain name typos.
>
>
> > ... would it not make sense for there to be a BUILT-IN PHP function of
> > a TRUE email syntactic validation?
>
> I don't see that being much better than passing a good regular
> expression to preg_match.

1.  Technically you can't write a regular expression that matches
*all* valid email addresses as part of the address specification is
recursive.

 ccontent   = ctext / quoted-pair / comment
 comment  = "(" *([FWS] ccontent) [FWS] ")"

Admittedly 99.99% of people don't even know you *can* comment email
addresses so it's not a huge problem...

2. Very few people seem to be capable of recognising a *good* regular
expression, let alone writing one. It seems clear that validating an
address is a task that many people want to do, but few can do
properly. I'd say that's a good reason for making it a built-in
function.

>
> For many years I use this regular expression in popular email validation
> and forms generation and validation classes.
>
>
> Rather than accepting only valid characters, it rejects all invalid
> characters as specified in the RFC.
>
> ^([-!#$%&'*+./0-9=?A-Z^_`a-z{|}~])+@([-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+\\.)+[a-zA-Z]{2,6}$
>

I'm sorry, but this regular expression rejects many perfectly valid
ASCII characters. It seems to take into account only dot-atoms, not
quoted-strings. It also rejects valid addresses using domain-literals.

  -robin

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



Re: [PHP] Can't compare a decrypted variable to a string ?

2005-10-13 Thread Robin Vickery
On 10/13/05, Graham Anderson <[EMAIL PROTECTED]> wrote:

>   $realcmd =  decrypt($cmd);
[...]
>  elseif(decrypt($cmd) == $realcmd)

That's obviously going to succeed no matter what $cmd decrypts into.
It doesn't really tell you anything useful.

>   $realcmd =  decrypt($cmd); // 'makesmil'
[...]
>  if( decrypt($cmd) == 'makesmil')

If this really fails, it means that $cmd doesn't decrypt into
'makesmil'.  Are you sure that it's not been padded with spaces or
something?

 -robin

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



Re: [PHP] Trouble moving directory

2005-10-13 Thread Robin Vickery
On 10/13/05, -k. <[EMAIL PROTECTED]> wrote:
> --- Jasper Bryant-Greene <[EMAIL PROTECTED]> wrote:
> > $source_dir = escapeshellarg( '/some/dir/Dir That Won't Move/' );
>
>
> Unfortunately escapeshellarg doesn't work for all cases, it will escape the " 
> ' " in that example
> but it doesn't escape other characters such as " ) ". So...
>
> $source_dir = escapeshellarg( '/some/dir/Dir That (Won't Move)/' );
>
> ...fails as well. Any other ideas?



Or if you must use shell_exec(), use addcslashes() to escape the
annoying characters first.

 -robin

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



Re: [PHP] Testing a String for 'most' Capitalised

2005-10-10 Thread Robin Vickery
On 10/10/05, zzapper <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Image that there could be a string
>
> fred
> Fred
> FRED
>
> First of all I need to know that these are same which I can do with 
> strtolower, but how could I tell
> that 'FRED' is 'most captilised?


strlen(preg_replace('/[^[:upper:]]/', '', $b)) ? $a : $b;
}

?>

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



Re: [PHP] Array Select from database

2005-09-29 Thread Robin Vickery
On 9/28/05, Silvio Porcellana <[EMAIL PROTECTED]> wrote:
>
> In addiction, I would (SQL)escape the values joined: supposing you are
> using MySQL, I'd do:
> $values = join("', '", array_map('mysql_real_escape_string', $array));

I agree entirely; I was just trying to keep things simple for the OP.

  -robin

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



Re: [PHP] Array Select from database

2005-09-28 Thread Robin Vickery
On 9/28/05, Frank Keessen <[EMAIL PROTECTED]> wrote:
> O.K. Again;
>  I have an array with one or more values, which must be selected in the
> database
> Array ( [count] => 1 [0] => Array ( [clientaccountmanager] => Array (
> [count] => 2 [0] => 210 [1] => 149 )
>  Now i this is my select..
>  I've got the following Query="select * from client WHERE
> clientaccountmanager='$value of array1' OR '$2nd value of array 1'"
>
> How can i loop through the query with all the values out of the array as OR
> value..

Are you trying to generate the query from the array?

If so, you are better off using the SQL 'IN' construct.

SELECT * FROM client WHERE clientaccountmanager IN (value1, value2,  value3,...)

Then all you need to do is generate a comma separated list of values
from the array, which you can easily do with join().

$values = join(', ', $array);

Then insert it in your query:

$query = "SELECT * FROM client WHERE clientaccountmanager IN ($values)"

 -robin

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



Re: [PHP] Two MySQL connections in one script not working as expected

2005-09-28 Thread Robin Vickery
If you make two calls to mysql_connect with the same parameters, the
second will not make a new connection - it will return the existing
connection. The manual explains this:

http://www.php.net/mysql_connect

"If a second call is made to mysql_connect()  with the same arguments,
no new link will be established, but instead, the link identifier of
the already opened link will be returned. The new_link parameter
modifies this behavior and makes mysql_connect() always open a new
link, even if mysql_connect() was called before with the same
parameters."

  -robin

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



Re: [PHP] how can i get rid of this error ?

2005-09-27 Thread Robin Vickery
On 9/27/05, Bulent <[EMAIL PROTECTED]> wrote:
> here is the concerning line;
> about line "mysql_close($sonuc3);"
>
> @mysql_connect($server,$kullanici,$sifre) or die("sql server baglanamadi");
> @mysql_select_db($vt) or die("tabloya baglanamadi");
> $sonuc3=mysql_query($sorgu3) or die("dosya açilamadi-1");
[...]
> mysql_close($sonuc3);

$sonuc3 is a mysql result resource NOT a mysql connection. You can't close it.

If you want to close the connection that you just opened then call
mysql_close() without any parameters.

  -robin

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



Re: [PHP] how can i get rid of this error ?

2005-09-27 Thread Robin Vickery
On 9/27/05, Bulent <[EMAIL PROTECTED]> wrote:
> Hello
>
> I am a novice about that
> I use mysql4.0.24 with php4.3.10.
> When I upload  jpeg/gif  files to my webpage I get an error  as below;
> PHP Warning:  mysql_close(): supplied resource is not a valid MySQL-Link 
> resource in /var/.
> What shall I do ?

You're trying to close a mysql connection that isn't open.

You've either not opened it properly or closed it already. Without any
code it's impossible to tell.

 -robin

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



Re: [PHP] Bitwise operators

2005-09-26 Thread Robin Vickery
On 9/26/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> From php manual:
>
> $a << $b Shift leftShift the bits of $a $b steps to the left (each step
> means "multiply by two")
> $a >> $b Shift rightShift the bits of $a $b steps to the right (each step
> means "divide by two")
>
>
> So i ask what this output?
>
> $a = 4;
> $b = 3;
>
> echo  $a << $b;

32

> echo  $a >> $b;

0

So your program will output '320'.

What was the problem again?

  -robin

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



Re: [PHP] Breaking up search terms into an array intelligently

2005-09-10 Thread Robin Vickery
On 9/7/05, Paul Groves <[EMAIL PROTECTED]> wrote:
> I want to be able to break up a number of search terms typed into an input
> box into array, simple enough one would think, just use explode, e.g
> 
> 
> $array = explode(" ", $string);
> 
> 
> But what if I want to be able to cope with search terms seperated by > 1
> space (a common typing error)? This should work:
> 
> 
> function enhanced_explode($string) {
>  $array = preg_split ("/\s+/", $string);
>  return ($array);
> }
> 
> 
> But what if I want to allow "Google"-type search parameters, so that
> something like the following is split into 3 search terms?:
> firstsearchterm "second search term" thirdsearchterm
> The following code will do the trick, but is slow and doesn't allow for
> multiple spaces as the delimiter, nor the possibility of multiple delimiters
> (e.g. " ", "+", "," etc.)



Array
(
[0] => Array
(
[0] => first
[1] => -second
[2] => +third
[3] => "fourth \"fifth\""
[4] => -"sixth seventh"
[5] => eighth
)

[1] => Array
(
[0] => first
[1] => second
[2] => third
[3] => "fourth \"fifth\""
[4] => "sixth seventh"
[5] => eighth
)

)

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



Re: [PHP] SPL array filter

2005-09-09 Thread Robin Vickery
On 9/9/05, Kevin Waterson <[EMAIL PROTECTED]> wrote:
> 
> Want to filter out cats from this array using SPL FilterIterator
> $arr = array('koala', 'dingo', 'cat', 'Steve Irwin', 'fish');
> 

Why, what's wrong with cats?

 -robin

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



Re: [PHP] regular expression for integer range

2005-09-07 Thread Robin Vickery
On 9/6/05, babu <[EMAIL PROTECTED]> wrote:
> Hi all,
> 
> 
> I want to write regular expression for checking the string format entered by 
> user.
> 
> the allowed formats are
> 
> examples:
> 10
> 10,
> 10,12-10
> 12-10
> 
> that is the valid strings are:
> 1. only integer
> 2. an integer, range of integers example 3
> 
> and no other characters must be allowed.

$re = '/^(\d+)(,\d+-\d+)?$/';
preg_match($re, $value);

This only allows
 * an integer or
 * an integer followed by a comma and a range of integers

It doesn't allow anything else - even whitespace after the comma.

 -robin

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



Re: [PHP] Re: 302 Responses (Was: session cookies)

2005-09-06 Thread Robin Vickery
On 9/6/05, Chris Shiflett <[EMAIL PROTECTED]> wrote:
> Rasmus Lerdorf wrote:
> > This redirects right away for me. Try it:
> >
> > http://lerdorf.com/cs.php
> >
> > Code at: http://lerdorf.com/cs.phps
> 
> Thanks, that works. :-)
> 
> For reference, here's mine (temporary URL, of course):
> 
> http://shiflett.org/cs.php
> http://shiflett.org/cs.phps
> 
> It's the same code, but it behaves differently. I don't have time to
> compare the responses, but I will later. My first instinct is that my
> server is buffering the response, but that was the first thing I checked
> when I was testing this locally.
> 

You've got mod_gzip installed. 

If you send a GET request without  "Accept-Encoding: gzip,deflate
" then you'll get an immediate redirect from your server as well.

-robin

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



Re: [PHP] owner of files created by fopen() become wrong?

2005-09-06 Thread Robin Vickery
On 9/6/05, Wong HoWang <[EMAIL PROTECTED]> wrote:
> I have set up a VirtualHost for the domain that have problem. Since
> I am using Apache/1.3.33 , I have set the User & Group inside & outside the
>  ...   tags. As you know, the user & group
> set outside VirtualHost will be the user & group that the main server run
> with. And the one inside will be used for that domain only.

Only for CGI requests. 

If you've configured PHP as an Apache module, it should still run as
the user that you specified in the main User directive.

http://httpd.apache.org/docs/1.3/mod/core.html#user

(read the "special note")

  -robin

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



<    1   2   3   >