php-general Digest 22 Aug 2008 10:49:33 -0000 Issue 5638

2008-08-22 Thread php-general-digest-help
php-general Digest 22 Aug 2008 10:49:33 - Issue 5638 Topics (messages 278490 through 278506): Quick question regarding getcwd() and directory location. 278490 by: Ólafur Waage 278492 by: Micah Gersten 278501 by: Ashley Sheridan 278502 by: Ólafur Waage

Re: Fwd: [PHP] php not reading file properly

2008-08-22 Thread sean greenslade
So I made a cron jop to copy the log to the web folder every 5 minutes. That worked fine. It seems that php can't read the /var/log/httpd folder without root perms. On Wed, Aug 20, 2008 at 7:53 PM, Ashley Sheridan [EMAIL PROTECTED]wrote: Yeah, Apache is still running, but it is the access log

Re: Fwd: [PHP] php not reading file properly

2008-08-22 Thread Ashley Sheridan
You can change the permissions on the file, which I believe you said you did. If that didn't work, it must be because you are trying to read from the file at the very same instant that Apache is writing to it logging that you are trying to access it, if that makes sense? Ash

Re: [PHP] Quick question regarding getcwd() and directory location.

2008-08-22 Thread Ashley Sheridan
How are you browsing to it from within PHP? Depending on how you are doing it, the way to get the cwd is different Ash www.ashleysheridan.co.uk ---BeginMessage--- I'll throw out an example here. I have a directory structure of: /var/www/example/ And in that i have a file: index.php That file

Re: [PHP] Quick question regarding getcwd() and directory location.

2008-08-22 Thread Ólafur Waage
Thanks for the reply Micah but i have no interest in the URL. I am looking for the servers local path to the directory. (example: /var/www/directory/ or C:\apache\htdocs\directory\) Also the HTTP_REFERER is empty unless you are linked in from another location. And then it gives you the URL you

Re: [PHP] Licensing

2008-08-22 Thread Richard Heyes
Hi Per, License costs in EUR, CHF and DKK? Seriously, I would quote the price in one currency only, and leave it for people to convert. Yes I've quoted it in UK pounds, but since the almighty dollah is more well known, I've got an approximate conversion there too. There's one 'm' too many

Re: [PHP] Licensing

2008-08-22 Thread Carlos Medina
Richard Heyes schrieb: Hi Per, License costs in EUR, CHF and DKK? Seriously, I would quote the price in one currency only, and leave it for people to convert. Yes I've quoted it in UK pounds, but since the almighty dollah is more well known, I've got an approximate conversion there too.

Re: [PHP] Licensing

2008-08-22 Thread Richard Heyes
do not forget the OT on the Subject. That results in messages being blocked by the list server? -- Richard Heyes http://www.phpguru.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] stream_select

2008-08-22 Thread Damien Churchill
Is there a known issue with using stream_select with apache2 mod_php? I have a script (http://php.pastebin.com/m601965d) that when run with mod_php doesn't work, but when run with php-cgi from the command line works fine. Thanks in advance, Damien

[PHP] Unsubscribe issues

2008-08-22 Thread Ronald Wiplinger
The guy who wrote the guide lines for unsubscribing must be a lawyer or so. To make a page to find out where the unsubscribe link is in each kind of email type is paranoid. I mean the link is coming from the mail server, so just to say: [EMAIL PROTECTED] would be sufficient, wouldn't it? Maybe

Re: [PHP] Unsubscribe issues

2008-08-22 Thread Ashley Sheridan
I assume Ronald won't see this, but I've mentioned it before. The emails coming from the mailing list all have an unsubscribe link in the header information. Just my 2p (I'm British, we don't do cents ;) ) Ash www.ashleysheridan.co.uk ---BeginMessage--- The guy who wrote the guide lines for

Re: [PHP] Unsubscribe issues

2008-08-22 Thread Andrew Ballard
On Fri, Aug 22, 2008 at 9:10 AM, Ashley Sheridan [EMAIL PROTECTED] wrote: I assume Ronald won't see this, but I've mentioned it before. The emails coming from the mailing list all have an unsubscribe link in the header information. Just my 2p (I'm British, we don't do cents ;) ) Ash

Re: [PHP] Unsubscribe issues

2008-08-22 Thread Ashley Sheridan
That is strange. I hadn't noticed anything, so I just assumed everyone had these headers attached. Ash www.ashleysheridan.co.uk ---BeginMessage--- On Fri, Aug 22, 2008 at 9:10 AM, Ashley Sheridan [EMAIL PROTECTED] wrote: I assume Ronald won't see this, but I've mentioned it before. The emails

