php-general Digest 3 Oct 2007 01:36:30 -0000 Issue 5051

2007-10-02 Thread php-general-digest-help
php-general Digest 3 Oct 2007 01:36:30 - Issue 5051 Topics (messages 262637 through 262662): Re: strpos error (I'm missing something obvious) 262637 by: Jay Blanchard 262639 by: Al 262643 by: Andrew Ballard 262644 by: Kevin Murphy 262645 by: Al

[PHP] Re: languages and PHP

2007-10-02 Thread Colin Guthrie
tedd wrote: Isn't UTF-8 the big fish here? Sure there' UTF-16 and larger, but everything else is a subset of UTF-8, is it not? So, what's the problem if you get a character defined by ISO -- it's still within the UTF-8 super-group, right? Individual characters are sometimes OK, but it's

Re: [PHP] Re: languages and PHP

2007-10-02 Thread Per Jessen
Colin Guthrie wrote: UTF-8 works by using special bits at the MSB end of the byte to say, I can't represent this character in one byte, I need to use 2 bytes (or 3 bytes) (and maybe also 4? can't remember of the top of my head). Yep, a UTF8 character is 1 to 4 bytes. /Per Jessen, Zürich

Re: [PHP] an apology

2007-10-02 Thread Daniel Brown
On 10/1/07, Robert Cummings [EMAIL PROTECTED] wrote: Most of us have pretty thick skin around here. Yeah, especially Rob. Wait skin or skull? Ah, well ;-P -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a