Re: [PHP] Unsubscribe issues

2008-08-22 Thread Ashley Sheridan
Actually, I just checked Rons message, and it does have the right headers attached. What email client are you using to view the headers? Ash www.ashleysheridan.co.uk ---BeginMessage--- On Fri, Aug 22, 2008 at 9:10 AM, Ashley Sheridan [EMAIL PROTECTED] wrote: I assume Ronald won't see this, but

Re: [PHP] Unsubscribe issues

2008-08-22 Thread Maciek Sokolewicz
Andrew Ballard wrote: On Fri, Aug 22, 2008 at 9:10 AM, Ashley Sheridan [EMAIL PROTECTED] wrote: I assume Ronald won't see this, but I've mentioned it before. The emails coming from the mailing list all have an unsubscribe link in the header information. Just my 2p (I'm British, we don't do

Re: [PHP] Unsubscribe issues

2008-08-22 Thread Andrew Ballard
On Fri, Aug 22, 2008 at 9:50 AM, Ashley Sheridan [EMAIL PROTECTED] wrote: Actually, I just checked Rons message, and it does have the right headers attached. What email client are you using to view the headers? Ash www.ashleysheridan.co.uk -- Forwarded message -- From:

Re: [PHP] Unsubscribe issues

2008-08-22 Thread Ashley Sheridan
I think people here are talking about the message footers, not the message headers, which are totally different things. I'm not sure how you'd go about viewing them on Outlook, as I use Evolution, and it has a nice convenient, View All Message Headers option. Ash www.ashleysheridan.co.uk

Re: [PHP] Unsubscribe issues

2008-08-22 Thread Andrew Ballard
On Fri, Aug 22, 2008 at 9:51 AM, Maciek Sokolewicz [EMAIL PROTECTED] wrote: Andrew Ballard wrote: On Fri, Aug 22, 2008 at 9:10 AM, Ashley Sheridan [EMAIL PROTECTED] wrote: I assume Ronald won't see this, but I've mentioned it before. The emails coming from the mailing list all have an

Re: Fwd: [PHP] php not reading file properly

2008-08-22 Thread sean greenslade
Yeah, I tried changing the perms, and that didn't work. I originally made the cron job put the temp copy in the same logs folder, but it refused to open that. I changed it to put the temp copy in the web folder, and it can read that. I think apache and/or php may have certain restrictions that

Re: [PHP] Unsubscribe issues

2008-08-22 Thread Ashley Sheridan
Hence my response of read the headers ;) Ash www.ashleysheridan.co.uk ---BeginMessage--- On Fri, Aug 22, 2008 at 9:51 AM, Maciek Sokolewicz [EMAIL PROTECTED] wrote: Andrew Ballard wrote: On Fri, Aug 22, 2008 at 9:10 AM, Ashley Sheridan [EMAIL PROTECTED] wrote: I assume Ronald won't see

Re: Fwd: [PHP] php not reading file properly

2008-08-22 Thread Ashley Sheridan
The log file was in the process of being written to as you were trying to read it. It's a bit like trying to look at a quark. By doing so, you've already affected its position. Although, unlike a quark, you can create a copy of the log file ;) Ash www.ashleysheridan.co.uk ---BeginMessage--- Yeah,

Re: [PHP] Unsubscribe issues

2008-08-22 Thread Andrew Ballard
On Fri, Aug 22, 2008 at 10:10 AM, Ashley Sheridan [EMAIL PROTECTED] wrote: Hence my response of read the headers ;) Ash www.ashleysheridan.co.uk -- Forwarded message -- From: Andrew Ballard [EMAIL PROTECTED] To: PHP General list php-general@lists.php.net Date: Fri, 22 Aug

Re: Fwd: [PHP] php not reading file properly

2008-08-22 Thread sean greenslade
Yeah, but it wouldn't read access_log.tmp, which wasn't being written to at the time of loading. I think the whole logs folder is restricted from php access. On Fri, Aug 22, 2008 at 10:13 AM, Ashley Sheridan [EMAIL PROTECTED]wrote: The log file was in the process of being written to as you

Re: Fwd: [PHP] php not reading file properly

2008-08-22 Thread Ashley Sheridan
Are you sure they are both not accessed at around about the same time? Look at the timestamps. The only analysis I've ever done with logs has been offline, so I've not run into this problem before. Ash www.ashleysheridan.co.uk ---BeginMessage--- Yeah, but it wouldn't read access_log.tmp, which

Re: Fwd: [PHP] php not reading file properly

2008-08-22 Thread Micah Gersten
What are the permssions of /var/log and /var/log/httpd? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com sean greenslade wrote: Yeah, but it wouldn't read access_log.tmp, which wasn't being written to at the time of loading. I think the whole logs folder is

Re: [PHP] Unsubscribe issues

2008-08-22 Thread Maciek Sokolewicz
Ashley Sheridan wrote: I think people here are talking about the message footers, not the message headers, which are totally different things. I'm not sure how you'd go about viewing them on Outlook, as I use Evolution, and it has a nice convenient, View All Message Headers option. Ash

[PHP] Which Exception to use ....

2008-08-22 Thread Jochem Maas
here is a list of built in Exception classes, I'd figured I'd start using them, and save on rolling my own: Exception ErrorException DOMException LogicException BadFunctionCallException BadMethodCallException DomainException InvalidArgumentException LengthException OutOfRangeException

Re: [PHP] Restore Leading Zeros in Zip Codes

2008-08-22 Thread tedd
At 8:44 PM -0600 8/21/08, Keith Spiller wrote: Hi, RE: Restore Leading Zeros in Zip Codes Does anyone happen to have a script that will restore the leading zeros in a mixed data set of 5 digit zip codes and 10 digit zip+4 codes? Any suggestions? Thanks, Keith Keith: Why take them out

Re: [PHP] Quick question regarding getcwd() and directory location.

2008-08-22 Thread Micah Gersten
You might want to try a Redirect Rule or rewrite which would tell you the HTTP PATH. AFAIK, there is no way to know which directory they tried to access unless you write your own index.php and store it in a session variable. Thank you, Micah Gersten onShore Networks Internal Developer

Re: [PHP] RE: Sale 79% OFF !!!

2008-08-22 Thread tedd
At 2:26 PM +0100 8/21/08, Ashley Sheridan wrote: I don't understand how people can fall for this kind of thing, all those Nigerian scams and the like. For every person that falls for it, a million more emails get sent, making everyone elses lives hell :( Ash www.ashleysheridan.co.uk I

Re: [PHP] Unsubscribe issues

2008-08-22 Thread tedd
At 4:28 PM +0200 8/22/08, Maciek Sokolewicz wrote: Ashley Sheridan wrote: I think people here are talking about the message footers, not the message headers, which are totally different things. I'm not sure how you'd go about viewing them on Outlook, as I use Evolution, and it has a nice

Re: [PHP] Which Exception to use ....

2008-08-22 Thread Pavel
//sorry for my english Firstly, this list of exception show only registered in system exceptions, which (excluding one-two) are exceptions of some php mobules:mysqli,sqllite and so on... I use only Exception class and my extends on it (so and exceptions from your list are extends...). --

[PHP] Simple tiny php template

2008-08-22 Thread OOzy Pal
Hello Can any one direct to very very tiny simple php template code. I want to use it for 5-6 pages website. Thank you -- OOzy Ubuntu-Hard

Re: [PHP] Restore Leading Zeros in Zip Codes

2008-08-22 Thread Afan Pasalic
tedd wrote: At 8:44 PM -0600 8/21/08, Keith Spiller wrote: Hi, RE: Restore Leading Zeros in Zip Codes Does anyone happen to have a script that will restore the leading zeros in a mixed data set of 5 digit zip codes and 10 digit zip+4 codes? Any suggestions? Thanks, Keith Keith:

Re: [PHP] Simple tiny php template