RE: [PHP] strpos error (I'm missing something obvious)

2007-10-02 Thread Jay Blanchard
[snip] !== FALSE is not good either, it is not a valid test strpos returns the numeric position of the first occurrence of needle in the haystack string. Except when needle doesn't occur in string, in which case If needle is not found, strpos() will return boolean FALSE.

Re: [PHP] an apology

2007-10-02 Thread Robert Cummings
On Tue, 2007-10-02 at 09:34 -0400, Daniel Brown wrote: On 10/1/07, Robert Cummings [EMAIL PROTECTED] wrote: Most of us have pretty thick skin around here. Yeah, especially Rob. Wait skin or skull? Ah, well ;-P Duh... wha?! You make funny? Cheers, Rob. --

[PHP] Re: strpos error (I'm missing something obvious)

2007-10-02 Thread Al
Frankly, I use preg_match() for this type of thing. It's simpler and foolproof. The difference in speed is negligible. ?php // The i after the pattern delimiter '%' indicates a case-insensitive search if (preg_match(%$site%i, $referer)) { echo $referer; } else { echo A match was not

[PHP] Question about ereg_replace and urlencode...

2007-10-02 Thread Venkatesh M. S.
Hello! i am trying to make links clickable on a page. I would like to urlencode the URL so that it is well passed to a redirect.php file, which would do somethings and then also do a meta http refresh I am trying to use a function like the following, but it doesn't work. I would like to apply

Re: [PHP] Question about ereg_replace and urlencode...

2007-10-02 Thread Stut
Venkatesh M. S. wrote: Hello! i am trying to make links clickable on a page. I would like to urlencode the URL so that it is well passed to a redirect.php file, which would do somethings and then also do a meta http refresh I am trying to use a function like the following, but it doesn't work.

Re: [PHP] Question about ereg_replace and urlencode...

2007-10-02 Thread Venkatesh M. S.
Many thanks Stut The problem is that the rest of the $str is actually a big post from a blog, which will have many other text and info apart from the URL, and i don't want to urlencode everything in there! Venky On 02/10/2007, Stut [EMAIL PROTECTED] wrote: Venkatesh M. S. wrote: Hello! i

Re: [PHP] Re: strpos error (I'm missing something obvious)

2007-10-02 Thread Andrew Ballard
I'd suggest the following *slight* enhancement to make sure that the HTTP_REFERER actually *begins* with the site name, not simply contains it. // prevents visits from pages like http://badsite.com/form.htm?http://www.wnc.edu if (strpos($referer, $site) === 0) { echo 'yes'; } (or, if you

Re: [PHP] Re: strpos error (I'm missing something obvious)

2007-10-02 Thread Kevin Murphy
Thanks for the info. I've modified the script to reflect that. I actually ended up reversing it, and so I used !== 0 which should work just the same. All this is a minor portion of a much larger security scheme for an intranet site (which is protected by an LDAP server), where I am just

Re: [PHP] Re: strpos error (I'm missing something obvious)

2007-10-02 Thread Al
I didn't mean that the function was foolproof, only the match function itself. However, your suggestion to add the line start is simple and effective. Andrew Ballard wrote: I'd suggest the following *slight* enhancement to make sure that the HTTP_REFERER actually *begins* with the site name,

Re: [PHP] Re: strpos error (I'm missing something obvious)

2007-10-02 Thread Andrew Ballard
On 10/2/07, Al [EMAIL PROTECTED] wrote: I didn't mean that the function was foolproof, only the match function itself. Understood. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] The Context of 0

2007-10-02 Thread Jay Blanchard
[small rant] This morning's thread on strpos() brings up an interesting point, zero has a context. In certain cases 0 is the equivalent of FALSE and in other cases a 0 is just a 0. In the context of strpos() 0 indicates that the needle is in the first position of the haystack. If the needle is

[PHP] Good Regex for general text search

2007-10-02 Thread Amos Vryhof
I'm writing a few very simple search scripts. One searches in a few columns of a CSV file, while another just searches through a collection of file names. Currently, I just have it stripping illegal characters from the needle and haystack then doing a substring search if

[PHP] Custom pipe script failure code

2007-10-02 Thread Alan Fullmer
Hello, I have a quick question regarding the pipe function in Postfix and the use of PHP as a mail sorter/parser. I've looked around and see many people have used PHP as a quick and dirty solution for putting mail data into a database. I am taking all incoming mail, parsing out headers

Re: [PHP] The Context of 0

2007-10-02 Thread Robert Cummings
On Tue, 2007-10-02 at 12:14 -0500, Jay Blanchard wrote: [small rant] This morning's thread on strpos() brings up an interesting point, zero has a context. In certain cases 0 is the equivalent of FALSE and in other cases a 0 is just a 0. In the context of strpos() 0 indicates that the needle

Re: [PHP] The Context of 0

2007-10-02 Thread Carlton Whitehead
This should be a lesson about how important it is to keep in mind the *type* of data when writing comparisons, even in a dynamic/weakly-typed language like PHP. For example, consider this test case: ?php if (0 == false) { echo 'PHP thinks the integer 0 is equal to boolean false, even though

[PHP] nusoap service + php5 soap client problems

2007-10-02 Thread blackwater dev
Hello, I have this nusoap service: $server= new soap_server(); $server-register('authenticate_user', array(), array()); // Initialize WSDL support $server-configureWSDL('authenticate', 'urn:authenticate'); // Register the method to expose $server-register('authenticate_user',

[PHP] Re: languages and PHP

2007-10-02 Thread tedd
At 11:09 AM +0100 10/2/07, Colin Guthrie wrote: tedd wrote: Isn't UTF-8 the big fish here? Sure there' UTF-16 and larger, but everything else is a subset of UTF-8, is it not? So, what's the problem if you get a character defined by ISO -- it's still within the UTF-8 super-group, right?

Re: [PHP] nusoap service + php5 soap client problems

2007-10-02 Thread Nathan Nobbe
this doesnt look like a wsdl file to me http://mysite.com/authenticate.php?wsdl -nathan On 10/2/07, blackwater dev [EMAIL PROTECTED] wrote: Hello, I have this nusoap service: $server= new soap_server(); $server-register('authenticate_user', array(), array()); // Initialize WSDL support

Re: [PHP] nusoap service + php5 soap client problems

2007-10-02 Thread blackwater dev
Yeah, because that was just changed so I could post it here: Here is the actual wsdl: definitions targetNamespace=urn:authenticate − types − xsd:schema targetNamespace=urn:authenticate xsd:import namespace=http://schemas.xmlsoap.org/soap/encoding// xsd:import

[PHP] How can i only fetch a (rss/atom) feed when it's changed?

2007-10-02 Thread Mark
Hey, I'm currently fetching feeds about every hour (automatically in php) but sometimes there are no new updates in a feed for 2 hours. so no i wonder if it's possible to check the feed somehow to see if it changed since i last fetched it and if it's the case than download it like it should.. if

Re: [PHP] How can i only fetch a (rss/atom) feed when it's changed?

2007-10-02 Thread mike
On 10/2/07, Mark [EMAIL PROTECTED] wrote: I'm currently fetching feeds about every hour (automatically in php) but sometimes there are no new updates in a feed for 2 hours. so no i wonder if it's possible to check the feed somehow to see if it changed since i last fetched it and if it's the

[PHP] fopen function and charset

2007-10-02 Thread Mauricio Muriel
Hi. I want to know, what charset is applied to every file when is created with the fopen function and how can I to manage the charset when I use the fopen function? For example: If i want to create an ISO-8859-2 file, how can I to force, the fopen function to create it? Regards -- Mauricio

RE: [PHP] fopen function and charset

2007-10-02 Thread Jay Blanchard
[snip] I want to know, what charset is applied to every file when is created with the fopen function and how can I to manage the charset when I use the fopen function? For example: If i want to create an ISO-8859-2 file, how can I to force, the fopen function to create it? [/snip] This may start

[PHP] Re: Beginner Tutorials for using CLASSES in PHP4

2007-10-02 Thread Tony Marston
There's a small sample application that demonstrates how to use classes with PHP 4 at http://www.tonymarston.net/php-mysql/sample-application.html It also has a bigger framework at http://www.radicore.org/ -- Tony Marston http://www.tonymarston.net http://www.radicore.org Jeff Cohan [EMAIL

Re: [PHP] Beginner Tutorials for using CLASSES in PHP4

2007-10-02 Thread Tony Marston
Nathan Nobbe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] although some people believe differently than i; i would argue trying to learn how to design w/ the classes that php4 provides is a waste of time. I disagree. PHP 4 gives you access to classes, encapsulation, inheriance

Re: [PHP] Good Regex for general text search

2007-10-02 Thread Chris
Amos Vryhof wrote: I'm writing a few very simple search scripts. One searches in a few columns of a CSV file, while another just searches through a collection of file names. Currently, I just have it stripping illegal characters from the needle and haystack then doing a substring search

Re: [PHP] Good Regex for general text search

2007-10-02 Thread Amos Vryhof
Ok, My example was pretty bad. I was just looking for an easier/more optimal way to look for something along the lines of word1*word2*word3*word4 rather than word1 word2 word3 word4 as it currently does. Actually, I think I have an idea for a way to do what I want without a regular

Re: [PHP] Good Regex for general text search

2007-10-02 Thread Chris
Amos Vryhof wrote: Ok, My example was pretty bad. I was just looking for an easier/more optimal way to look for something along the lines of word1*word2*word3*word4 rather than word1 word2 word3 word4 as it currently does. Actually, I think I have an idea for a way to do what I want without a

Re: [PHP] Custom pipe script failure code

2007-10-02 Thread Chris
So is there a way to exit(); with some sort of code to put that message back into the queue? I have read that I need to exit(75); but that does not work. If anyone could help, that would be more than fantastic. That's exactly what you need. What doesn't work exactly? $ php -a Interactive

[PHP] Optimized PHP

2007-10-02 Thread ashish.sharma
Hello All, I am working on PHP from quite some time. I am pretty much comfortable in writing PHP code but I always want that I should write good, quality code. For this I always look for the best practices which other developers uses and implement and I am writing this for the same reason as I

Re: [PHP] Optimized PHP

2007-10-02 Thread Larry Garfield
First rule: Premature optimization is the root of all evil. Don't try to squeeze every millisecond out of your code unless it really needs it. That said, the conventional place to stick user account data is in the database. The exact schema will vary, but you will want some sort of unique