2008-08-22 Thread Stut
define('TPL_DIR', dirname(__FILE__).'/tpl/'); function TPL($__filename, $__data = array(), $__return = false) { $__retval = ''; $__tplfilename = TPL_DIR.$__filename; if (file_exists($__tplfilename)) { if ($__return) ob_start();

Re: [PHP] Restore Leading Zeros in Zip Codes

2008-08-22 Thread Dan Joseph
On Fri, Aug 22, 2008 at 12:28 PM, Afan Pasalic [EMAIL PROTECTED] wrote: tedd wrote: At 8:44 PM -0600 8/21/08, Keith Spiller wrote: Hi, RE: Restore Leading Zeros in Zip Codes Does anyone happen to have a script that will restore the leading zeros in a mixed data set of 5 digit zip

Re: [PHP] Which Exception to use ....

2008-08-22 Thread Jochem Maas
Pavel schreef: //sorry for my english Firstly, this list of exception show only registered in system exceptions, yes I know, I wrote exactly that in the first line of my post. which (excluding one-two) are exceptions of some php mobules:mysqli,sqllite and so on... it's 5 actually, I

Re: [PHP] Restore Leading Zeros in Zip Codes

2008-08-22 Thread Andrew Ballard
On Fri, Aug 22, 2008 at 12:28 PM, Afan Pasalic [EMAIL PROTECTED] wrote: tedd wrote: At 8:44 PM -0600 8/21/08, Keith Spiller wrote: Hi, RE: Restore Leading Zeros in Zip Codes Does anyone happen to have a script that will restore the leading zeros in a mixed data set of 5 digit zip

Re: [PHP] Which Exception to use ....

2008-08-22 Thread Andrew Ballard
On Fri, Aug 22, 2008 at 12:35 PM, Jochem Maas [EMAIL PROTECTED] wrote: Pavel schreef: //sorry for my english Firstly, this list of exception show only registered in system exceptions, yes I know, I wrote exactly that in the first line of my post. which (excluding one-two) are exceptions

Re: Fwd: [PHP] php not reading file properly

2008-08-22 Thread sean greenslade
The cron job only runs every 5 minutes, so not likely On Fri, Aug 22, 2008 at 10:22 AM, Ashley Sheridan [EMAIL PROTECTED]wrote: Are you sure they are both not accessed at around about the same time? Look at the timestamps. The only analysis I've ever done with logs has been offline, so I've

Re: Fwd: [PHP] php not reading file properly

2008-08-22 Thread sean greenslade
Hey! That worked! Turns out, the folder needs exec perms to read the files. Thanks! On Fri, Aug 22, 2008 at 10:28 AM, Micah Gersten [EMAIL PROTECTED] wrote: What are the permssions of /var/log and /var/log/httpd? Thank you, Micah Gersten onShore Networks Internal Developer

[PHP] Sorting Arrays

2008-08-22 Thread Tom Shaw
I'm having a problem sorting my array and wondered if anybody had experience sorting arrays by their values. What I need to do is resort the array below where the most expensive product shipping price starts at position zero no matter how big the array is. array(2) { [0] = array(48) {

Re: [PHP] Sorting Arrays

2008-08-22 Thread Micah Gersten
I believe you'll need a custom sorting function for this. http://us.php.net/usort Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Tom Shaw wrote: I'm having a problem sorting my array and wondered if anybody had experience sorting arrays by their values.

Re: [PHP] Simple tiny php template

2008-08-22 Thread Jochem Maas
Stut schreef: define('TPL_DIR', dirname(__FILE__).'/tpl/'); function TPL($__filename, $__data = array(), $__return = false) { $__retval = ''; $__tplfilename = TPL_DIR.$__filename; if (file_exists($__tplfilename)) { if ($__return) ob_start(); extract($__data);

Re: [PHP] Developing a game using Ming

2008-08-22 Thread Jochem Maas
Yasir Malik schreef: If you're trying to be cheap and/or Open Sourcy about it, have a look at OpenLazlo. It's an XML/JS framework, all open source, that compiles to SWF and plays in a normal Flash 9 browser plugin. I've only recently started looking into it, but it looks impressive. And

Re: [PHP] RE: Sale 79% OFF !!!

2008-08-22 Thread Ashley Sheridan
Sorry, but I can't understand why anyone would suddenly give me money out of the blue, especially money to the tune of many thousands of pounds, and by that reckoning, I fail to see however legitimate it might look, how anyone could be duped... Ash www.ashleysheridan.co.uk ---BeginMessage--- At

Re: [PHP] Sorting Arrays

2008-08-22 Thread Ashley Sheridan
Yeah, a bubble sorting algorithm should fix it, as it essentially only a very simple sort required. Ash www.ashleysheridan.co.uk ---BeginMessage--- I believe you'll need a custom sorting function for this. http://us.php.net/usort Thank you, Micah Gersten onShore Networks Internal Developer

Re: [PHP] Sorting Arrays

2008-08-22 Thread Robert Cummings
On Fri, 2008-08-22 at 21:04 +0100, Ashley Sheridan wrote: Yeah, a bubble sorting algorithm should fix it, as it essentially only a very simple sort required. Why use bubble sort when you can use usort() function with an arbitrary handler? Cheers, Rob. Ash www.ashleysheridan.co.uk email

Re: [PHP] Simple tiny php template

2008-08-22 Thread Stut
On 22 Aug 2008, at 20:48, Jochem Maas wrote: Stut schreef: define('TPL_DIR', dirname(__FILE__).'/tpl/'); function TPL($__filename, $__data = array(), $__return = false) { $__retval = ''; $__tplfilename = TPL_DIR.$__filename; if (file_exists($__tplfilename)) { if ($__return)

Re: [PHP] Sorting Arrays

2008-08-22 Thread Micah Gersten
Robert Cummings wrote: On Fri, 2008-08-22 at 21:04 +0100, Ashley Sheridan wrote: Yeah, a bubble sorting algorithm should fix it, as it essentially only a very simple sort required. Why use bubble sort when you can use usort() function with an arbitrary handler? Cheers, Rob.

Re: [PHP] Restore Leading Zeros in Zip Codes

2008-08-22 Thread tedd
At 12:35 PM -0400 8/22/08, Dan Joseph wrote: tedd wrote: Why take them out in the first place? Keep the zip code as a string. After all, not all countries use just numbers. From a recent experience, you should all listen to Tedd's advice. I inhereited an application when I came to work

[PHP] Re: Which Exception to use ....

2008-08-22 Thread Al
Jochem Maas wrote: here is a list of built in Exception classes, I'd figured I'd start using them, and save on rolling my own: Exception ErrorException DOMException LogicException BadFunctionCallException BadMethodCallException DomainException InvalidArgumentException LengthException

Re: [PHP] RE: Sale 79% OFF !!!

2008-08-22 Thread tedd
At 9:02 PM +0100 8/22/08, Ashley Sheridan wrote: Sorry, but I can't understand why anyone would suddenly give me money out of the blue, especially money to the tune of many thousands of pounds, and by that reckoning, I fail to see however legitimate it might look, how anyone could be duped...

Re: [PHP] Quick question regarding getcwd() and directory location.

2008-08-22 Thread Ólafur Waage
That is the brick wall i faced. There is no way to know where exactly you are (via DirectoryIndex) locally on the machine. Thanks though. 2008/8/22 Micah Gersten [EMAIL PROTECTED]: You might want to try a Redirect Rule or rewrite which would tell you the HTTP PATH. AFAIK, there is no way to

Re: [PHP] Restore Leading Zeros in Zip Codes

2008-08-22 Thread Ashley Sheridan
On Fri, 2008-08-22 at 17:16 -0400, tedd wrote: At 12:35 PM -0400 8/22/08, Dan Joseph wrote: tedd wrote: Why take them out in the first place? Keep the zip code as a string. After all, not all countries use just numbers. From a recent experience, you should all listen to

Re: [PHP] Quick question regarding getcwd() and directory location.

2008-08-22 Thread Ashley Sheridan
On Fri, 2008-08-22 at 21:56 +, Ólafur Waage wrote: That is the brick wall i faced. There is no way to know where exactly you are (via DirectoryIndex) locally on the machine. Thanks though. 2008/8/22 Micah Gersten [EMAIL PROTECTED]: You might want to try a Redirect Rule or rewrite

Re: [PHP] Quick question regarding getcwd() and directory location.

2008-08-22 Thread Ólafur Waage
I am within a certain directory of the server via the browser. Example: http://www.example.com/foo/bar would be /var/www/example.com/foo/bar And Apache's DirectoryIndex feature is opening a index.php file that is located at /var/www/example.com/test/index.php And from that file i need to

Re: [PHP] Quick question regarding getcwd() and directory location.

2008-08-22 Thread Eric Butera
On Thu, Aug 21, 2008 at 8:50 PM, Ólafur Waage [EMAIL PROTECTED] wrote: I'll throw out an example here. I have a directory structure of: /var/www/example/ And in that i have a file: index.php That file echo's getcwd() and returns: /var/www/example/ Now i tell Apache or Lighty that if a

Re: [PHP] Quick question regarding getcwd() and directory location.

2008-08-22 Thread Robert Cummings
On Fri, 2008-08-22 at 22:13 -0400, Eric Butera wrote: On Thu, Aug 21, 2008 at 8:50 PM, Ólafur Waage [EMAIL PROTECTED] wrote: I'll throw out an example here. I have a directory structure of: /var/www/example/ And in that i have a file: index.php That file echo's getcwd() and returns:

Re: [PHP] Sorting Arrays

2008-08-22 Thread Jim Lucas
Tom Shaw wrote: I'm having a problem sorting my array and wondered if anybody had experience sorting arrays by their values. What I need to do is resort the array below where the most expensive product shipping price starts at position zero no matter how big the array is. array(2) {