php-general Digest 1 Feb 2006 06:38:39 -0000 Issue 3938

2006-01-31 Thread php-general-digest-help

php-general Digest 1 Feb 2006 06:38:39 - Issue 3938

Topics (messages 229571 through 229604):

Re: strange behaviour with strtotime()
229571 by: Ford, Mike

Re: html forms and php
229572 by: Ford, Mike

Re: form variables issue
229573 by: Weber Sites LTD
229574 by: Richard Correia
229599 by: Richard Lynch

Re: Problems with realpath()
229575 by: Richard Correia

Re: image uploads
229576 by: Weber Sites LTD
229581 by: Richard Lynch
229588 by: tedd
229589 by: Weber Sites LTD
229592 by: Richard Lynch

SQL in XML [was PHP and DBase...]
229577 by: David BERCOT
229578 by: Miles Thompson
229579 by: David BERCOT
229580 by: Daevid Vincent
229595 by: Richard Lynch
229596 by: Richard Lynch

Re: Question about C++ like macros on PHP
229582 by: Richard Lynch
229583 by: Richard Lynch

CR \ LFs being represented as ascii characters in output of mail()
229584 by: Murray . PlanetThoughtful
229585 by: James Benson
229602 by: Chris Shiflett

Re: Embed XHTML code using PHP's XSLT processor
229586 by: Björn Bartels

session loss
229587 by: Dave Goodchild
229590 by: Richard Correia
229591 by: Ray Hauge

Re: Problems with GZIPped content in some cases?!?
229593 by: Richard Lynch

Re: PHP and DBase...
229594 by: Richard Lynch

Re: Clean data / text for XML
229597 by: Richard Lynch

Re: Class constructor
229598 by: Richard Lynch

Re: PHP session_id()
229600 by: Richard Lynch

Re: PHP5 Build - test.php not working
229601 by: Richard Lynch

Running snippets from within PHP
229603 by: Eli

Re: HTML Question?
229604 by: William Stokes

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
php-general@lists.php.net


--
---BeginMessage---
On 31 January 2006 15:41, Barry wrote:

 Ford, Mike wrote:
  Yes, but 1 apple is 1 apple is 1 apple.
  
  1 month can be 28 days, or 31 days, or anything in between.
 2 months can be anything from 59 to 62 days.
  
  A month is an imprecise measure, and adding them together
 will get you an even more imprecise result.
  
  Deal with it -- that's just the way it is.
  
  Cheers!
 
 And now you tell me how the strtotime function tells what to use
 either 28 days or 31 days or 4 3/87 days.

It's very simple.  It uses the same day-of-the-month you start from: 1st gets 
you the 1st; 15th gets you the 15th; 31st gets you 31st or equivalent).  Put 
another way, +1 month adds as many days as there are days in the starting 
month; +2 months adds as many days as there are in the starting month and the 
one after (starting in Jan: 31+28 = 59 -- but starting in, say, Jul: 31+31 = 
62); and so on.

Most of the time this gives you exactly what you want -- it's only when you ask 
starting from the 29th, 30th or 31st of a month, and the destination month is 
shorter, that it causes any kind of problem.  Since this is a very small, 
well-defined range of dates, it's fairly simple to deal with it -- once you 
know you need to!!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm
---End Message---
---BeginMessage---
On 31 January 2006 16:08, Philippe Reynolds wrote:

 I added the square brakets to the name...now when I select
 all the options
 on the list I can read all values individually.
 
 Here is problem...my javascripts have stopped working, I
 can't move options
 from one list to the next.  Here is the javascript I use
 currently...I would like help in modifing it so that it may work
 while using the 
 brakets on the
 name of the select:

Use the Javascript identity of x.y with x[y], thusly:

input type=button name=SelectAll value= All style=width:
 100px; onClick=MoveAll(fleetForm.trucklist,
 fleetForm.reportinglist)br

   onclick=MoveAll(fleetForm['trucklist[]'], fleetForm['reportinglist[]'])

No need to mess about with the complications of DOM and getElementById -- it's 
much more backward compatible for older browsers, as well, since that identity 
has existed since day one of JavaScript.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,

Re: [PHP] Passing Credentials

2006-01-31 Thread Barry

David Tulloh wrote:

You want to use sessions, they allow you to store information such as
login details between requests.

Have a look at a simple tutorial, like this Zend one.
http://www.zend.com/php/beginners/php101-10.php


News1 wrote:


Rory,

Thanks for the feedback -- I will try to be clearer.

Yes, I want to login into a web page and from there get to another webpage.

The webcams are on my network.  I can access them directly; however, I would
like to create a page where several are visible at once.  So, I would like
to be able to log into a master page, if you will, and from there be able
to access multiple webcam web pages from this master page.  Right now I
can do it, but I have to authenticate for each webcam I access.  Since I am
using authentication to access the master page, I would like to skip this
step for the webcams and be able to access them directly and automatically
pass the username/password credentials.

Thanks again!  I hope this is clearer.



So every webcam page has its own authentication?

Probably you should use fopen or fsockopen then.

http://de.php.net/fopen
http://de.php.net/fsockopen
http://de.php.net/fputs
http://de.php.net/fgets

Probably somone can tell how to access HTTP auth sites with php?

GET /pathto/webcam HTTP 1.0
Authantication: Basic
and then?
Password: ?? or what ^^

HTH and thanks if others can post the last info on how to auth via php.

I also like to know that lol ^^

Greets
Barry

--
Smileys rule (cX.x)C --o(^_^o)

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



Re: [PHP] Other than default grey button

2006-01-31 Thread Jochem Maas

Lists wrote:


On Jan 30, 2006, at 9:25 AM, Jochem Maas wrote:


in future remember that it pays to give the people on the/a list all
of the context you mention above - it shows people you are trying,  
have searched
for information and that your question is relevant as far as you  have 
been able to

determine - all those things make your question more 'respectable'
and thereby more likely to recieve a decent answer.



had you responded to him off-list all along, it would have spared  
everyone the continuation of this thread.


yes but your a 'philosopher' - so I don't give a monkey's about what you think.
free hint: stop reading when it no longer interests you.





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



Re: [PHP] PHP session_id()

2006-01-31 Thread Jochem Maas

Jacques wrote:

Hi all

Is it possible that the PHP engine can generate duplicate session id's for 
one application? Can one assume that the session id generated and saved in a 
database will always be unique (never to be repeated)?


there is no garantee stated anywhere that I have read but the following
ini settings might help you to achieve a level of assurance thats acceptable:

session.entropy_file
session.entropy_length

(Available since PHP 5.0.0.):

session.hash_function
session.hash_bits_per_character

http://php.net/manual/en/ref.session.php



Regards

Jacques 



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



[PHP] Problems with realpath()

2006-01-31 Thread Ron King

Hi,

My hosting isp just upgraded from 4.3.1 to 4.4.1, and some of the 
tools I use (from InterAKT) no longer work.


After doing quite a bit of research, I've seen a few bugs regarding 
realpath(), but none related to 4.4.1.


When I try the following:

?php
   echo phpversion() . \n;
   echo dirname(__FILE__) . \n;
   echo realpath(__FILE__);
?

With version 4.4.0, I get the following answer:

4.4.0
/web
/web/realpath.php

But on version 4.4.1 I get a fatal error:

4.4.1
/data/...  -- different server, therefore different path, of course
Fatal error: Call to undefined function: realpath() in /data/...).

I'm too much of a newbie to know what to do on my own. Is this 
something my ISP has turned off?


Thanks for any help,

-- Ron

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



[PHP] form variables issue

2006-01-31 Thread All U Want

Hi folks,

I'm sure it is a very simple question for you but I'm getting almost  
crazy.


I've got a simple form with several form objects, one of them is a  
text field. After submitting the form if one of the form objects  
hasn't been modified I will show the same form but keeping the data  
previously introduced. My problem is the text field, I can't show any  
special characters again, even if there was any space only the first  
word is shown, etc.


I've been playing with different function like urldecode, urlencode,  
stripslashes, htmlspecialchars, etc. but couldn't show the same text.


Do  you know how I can fix this?


Thanks a lot,
David.

Note that magic_quotes_gpc is enabled.

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



[PHP] strange behaviour with strtotime()

2006-01-31 Thread James Benson

Im encountering some very weird behaviour when using the following:-


echo date(M, strtotime(next month));


outputs: Mar



while


echo date(r,time());

outputs: Tue, 31 Jan 2006 11:21:47 +



anyone know why?




-

Master CIW Designer  http://www.ciwcertified.com
Zend Certified Engineer  http://www.zend.com


http://www.jamesbenson.co.uk

-

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



[PHP] Re: form variables issue

2006-01-31 Thread Barry

All U Want wrote:

Hi folks,

I'm sure it is a very simple question for you but I'm getting almost  
crazy.


I've got a simple form with several form objects, one of them is a  text 
field. After submitting the form if one of the form objects  hasn't been 
modified I will show the same form but keeping the data  previously 
introduced. My problem is the text field, I can't show any  special 
characters again, even if there was any space only the first  word is 
shown, etc.


I've been playing with different function like urldecode, urlencode,  
stripslashes, htmlspecialchars, etc. but couldn't show the same text.


Do  you know how I can fix this?


Thanks a lot,
David.

Note that magic_quotes_gpc is enabled.

 source?

--
Smileys rule (cX.x)C --o(^_^o)

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



[PHP] Re: Problems with realpath()

2006-01-31 Thread Barry

Ron King wrote:

Hi,

My hosting isp just upgraded from 4.3.1 to 4.4.1, and some of the tools 
I use (from InterAKT) no longer work.


After doing quite a bit of research, I've seen a few bugs regarding 
realpath(), but none related to 4.4.1.


When I try the following:

?php
   echo phpversion() . \n;
   echo dirname(__FILE__) . \n;
   echo realpath(__FILE__);
?

With version 4.4.0, I get the following answer:

4.4.0
/web
/web/realpath.php

But on version 4.4.1 I get a fatal error:

4.4.1
/data/...  -- different server, therefore different path, of course
Fatal error: Call to undefined function: realpath() in /data/...).

I'm too much of a newbie to know what to do on my own. Is this something 
my ISP has turned off?


Thanks for any help,

-- Ron


He told you that the function doesn't exist. looks like it has either 
been turned off, or it's not implemented in your php version running on 
your server.


--
Smileys rule (cX.x)C --o(^_^o)

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



[PHP] Re: strange behaviour with strtotime()

2006-01-31 Thread Barry

James Benson wrote:

Im encountering some very weird behaviour when using the following:-


echo date(M, strtotime(next month));


outputs: Mar



while


echo date(r,time());

outputs: Tue, 31 Jan 2006 11:21:47 +



anyone know why?




-

Master CIW Designer  http://www.ciwcertified.com
Zend Certified Engineer  http://www.zend.com


http://www.jamesbenson.co.uk

-


try that:
echo strtotime1:.strtotime (next Month).\n;
echo strtotime2:.strtotime (next month).\n;
echo time:.time().\n;
echo time1:.strftime(%d %m %Y,strtotime(next Month)). | 
time2:.strftime(%d %m %Y,time());


(probably causing error because of month / Month;

Post result please.

i get:
strtotime1:1143801588
strtotime2:1143801588
time:1138707588
time1:31 03 2006 | time2:31 01 2006


thats indeed funny O_o
--
Smileys rule (cX.x)C --o(^_^o)

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



[PHP] Re: strange behaviour with strtotime()

2006-01-31 Thread Barry

Barry wrote:

James Benson wrote:


Im encountering some very weird behaviour when using the following:-


echo date(M, strtotime(next month));


outputs: Mar



while


echo date(r,time());

outputs: Tue, 31 Jan 2006 11:21:47 +



anyone know why?




-

Master CIW Designer  http://www.ciwcertified.com
Zend Certified Engineer  http://www.zend.com


http://www.jamesbenson.co.uk

-



Probably know why now. The strtotime function adds the value of one 
month to the actual unix time and causing therefor an error.
Most funny party is, if you add +1 Month and +2 Month you get the 
3.3 and the 31.3. I would say this is a bug! ^_^

Report it :)

--
Smileys rule (cX.x)C --o(^_^o)

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



[PHP] Question about C++ like macros on PHP

2006-01-31 Thread Andrei


Hi list,

	For debugging purposes I want to send to a function the line and file 
where it is called. The problem is that I want these parameters to be 
added to function as default parameters (changing all function calls 
would not be an option for me)


function my_func( $param, $line = __LINE__, $file = __FILE__ )
{
   ...
}

won't work as it always gets the file and line where function is defined.
	Also I don't want to change all function calls to put __LINE__ and 
__FILE__ parameters.
I looked into assert too, but I have to change again all function calls 
to be assert( my_func(...) ); which again will be a pain in the a... 
as this function is often called in every scripts...


Any1 has any ideea about it?

Thnx,
Andrei

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



[PHP] Re: Question about C++ like macros on PHP

2006-01-31 Thread Barry

Andrei wrote:


Hi list,

For debugging purposes I want to send to a function the line and 
file where it is called. The problem is that I want these parameters to 
be added to function as default parameters (changing all function calls 
would not be an option for me)


function my_func( $param, $line = __LINE__, $file = __FILE__ )
{
   ...
}

won't work as it always gets the file and line where function is defined.
Also I don't want to change all function calls to put __LINE__ and 
__FILE__ parameters.
I looked into assert too, but I have to change again all function calls 
to be assert( my_func(...) ); which again will be a pain in the a... 
as this function is often called in every scripts...


Any1 has any ideea about it?

Thnx,
Andrei


Not possible.
__FILE__ and __LINE__ refers always to the line and File where the 
parser is at.


--
Smileys rule (cX.x)C --o(^_^o)

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



Re: [PHP] Re: Question about C++ like macros on PHP

2006-01-31 Thread Andrei

Well I know, I wanted to know if any1 did find a workaround...

Barry wrote:

Andrei wrote:


Hi list,

For debugging purposes I want to send to a function the line and 
file where it is called. The problem is that I want these parameters 
to be added to function as default parameters (changing all function 
calls would not be an option for me)


function my_func( $param, $line = __LINE__, $file = __FILE__ )
{
   ...
}

won't work as it always gets the file and line where function is defined.
Also I don't want to change all function calls to put __LINE__ and 
__FILE__ parameters.
I looked into assert too, but I have to change again all function 
calls to be assert( my_func(...) ); which again will be a pain in 
the a... as this function is often called in every scripts...


Any1 has any ideea about it?

Thnx,
Andrei


Not possible.
__FILE__ and __LINE__ refers always to the line and File where the 
parser is at.




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



RE: [PHP] strange behaviour with strtotime()

2006-01-31 Thread Ford, Mike
On 31 January 2006 11:24, James Benson wrote:

 Im encountering some very weird behaviour when using the following:-
 
 
 echo date(M, strtotime(next month));
 
 
 outputs: Mar
 
 
 
 while
 
 
 echo date(r,time());
 
 outputs: Tue, 31 Jan 2006 11:21:47 +
 
 
 
 anyone know why?

Because 1 month from 31-Jan is 31-Feb -- which is taken to mean 02-Mar, hence 
the output of date(M ...).

2 months from now is 31-Mar, which is ok; 3 months from now would be 31-Apr, 
which would likewise be taken to mean 01-May.

This is all as expected -- no bug here.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



Re: [PHP] strange behaviour with strtotime()

2006-01-31 Thread James Benson
Because 1 month from 31-Jan is 31-Feb -- which is taken to mean 02-Mar,
hence the output of date(M ...).



why though, one month from now is 31 Feb, why would it take it as
something else?

That does not make sense to me!



James





-

Master CIW Designer  http://www.ciwcertified.com
Zend Certified Engineer  http://www.zend.com


http://www.jamesbenson.co.uk

-

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



[PHP] Re: PHP and DBase...

2006-01-31 Thread Barry

David BERCOT wrote:

Hi,

I'd like to connect to DBase files (.dbf) in order to do SQL requests.
Do you know if it is possible ?
If yes, do you have an example ?
I'm working on Debian with PHP5.

Thank you very much.

David.

Blind?

http://de.php.net/dbase

--
Smileys rule (cX.x)C --o(^_^o)

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



Re: [PHP] strange behaviour with strtotime()

2006-01-31 Thread Barry Krein

Ford, Mike wrote:



Because 1 month from 31-Jan is 31-Feb -- which is taken to mean 02-Mar, hence the output 
of date(M ...).

2 months from now is 31-Mar, which is ok; 3 months from now would be 31-Apr, 
which would likewise be taken to mean 01-May.

This is all as expected -- no bug here.

Cheers!

Mike


so the 31 feb would be 30 days right?
and since +1 month would be 2nd march wouldnt be +2 month then 2nd april?
Sinze its 2nd march +1 month

see -
echo strftime(%d %m %Y,strtotime (+1
Month,mktime(13,0,0,3,2,2006))).\n;

^^ gives 2nd april! ^^

echo date 1:.strftime(%d %m %Y,strtotime (+1 Month,strtotime(+1
Month))).\n;

^^ gives 3rd april ^^

So its not logic.
month +2 should output 2nd april!

Barry
--
Smileys rule (cX.x)C --o(^_^o)

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



Re: [PHP] Embed XHTML code using PHP's XSLT processor

2006-01-31 Thread Markus Fuchs
Thanks for your response, Björn.

Björn Bartels wrote:
 Hi ,

 this happens because a xml-parser (your browser,...) has to remove all
 spaces, etc.which are not nessesary.

Why doesn't 'xsl:element' indent the xml data according to the ident switch
(yes/no) then? I expected that the complete resulting XHTML (generated
by the XSLT processor) is either indented or it's completely not indented.
Unfortunately this is not the case for the imported XHTML from the XML file.


 hope that helps

 bb

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



Re: [PHP] strange behaviour with strtotime()

2006-01-31 Thread Barry

Ford, Mike wrote:



Because 1 month from 31-Jan is 31-Feb -- which is taken to mean 02-Mar, hence the output 
of date(M ...).

2 months from now is 31-Mar, which is ok; 3 months from now would be 31-Apr, 
which would likewise be taken to mean 01-May.

This is all as expected -- no bug here.

Cheers!

Mike


so the 31 feb would be 30 days right?
and since +1 month would be 2nd march wouldnt be +2 month then 2nd april?
Sinze its 2nd march +1 month

see -
echo strftime(%d %m %Y,strtotime (+1 
Month,mktime(13,0,0,3,2,2006))).\n;


^^ gives 2nd april! ^^

echo date 1:.strftime(%d %m %Y,strtotime (+1 Month,strtotime(+1 
Month))).\n;


^^ gives 3rd april ^^

So its not logic.
month +2 should output 2nd april!

Barry
--
Smileys rule (cX.x)C --o(^_^o)

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



[PHP] Re: strange behaviour with strtotime()

2006-01-31 Thread James Benson
The case makes no difference, because...


echo date('r', strtotime (next Month)).\n;
echo date('r', strtotime (next month)).\n;


gives...

Fri, 03 Mar 2006 12:52:54 +
Fri, 03 Mar 2006 12:52:54 +



BTW, Im using Debian, PHP 4.4.2 and my machines time zone is Europe/London

Few more tests I did:-


echo date('r', strtotime (last month)).\n;


works ok!

Sat, 31 Dec 2005 12:54:38 +


echo date('r', strtotime(next day)).\n;


works ok

echo date('r', strtotime(next year)).\n;

works ok



Very strange!

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



Re: [PHP] Question about C++ like macros on PHP

2006-01-31 Thread David Grant
Andrei,

http://php.net/manual/en/function.debug-backtrace.php

David

Andrei wrote:
 
 Hi list,
 
 For debugging purposes I want to send to a function the line and
 file where it is called. The problem is that I want these parameters to
 be added to function as default parameters (changing all function calls
 would not be an option for me)
 
 function my_func( $param, $line = __LINE__, $file = __FILE__ )
 {
...
 }
 
 won't work as it always gets the file and line where function is defined.
 Also I don't want to change all function calls to put __LINE__ and
 __FILE__ parameters.
 I looked into assert too, but I have to change again all function calls
 to be assert( my_func(...) ); which again will be a pain in the a...
 as this function is often called in every scripts...
 
 Any1 has any ideea about it?
 
 Thnx,
 Andrei
 


-- 
David Grant
http://www.grant.org.uk/

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



[PHP] Re: strange behaviour with strtotime()

2006-01-31 Thread Barry

James Benson wrote:

The case makes no difference, because...


echo date('r', strtotime (next Month)).\n;
echo date('r', strtotime (next month)).\n;


I was referring here to a note on php.net -
For those upgrading from PHP 4 to PHP 5 there are a number of things 
that are different about strtotime that I have NOT seen documented 
elsewhere, or at least not as clearly. I confirmed these with two 
separate fresh installations of PHP 4.4.1 and PHP 5.1.1.


5) Some uppercase and mixed-case strings no longer parse correctly. In 
php4 Yesterday would parse correctly. In php5 Yesterday will return 
the infamous 1969 date. This is also true of Tomorrow and Today.


--
Smileys rule (cX.x)C --o(^_^o)

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



Re: [PHP] Question about C++ like macros on PHP

2006-01-31 Thread Andrei

Thank you very much David

Andrei

David Grant wrote:

Andrei,

http://php.net/manual/en/function.debug-backtrace.php

David

Andrei wrote:

Hi list,

For debugging purposes I want to send to a function the line and
file where it is called. The problem is that I want these parameters to
be added to function as default parameters (changing all function calls
would not be an option for me)

function my_func( $param, $line = __LINE__, $file = __FILE__ )
{
   ...
}

won't work as it always gets the file and line where function is defined.
Also I don't want to change all function calls to put __LINE__ and
__FILE__ parameters.
I looked into assert too, but I have to change again all function calls
to be assert( my_func(...) ); which again will be a pain in the a...
as this function is often called in every scripts...

Any1 has any ideea about it?

Thnx,
Andrei






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



[PHP] Class constructor

2006-01-31 Thread Georgi Ivanov
Hi,
I'm writing a simple class. In order to be compatible with php4 and php5 I've 
done this :

class test{
function Test(){
//This will be called in PHP4
}
function __construct(){
//This will be called in PHP5
$this-Test();
}
}

Is this a solution ? Is there a better way ?

Thanks.

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



Re: [PHP] strange behaviour with strtotime()

2006-01-31 Thread James Benson


Barry wrote:
 Ford, Mike wrote:
 

 Because 1 month from 31-Jan is 31-Feb -- which is taken to mean
 02-Mar, hence the output of date(M ...).

 2 months from now is 31-Mar, which is ok; 3 months from now would be
 31-Apr, which would likewise be taken to mean 01-May.

 This is all as expected -- no bug here.

 Cheers!

 Mike

 so the 31 feb would be 30 days right?
 and since +1 month would be 2nd march wouldnt be +2 month then 2nd april?
 Sinze its 2nd march +1 month
 
 see -
 echo strftime(%d %m %Y,strtotime (+1
 Month,mktime(13,0,0,3,2,2006))).\n;
 
 ^^ gives 2nd april! ^^
 
 echo date 1:.strftime(%d %m %Y,strtotime (+1 Month,strtotime(+1
 Month))).\n;
 
 ^^ gives 3rd april ^^
 
 So its not logic.
 month +2 should output 2nd april!
 
 Barry



ok i understand now, that is fairly fd up if you ask me, the
documentation should state this side affect, one month should be one
month from that date not +31 days, if i wated +31 days i would ask for it :)





James



-

Master CIW Designer  http://www.ciwcertified.com
Zend Certified Engineer  http://www.zend.com


http://www.jamesbenson.co.uk

-

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



Re: [PHP] Class constructor

2006-01-31 Thread Andrei

You could try with phpversion().

Georgi Ivanov wrote:

Hi,
I'm writing a simple class. In order to be compatible with php4 and php5 I've 
done this :


class test{
function Test(){
//This will be called in PHP4
}
function __construct(){
//This will be called in PHP5
$this-Test();
}
}

Is this a solution ? Is there a better way ?

Thanks.



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



Re: [PHP] Class constructor

2006-01-31 Thread David Grant
Georgi,

Drop __construct, PHP5 will call Test() anyway.

From http://uk.php.net/manual/en/language.oop5.decon.php:

For backwards compatibility, if PHP 5 cannot find a __construct()
function for a given class, it will search for the old-style constructor
function, by the name of the class.

David
-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

WANTED: Junior PHP Developer in Bristol, UK

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



RE: [PHP] strange behaviour with strtotime()

2006-01-31 Thread Ford, Mike
On 31 January 2006 13:13, Barry Krein wrote:

 Ford, Mike wrote:
 
  
  Because 1 month from 31-Jan is 31-Feb -- which is taken to
 mean 02-Mar, hence the output of date(M ...).
  
  2 months from now is 31-Mar, which is ok; 3 months from now
 would be 31-Apr, which would likewise be taken to mean 01-May.
  
  This is all as expected -- no bug here.
  
  Cheers!
  
  Mike
  
 so the 31 feb would be 30 days right?
 and since +1 month would be 2nd march wouldnt be +2 month
 then 2nd april?
 Sinze its 2nd march +1 month
 
 see -
 echo strftime(%d %m %Y,strtotime (+1
 Month,mktime(13,0,0,3,2,2006))).\n;
 
 ^^ gives 2nd april! ^^
 
 echo date 1:.strftime(%d %m %Y,strtotime (+1
 Month,strtotime(+1 Month))).\n; 
 
 ^^ gives 3rd april ^^

Uhm -- my mistake, sorry -- 31st Feb equates to 3rd March, not 2nd, so 3rd 
April here is correct.

The basic thing is that strtotime() just uses the same day-of-the-month when 
calculating in months -- so, on the 31st January, it reckons thus:

+1 month:  31st February -- *doesn't exist* converted to 3rd March
+2 months: 31st March-- OK
+3 months: 31st April-- *doesn't exist* converted to 1st May
+4 months: 31st May  -- OK
+5 months: 31st June -- *doesn't exist* converted to 1st July

etc., etc.

So you just have to be careful when calculating next/previous months to allow 
for strangeness like this near the end of a month -- just as you have to watch 
out for DST transitions if calculating with times near 01:00/02:00/03:00.  If 
all you're interested in is the actual month, your best bet is to normalize to 
a date that exists in every month (such as 1st) before doing your next/previous 
calculation.

HTH

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



RE: [PHP] Re: strange behaviour with strtotime()

2006-01-31 Thread Ford, Mike
On 31 January 2006 13:29, Barry wrote:

 James Benson wrote:
  The case makes no difference, because...
  
  
  echo date('r', strtotime (next Month)).\n;
  echo date('r', strtotime (next month)).\n;
  
 I was referring here to a note on php.net -
 For those upgrading from PHP 4 to PHP 5 there are a number of things
 that are different about strtotime that I have NOT seen documented
 elsewhere, or at least not as clearly. I confirmed these with two
 separate fresh installations of PHP 4.4.1 and PHP 5.1.1.
 
 5) Some uppercase and mixed-case strings no longer parse
 correctly. In
 php4 Yesterday would parse correctly. In php5 Yesterday
 will return
 the infamous 1969 date. This is also true of Tomorrow and Today.

Oh, that does seem wrong -- have you checked the bugs database / reported it as 
a bug?

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



Re: [PHP] strange behaviour with strtotime()

2006-01-31 Thread Barry

Ford, Mike wrote:


Uhm -- my mistake, sorry -- 31st Feb equates to 3rd March, not 2nd, so 3rd 
April here is correct.

The basic thing is that strtotime() just uses the same day-of-the-month when 
calculating in months -- so, on the 31st January, it reckons thus:

+1 month:  31st February -- *doesn't exist* converted to 3rd March
+2 months: 31st March-- OK
+3 months: 31st April-- *doesn't exist* converted to 1st May
+4 months: 31st May  -- OK
+5 months: 31st June -- *doesn't exist* converted to 1st July

etc., etc.

So you just have to be careful when calculating next/previous months to allow 
for strangeness like this near the end of a month -- just as you have to watch 
out for DST transitions if calculating with times near 01:00/02:00/03:00.  If 
all you're interested in is the actual month, your best bet is to normalize to 
a date that exists in every month (such as 1st) before doing your next/previous 
calculation.


Your table is quite ok.
But converting dates just because it doesnt exist and on the next added 
month doing so as if there was everything ok is a bug for me.
31st January - +1 month - 31st February (not possibele so its 3rd 
February) - +1 month - 31st February (What the O_o)


How does he calculate?
For me 3rd Fabruary - +1 Month - is 3rd March
also 31st January - +2 Month - is for me 3rd March

31st February is not true because i miss 3 (!!) days.

Not for you?

Barry


--
Smileys rule (cX.x)C --o(^_^o)

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



Re: [PHP] strange behaviour with strtotime()

2006-01-31 Thread Barry

Barry wrote:

Ford, Mike wrote:



Uhm -- my mistake, sorry -- 31st Feb equates to 3rd March, not 2nd, so 
3rd April here is correct.


The basic thing is that strtotime() just uses the same 
day-of-the-month when calculating in months -- so, on the 31st 
January, it reckons thus:


+1 month:  31st February -- *doesn't exist* converted to 3rd March
+2 months: 31st March-- OK
+3 months: 31st April-- *doesn't exist* converted to 1st May
+4 months: 31st May  -- OK
+5 months: 31st June -- *doesn't exist* converted to 1st July

etc., etc.

So you just have to be careful when calculating next/previous months 
to allow for strangeness like this near the end of a month -- just as 
you have to watch out for DST transitions if calculating with times 
near 01:00/02:00/03:00.  If all you're interested in is the actual 
month, your best bet is to normalize to a date that exists in every 
month (such as 1st) before doing your next/previous calculation.



Your table is quite ok.
But converting dates just because it doesnt exist and on the next added 
month doing so as if there was everything ok is a bug for me.
31st January - +1 month - 31st February (not possibele so its 3rd 
February) - +1 month - 31st February (What the O_o)


How does he calculate?
For me 3rd Fabruary - +1 Month - is 3rd March
also 31st January - +2 Month - is for me 3rd March

31st February is not true because i miss 3 (!!) days.

Not for you?

Barry



Lol f***ed everything up -_-
edit:
 31st January - +1 month - 31st February (not possibele so its 3rd
 March) - +1 month - 31st march (What the O_o)

For me 3rd Fabruary - +1 Month - is 3rd March
 also 31st January - +2 Month - is for me 3rd March

 31st February is not true because i miss 3 (!!) days.

--
Smileys rule (cX.x)C --o(^_^o)

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



Re: [PHP] strange behaviour with strtotime()

2006-01-31 Thread Barry

Barry wrote:

Barry wrote:


Ford, Mike wrote:



Uhm -- my mistake, sorry -- 31st Feb equates to 3rd March, not 2nd, 
so 3rd April here is correct.


The basic thing is that strtotime() just uses the same 
day-of-the-month when calculating in months -- so, on the 31st 
January, it reckons thus:


+1 month:  31st February -- *doesn't exist* converted to 3rd March
+2 months: 31st March-- OK
+3 months: 31st April-- *doesn't exist* converted to 1st May
+4 months: 31st May  -- OK
+5 months: 31st June -- *doesn't exist* converted to 1st July

etc., etc.

So you just have to be careful when calculating next/previous months 
to allow for strangeness like this near the end of a month -- just as 
you have to watch out for DST transitions if calculating with times 
near 01:00/02:00/03:00.  If all you're interested in is the actual 
month, your best bet is to normalize to a date that exists in every 
month (such as 1st) before doing your next/previous calculation.



Your table is quite ok.
But converting dates just because it doesnt exist and on the next 
added month doing so as if there was everything ok is a bug for me.
31st January - +1 month - 31st February (not possibele so its 3rd 
February) - +1 month - 31st February (What the O_o)


How does he calculate?
For me 3rd Fabruary - +1 Month - is 3rd March
also 31st January - +2 Month - is for me 3rd March

31st February is not true because i miss 3 (!!) days.

Not for you?

Barry



Lol f***ed everything up -_-
edit:
  31st January - +1 month - 31st February (not possibele so its 3rd
  March) - +1 month - 31st march (What the O_o)

For me 3rd Fabruary - +1 Month - is 3rd March
  also 31st January - +2 Month - is for me 3rd March
 
  31st February is not true because i miss 3 (!!) days.


Last try:
Edit:
   also 31st January - +2 Month - is for me 3rd April
  
   31st March is not true because i miss 3 (!!) days.


--
Smileys rule (cX.x)C --o(^_^o)

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



RE: [PHP] strange behaviour with strtotime()

2006-01-31 Thread Ford, Mike
On 31 January 2006 13:50, James Benson wrote:

 Barry wrote:
  Ford, Mike wrote:
  
   
   Because 1 month from 31-Jan is 31-Feb -- which is taken to mean
   02-Mar, hence the output of date(M ...).
   
   2 months from now is 31-Mar, which is ok; 3 months from now would
   be 31-Apr, which would likewise be taken to mean 01-May.
   
   This is all as expected -- no bug here.
   
   Cheers!
   
   Mike
   
  so the 31 feb would be 30 days right?
  and since +1 month would be 2nd march wouldnt be +2 month then 2nd
  april? Sinze its 2nd march +1 month 
  
  see -
  echo strftime(%d %m %Y,strtotime (+1
  Month,mktime(13,0,0,3,2,2006))).\n;
  
  ^^ gives 2nd april! ^^
  
  echo date 1:.strftime(%d %m %Y,strtotime (+1
  Month,strtotime(+1 Month))).\n; 
  
  ^^ gives 3rd april ^^
  
  So its not logic.
  month +2 should output 2nd april!
  
  Barry
 
 
 
 ok i understand now, that is fairly fd up if you ask me, the
 documentation should state this side affect, one month should be one
 month from that date not +31 days, if i wated +31 days i
 would ask for it :)

Well, it's not always 31 days from now -- that depends on the month!  For 
strtotime(), +1 month is always the same day-of-the-month in the next month -- 
so in some months that's 31 days away, others it's 30 days away, and in 
February it's 28 or 29 days away.

The problem comes when you ask for +1 month (or next month) from the 31st 
of a long month -- do you mean the last day of next month or do you mean the 
equivalent of 31st of next month?  strtotime() takes the latter approach, but 
of course that's not always what you want.  In those cases, you just have to 
beware and check your answer -- if the month component ends up 2 months away, 
instead of 1, then you need to adjust your answer back the appropriate number 
of days.  Personally, I find mktime() more suited to this task than strtotime() 
as you're working with specific day/month/year numbers, but use whatever you 
find most comfortable.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



[PHP] PHP and DBase...

2006-01-31 Thread David BERCOT
Hi,

I'd like to connect to DBase files (.dbf) in order to do SQL requests.
Do you know if it is possible ?
If yes, do you have an example ?
I'm working on Debian with PHP5.

Thank you very much.

David.

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



[PHP] Re: strange behaviour with strtotime()

2006-01-31 Thread James Benson

 try that:
 echo strtotime1:.strtotime (next Month).\n;
 echo strtotime2:.strtotime (next month).\n;
 echo time:.time().\n;
 echo time1:.strftime(%d %m %Y,strtotime(next Month)). |
 time2:.strftime(%d %m %Y,time());
 
 (probably causing error because of month / Month;
 
 Post result please.
 
 i get:
 strtotime1:1143801588
 strtotime2:1143801588
 time:1138707588
 time1:31 03 2006 | time2:31 01 2006
 
 
 thats indeed funny O_o



strtotime1:1141390219
strtotime2:1141390219
time:1138711819
time1:03 03 2006 | time2:31 01 2006




different!!

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



RE: [PHP] strange behaviour with strtotime()

2006-01-31 Thread Ford, Mike
On 31 January 2006 13:04, James Benson wrote:

 Because 1 month from 31-Jan is 31-Feb -- which is taken to
 mean 02-Mar,
 hence the output of date(M ...).
 
 
 
 why though, one month from now is 31 Feb, why would it take it as
 something else? 
 
 That does not make sense to me!

Well does 31st February make sense to you??

It *has* to take it as something else, and the most obvious thing to take it
as is 3rd March (not 2nd -- I was wrong before as 2006 is not a leap year!)
which is the day that would be 31st Feb if it existed...!!!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



Re: [PHP] Class constructor

2006-01-31 Thread Georgi Ivanov
Yes, I noticed that PHP5 call the old way constructor, but what if in future 
version they drop this feature ?
I think this is workaround for the problem . Or not ?

On Tuesday January 31 2006 15:52, David Grant wrote:
 Georgi,

 Drop __construct, PHP5 will call Test() anyway.

 From http://uk.php.net/manual/en/language.oop5.decon.php:

 For backwards compatibility, if PHP 5 cannot find a __construct()
 function for a given class, it will search for the old-style constructor
 function, by the name of the class.

 David
 --
 David Grant
 http://www.grant.org.uk/

 http://pear.php.net/package/File_Ogg0.2.1
 http://pear.php.net/package/File_XSPF   0.1.0

 WANTED: Junior PHP Developer in Bristol, UK

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



RE: [PHP] strange behaviour with strtotime()

2006-01-31 Thread Ford, Mike
On 31 January 2006 14:12, Barry wrote:

 Barry wrote:
 Last try:
 Edit:
 also 31st January - +2 Month - is for me 3rd April
 31st March is not true because i miss 3 (!!) days.  

Huh?  Are you saying that, for you:

   strtotime(+2 months);

gives 3rd April?  If so, I would be absolutely amazed, because I get 31st 
March, which is exactly what I expect.

Of course, if you add 1 month to 31st Jan, then add 1 month to the result, you 
will get 3rd April -- but that's not the same as simply adding 2 months to 31st 
Jan.  If you want 2 months from today, ask for 2 months from today -- not 1 
month from 1 month from today!!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



Re: [PHP] strange behaviour with strtotime()

2006-01-31 Thread Barry

Ford, Mike wrote:

On 31 January 2006 14:12, Barry wrote:



Barry wrote:
Last try:
Edit:
   also 31st January - +2 Month - is for me 3rd April
   31st March is not true because i miss 3 (!!) days.  



Huh?  Are you saying that, for you:

   strtotime(+2 months);

gives 3rd April?  If so, I would be absolutely amazed, because I get 31st 
March, which is exactly what I expect.

Of course, if you add 1 month to 31st Jan, then add 1 month to the result, you 
will get 3rd April -- but that's not the same as simply adding 2 months to 31st 
Jan.  If you want 2 months from today, ask for 2 months from today -- not 1 
month from 1 month from today!!


Thats not logic at all.

If you want 2 apples ask for two ones. Not for one apple and one more 
apple. Because you would just get 1 1/2. Wtf!?


O_o

--
Smileys rule (cX.x)C --o(^_^o)

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



[PHP] Problems with GZIPped content in some cases?!?

2006-01-31 Thread Olaf Greve


Hi all,

Firstly, I'm new to this list, so I'm hoping I'm not flogging a dead 
horse with this question, and I also hope I'm not inadvertently breaking 
any list etiquete in any way...

Should this be the case, I apologise in advance. :P

Alright, with that out of the way, I'll post my actual question:

I find myself with very limited time to fix a bug in my code regarding 
explicit GZIP compression. The server on which it runs (Debian Linux, 
PHP 4.1.2) does not have the output handler set to ob_gzhandler, nor 
does it have the zlib.compression directive set to on.


Now, when using the (shortened for brevity) below code I was given 
previously for this, I run into the following weird behaviour:

-It works for most people.
-For some people, their browser prompts them that it wants to download 
an application of type PHP.
-For yet some other people, the shown page seems to only contain a lot 
of garbled (GZIPped, I suppose...) data.


I have previously seen weird things like this happen with GZIP 
(particularly when enabling it via the php.ini directives AND then 
trying to do so explicitly with code like the code posted here), but in 
this case I'm not certain what the exact source of the problem is (I'm 
guessing something with the headers is off or so)...


Then: this sounds like something that other developers will previously 
have run into, so I'm hoping someone knows the definitive answer, or at 
least some good pointers for solving it...


So, if someone has any ideas, can they please let me know (off-list in 
case the reply is deemed off-topic for this list)?


Thank you all kindly in advance, and with kind regards,
Olaf Greve



?
ob_start();
ob_implicit_flush(0);

function CheckCanGzip(){
global $HTTP_ACCEPT_ENCODING;
global $HTTP_HOST;
if (headers_sent() || connection_aborted()) return 0;
if (strpos($HTTP_ACCEPT_ENCODING, 'x-gzip') !== false) return x-gzip;
if (strpos($HTTP_ACCEPT_ENCODING,'gzip') !== false) return gzip;
return 0;
}

function gzdataout($level=1){ // level = compression level 0-9, 0=none, 
9=max


$Encoding = CheckCanGzip();

$Content = ob_get_contents();
ob_end_clean();

if($Encoding){
header(Content-Encoding: .$Encoding);
echo \x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xFF;
echo substr(gzcompress($Content,$level),2,-4);
} else {
echo $Content;
}
flush();
exit();
}
?
actual page content
?
gzdataout();
?

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



[PHP] Re: Problems with GZIPped content in some cases?!?

2006-01-31 Thread Barry

Olaf Greve wrote:


Hi all,

Firstly, I'm new to this list, so I'm hoping I'm not flogging a dead 
horse with this question, and I also hope I'm not inadvertently breaking 
any list etiquete in any way...

Should this be the case, I apologise in advance. :P

Alright, with that out of the way, I'll post my actual question:

I find myself with very limited time to fix a bug in my code regarding 
explicit GZIP compression. The server on which it runs (Debian Linux, 
PHP 4.1.2) does not have the output handler set to ob_gzhandler, nor 
does it have the zlib.compression directive set to on.


Now, when using the (shortened for brevity) below code I was given 
previously for this, I run into the following weird behaviour:

-It works for most people.
-For some people, their browser prompts them that it wants to download 
an application of type PHP.
-For yet some other people, the shown page seems to only contain a lot 
of garbled (GZIPped, I suppose...) data.


I have previously seen weird things like this happen with GZIP 
(particularly when enabling it via the php.ini directives AND then 
trying to do so explicitly with code like the code posted here), but in 
this case I'm not certain what the exact source of the problem is (I'm 
guessing something with the headers is off or so)...


Then: this sounds like something that other developers will previously 
have run into, so I'm hoping someone knows the definitive answer, or at 
least some good pointers for solving it...


So, if someone has any ideas, can they please let me know (off-list in 
case the reply is deemed off-topic for this list)?


Thank you all kindly in advance, and with kind regards,
Olaf Greve



?
ob_start();
ob_implicit_flush(0);

function CheckCanGzip(){
global $HTTP_ACCEPT_ENCODING;
global $HTTP_HOST;
if (headers_sent() || connection_aborted()) return 0;
if (strpos($HTTP_ACCEPT_ENCODING, 'x-gzip') !== false) return x-gzip;
if (strpos($HTTP_ACCEPT_ENCODING,'gzip') !== false) return gzip;
return 0;
}

function gzdataout($level=1){ // level = compression level 0-9, 0=none, 
9=max


$Encoding = CheckCanGzip();

$Content = ob_get_contents();
ob_end_clean();

if($Encoding){
header(Content-Encoding: .$Encoding);
echo \x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xFF;
echo substr(gzcompress($Content,$level),2,-4);
} else {
echo $Content;
}
flush();
exit();
}
?
actual page content
?
gzdataout();
?


This is surely a browser problem.
I have encuntered the same stuff, over and over. by a few people.

I have created the gzips locally and sended it to them.
No problems since then.

Greets
Barry

--
Smileys rule (cX.x)C --o(^_^o)

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



Re: [PHP] Re: PHP and DBase...

2006-01-31 Thread Jochem Maas

Barry wrote:

David BERCOT wrote:


Hi,

I'd like to connect to DBase files (.dbf) in order to do SQL requests.
Do you know if it is possible ?
If yes, do you have an example ?
I'm working on Debian with PHP5.

Thank you very much.

David.


Blind?


'Blind' ... is that a php framework? ;-)



http://de.php.net/dbase



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



Re: [PHP] Other than default grey button

2006-01-31 Thread Jochem Maas

Lists wrote:


On Jan 31, 2006, at 3:12 AM, Jochem Maas wrote:

yes but your a 'philosopher' - so I don't give a monkey's about  what 
you think.

free hint: stop reading when it no longer interests you.




It's unfortunate you feel this type of remark is necessary not only  to


unfortunate? you mean like every 5 seconds a child dies from lack of clean water
or food. I'm obviously not on the same wave length as you you unfortunate ***.

me, but to the entire list which represents part of the PHP  community 
to the public, and to beginners.


yes - beginners - yes - which is the reason my posts (the ones you complained 
about)
were to the list - I explain a better way to approach the list to one beginner 
and
do it publically so that others might also pick up a clue.

I find it amusing that you seem to feel within your right to chastise me for 
posting
publically in a public forum but you have no reservations about bothering me 
with your
opinions in private (opinions I am niether interested in nor did I ask for 
them).

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



Re: [PHP] Re: Problems with GZIPped content in some cases?!?

2006-01-31 Thread Olaf Greve

Hi Barry (and others),

Thanks for your answer!


This is surely a browser problem.


I already feared as much...

The nasty thing is that due to this some of the end users of our client 
are losing confidence in the way the application works.
Disabling GZIP is not really what I want to do either, as some pages 
alone comprise about 1MB (!) of pure HTML...:D


However... I have of course also been RTFM-ing a good bit, and I'm now 
trying the far simpler per page override of the output buffer by using 
the following function call:


ob_start(ob_gzhandler);

This seems to enforce GZIP compression correctly (I've performed a 
socket call and analysed the headers and data, and it is GZIPped 
alright, and the header for GZIP compression is set as well), so I have 
just informed our client that I would like them to test it again.


I will keep the list posted as well to let you know if it works 
correctly now or not...


Cheers,
Olafo

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



Re: [PHP] Re: PHP and DBase...

2006-01-31 Thread Barry

Jochem Maas wrote:

Barry wrote:


David BERCOT wrote:


Hi,

I'd like to connect to DBase files (.dbf) in order to do SQL requests.
Do you know if it is possible ?
If yes, do you have an example ?
I'm working on Debian with PHP5.

Thank you very much.

David.



Blind?



'Blind' ... is that a php framework? ;-)


It's at least not a bug, it's a feature! ^_^

--
Smileys rule (cX.x)C --o(^_^o)

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



RE: [PHP] strange behaviour with strtotime()

2006-01-31 Thread Ford, Mike
On 31 January 2006 14:52, Barry wrote:

 Ford, Mike wrote:
  On 31 January 2006 14:12, Barry wrote:
  
  
   Barry wrote:
   Last try:
   Edit:
  also 31st January - +2 Month - is for me 3rd April
  31st March is not true because i miss 3 (!!) days.  
  
  
  Huh?  Are you saying that, for you:
  
 strtotime(+2 months);
  
  gives 3rd April?  If so, I would be absolutely amazed,
 because I get 31st March, which is exactly what I expect.
  
  Of course, if you add 1 month to 31st Jan, then add 1 month
 to the result, you will get 3rd April -- but that's not the
 same as simply adding 2 months to 31st Jan.  If you want 2
 months from today, ask for 2 months from today -- not 1 month
 from 1 month from today!!
  
 Thats not logic at all.
 
 If you want 2 apples ask for two ones. Not for one apple and one more
 apple. Because you would just get 1 1/2. Wtf!?

Yes, but 1 apple is 1 apple is 1 apple.

1 month can be 28 days, or 31 days, or anything in between. 2 months can be 
anything from 59 to 62 days.

A month is an imprecise measure, and adding them together will get you an even 
more imprecise result.

Deal with it -- that's just the way it is.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



Re: [PHP] strange behaviour with strtotime()

2006-01-31 Thread Barry

Ford, Mike wrote:

Yes, but 1 apple is 1 apple is 1 apple.

1 month can be 28 days, or 31 days, or anything in between. 2 months can be 
anything from 59 to 62 days.

A month is an imprecise measure, and adding them together will get you an even 
more imprecise result.

Deal with it -- that's just the way it is.

Cheers!


And now you tell me how the strtotime function tells what to use
either 28 days or 31 days or 4 3/87 days.

And that would help.

 Deal with it -- that's just the way it is.

It's not a bug, it's a feature!

Yeah sure ...
--
Smileys rule (cX.x)C --o(^_^o)

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



[PHP] html forms and php

2006-01-31 Thread Philippe Reynolds


Greetings all,

Currently I have a form that has two lists that contain options.
I use javacript to dynamically move options from one select list to another.
All this works fine...


this is the select:

select name=trucklist size=12 style=width: 150px multiple
 option value=LT680LT680/option
 option value=LT685LT685/option
 option value=LT690LT690/option
 option value=LT695LT695/option
 option value=LT700LT700/option
 option value=LT705LT705/option
 /select

Now I wish to post all the options from one list to another page.  So I 
select all the options in that list and hit the submit button.


Obviously, a select list, will return each value with the same name to the 
second web page.  Therefore we can only capture the last option posted.


To resolve this we have to create an array out of our select name:
select name=trucklist[] size=12 style=width: 150px multiple

I added the square brakets to the name...now when I select all the options 
on the list I can read all values individually.


Here is problem...my javascripts have stopped working, I can't move options 
from one list to the next.  Here is the javascript I use currently...I would 
like help in modifing it so that it may work while using the brakets on the 
name of the select:


Thanks a bunch for the help!!  Always appreciated

First the two list that transmit the options back and forth: (javascript 
below)

select name=trucklist size=12 style=width: 150px multiple
 option value=LT680LT680/option
 option value=LT685LT685/option
 option value=LT690LT690/option
 option value=LT695LT695/option
 option value=LT700LT700/option
 option value=LT705LT705/option
 /select
/td
td
  input type=button name=SelectAll value= All style=width: 
100px; onClick=MoveAll(fleetForm.trucklist, fleetForm.reportinglist)br
  input type=button name=Select value= style=width: 100px; 
onClick=Move(fleetForm.trucklist, fleetForm.reportinglist)brbr
  input type=button name=Unselect value= style=width: 100px; 
onClick=Move(fleetForm.reportinglist, fleetForm.trucklist)br
   input type=button name=UnselectAll value= All style=width: 
100px; onClick=MoveAll(fleetForm.reportinglist, fleetForm.trucklist)

/td
td
 select name=reportinglist[] size=12 style=width: 150px multiple


here is the javascript:
function Move(fromList, toList){
   var tempArray = new Array();
   var x = 0;

   //looping through source element to find selected options
   for (var i = 0; i  fromList.length; i++) {
   if (fromList.options[i].selected) {
   //need to move this option to the 'to' list
   var selectionLen = toList.length++;
   toList.options[selectionLen].text = 
fromList.options[i].text;
   toList.options[selectionLen].value = 
fromList.options[i].value;

   }
else {
//storing options that stay to recreate selected trucks
var tempValues = new Object();
tempValues.text = fromList.options[i].text;
tempValues.value = fromList.options[i].value;
tempArray[y] = tempValues;
y++;
   }

   }
   //resetting length of 'from' list
   fromList.length = tempArray.length;
   //looping through temp array to recreate intial selection
   for (var i = 0; i  tempArray.length; i++) {
   fromList.options[i].text = tempArray[i].text;
   fromList.options[i].value = tempArray[i].value;
   fromList.options[i].selected = false;
   }
}
function MoveAll(from, to){
selectAll(from);
Move(from, to);
}
function selectAll(trucklist) {
if (!hasTruck(trucklist)) { return; }
for (var i=0; itrucklist.options.length; i++)
trucklist.options[i].selected = true;

}

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



Re: [PHP] strange behaviour with strtotime()

2006-01-31 Thread James Benson
cheers for the help :)






Barry wrote:
 Ford, Mike wrote:
 Yes, but 1 apple is 1 apple is 1 apple.

 1 month can be 28 days, or 31 days, or anything in between. 2 months
 can be anything from 59 to 62 days.

 A month is an imprecise measure, and adding them together will get you
 an even more imprecise result.

 Deal with it -- that's just the way it is.

 Cheers!
 
 And now you tell me how the strtotime function tells what to use
 either 28 days or 31 days or 4 3/87 days.
 
 And that would help.
 
 Deal with it -- that's just the way it is.
 
 It's not a bug, it's a feature!
 
 Yeah sure ...

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



Re: [PHP] html forms and php

2006-01-31 Thread David Grant
Philippe,

I recommend using an ID, instead of the NAME attribute to refer to the
various elements.  This ought to solve your problem.

David

Philippe Reynolds wrote:
 
 Greetings all,
 
 Currently I have a form that has two lists that contain options.
 I use javacript to dynamically move options from one select list to
 another.
 All this works fine...
 
 
 this is the select:
 
 select name=trucklist size=12 style=width: 150px multiple
  option value=LT680LT680/option
  option value=LT685LT685/option
  option value=LT690LT690/option
  option value=LT695LT695/option
  option value=LT700LT700/option
  option value=LT705LT705/option
  /select
 
 Now I wish to post all the options from one list to another page.  So
 I select all the options in that list and hit the submit button.
 
 Obviously, a select list, will return each value with the same name to
 the second web page.  Therefore we can only capture the last option posted.
 
 To resolve this we have to create an array out of our select name:
 select name=trucklist[] size=12 style=width: 150px multiple
 
 I added the square brakets to the name...now when I select all the
 options on the list I can read all values individually.
 
 Here is problem...my javascripts have stopped working, I can't move
 options from one list to the next.  Here is the javascript I use
 currently...I would like help in modifing it so that it may work while
 using the brakets on the name of the select:
 
 Thanks a bunch for the help!!  Always appreciated
 
 First the two list that transmit the options back and forth: (javascript
 below)
 select name=trucklist size=12 style=width: 150px multiple
  option value=LT680LT680/option
  option value=LT685LT685/option
  option value=LT690LT690/option
  option value=LT695LT695/option
  option value=LT700LT700/option
  option value=LT705LT705/option
  /select
 /td
 td
   input type=button name=SelectAll value= All style=width:
 100px; onClick=MoveAll(fleetForm.trucklist,
 fleetForm.reportinglist)br
   input type=button name=Select value= style=width: 100px;
 onClick=Move(fleetForm.trucklist, fleetForm.reportinglist)brbr
   input type=button name=Unselect value= style=width: 100px;
 onClick=Move(fleetForm.reportinglist, fleetForm.trucklist)br
input type=button name=UnselectAll value= All style=width:
 100px; onClick=MoveAll(fleetForm.reportinglist, fleetForm.trucklist)
 /td
 td
  select name=reportinglist[] size=12 style=width: 150px multiple
 
 
 here is the javascript:
 function Move(fromList, toList){
var tempArray = new Array();
var x = 0;
 
//looping through source element to find selected options
for (var i = 0; i  fromList.length; i++) {
if (fromList.options[i].selected) {
//need to move this option to the 'to' list
var selectionLen = toList.length++;
toList.options[selectionLen].text =
 fromList.options[i].text;
toList.options[selectionLen].value =
 fromList.options[i].value;
}
 else {
   //storing options that stay to recreate selected trucks
   var tempValues = new Object();
   tempValues.text = fromList.options[i].text;
   tempValues.value = fromList.options[i].value;
   tempArray[y] = tempValues;
   y++;
}
 
}
//resetting length of 'from' list
fromList.length = tempArray.length;
//looping through temp array to recreate intial selection
for (var i = 0; i  tempArray.length; i++) {
fromList.options[i].text = tempArray[i].text;
fromList.options[i].value = tempArray[i].value;
fromList.options[i].selected = false;
}
 }
 function MoveAll(from, to){
 selectAll(from);
 Move(from, to);
 }
 function selectAll(trucklist) {
 if (!hasTruck(trucklist)) { return; }
 for (var i=0; itrucklist.options.length; i++)
 trucklist.options[i].selected = true;
 
 }
 


-- 
David Grant
http://www.grant.org.uk/

http://pear.php.net/package/File_Ogg0.2.1
http://pear.php.net/package/File_XSPF   0.1.0

WANTED: Junior PHP Developer in Bristol, UK

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



Re: [PHP] html forms and php

2006-01-31 Thread Richard Davey

On 31 Jan 2006, at 16:07, Philippe Reynolds wrote:


To resolve this we have to create an array out of our select name:
select name=trucklist[] size=12 style=width: 150px multiple

I added the square brakets to the name...now when I select all the  
options on the list I can read all values individually.


Here is problem...my javascripts have stopped working, I can't move  
options from one list to the next.  Here is the javascript I use  
currently...I would like help in modifing it so that it may work  
while using the brakets on the name of the select:


Keep the trucklist[] as the select list NAME. This will allow PHP to  
work.


Add an ID to the select list:

select id=trucklist name=trucklist[] size=12 style=width:  
150px multiple


Now modify your JavaScript to use this ID instead of the form element  
name when moving.


function Move(fromListID, toListID)
{
fromList = document.getElementById(fromListID);
toList = document.getElementById(toListID);

etc etc

You can now access the fromList select list in the usual way.

Cheers,

Rich
--
http://www.corephp.co.uk
Zend Certified Engineer
PHP Development Services

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



Re: [PHP] Re: Problems with GZIPped content in some cases?!?

2006-01-31 Thread Jochem Maas

Olaf Greve wrote:

Hi Barry (and others),

Thanks for your answer!


This is surely a browser problem.



I already feared as much...

The nasty thing is that due to this some of the end users of our client 
are losing confidence in the way the application works.
Disabling GZIP is not really what I want to do either, as some pages 
alone comprise about 1MB (!) of pure HTML...:D


ouch :-)
I just wante to butt in and mention that there is also the following conf stuff
for apache (apache2) which will make your stuff zipped with borking badly 
written
browsers (i.e. IE ;-):



SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch^Mozilla/4 gzip-only-text/html
# Netscape  4.06-4.08 have some more problems
BrowserMatch^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
BrowserMatch\bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch\bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase  Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase  Request_URI \/image\.php no-gzip dont-vary
# Also don't compress PDF and Flash-files 17-01-2004 MM
SetEnvIfNoCase  Request_URI \.pdf$ no-gzip dont-vary
SetEnvIfNoCase  Request_URI \.swf$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header  append Vary User-Agent env=!dont-vary



just stick it in your httpd.conf or vhost definition and behold
the transparent gzipping whenever it's possible! (all thanks to
the apache gurus of course).





However... I have of course also been RTFM-ing a good bit, and I'm now 
trying the far simpler per page override of the output buffer by using 
the following function call:


ob_start(ob_gzhandler);

This seems to enforce GZIP compression correctly (I've performed a 
socket call and analysed the headers and data, and it is GZIPped 
alright, and the header for GZIP compression is set as well), so I have 
just informed our client that I would like them to test it again.


I will keep the list posted as well to let you know if it works 
correctly now or not...


Cheers,
Olafo



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



[PHP] Clean data / text for XML

2006-01-31 Thread Russell Jones
Any good classes or scripts out there to just clean data that will be placed
into XML? I always have a problem with random tokens ruining XML and I
would prefer if I could just find a way to clean all the junk out before
putting it into an xml file.


Re: [PHP] html forms and php

2006-01-31 Thread Philippe Reynolds

Awesome...that solved it!!
Thanks a bunch to everyone who contributed!!

Cheers
Phil

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



[PHP] image uploads

2006-01-31 Thread William Stokes
Hello,

Is there something special about php and images that nobody told me...

I'm writing a image gallery but I have  run to serious trouble with it. I 
have one page with form in it. Form's action is $PHP_SELF. In the form there 
is just one file field called image.

I test if there's users image to handle with
if (isset($img))

if there's one. I greate two new images using

imagecreatefromjpeg()
imagecreatetruecolor()
imagecopyresampled()

in two different functions. At the end of both functions there's 
imagedestroy($img). After that the both image information is stored to DB 
and, if succeful, at the end I do unset($img) to clear the old image 
variable from memory. Both new images are created OK and DB update works OK.

But nothing else doesn't work. I don't know what I have to do to prevent the 
image from realoading to server second time if user hits browser refresh 
button. The same image is uploaded every time the user hits refresh. Another 
thing is that Opera stopped co-operation with this page once and for all. It 
just freezes after the page call's itself. IE and Firefox doesn't.

I Really need some help

Thanks
-Will





 

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



RE: [PHP] strange behaviour with strtotime()

2006-01-31 Thread Ford, Mike
On 31 January 2006 15:41, Barry wrote:

 Ford, Mike wrote:
  Yes, but 1 apple is 1 apple is 1 apple.
  
  1 month can be 28 days, or 31 days, or anything in between.
 2 months can be anything from 59 to 62 days.
  
  A month is an imprecise measure, and adding them together
 will get you an even more imprecise result.
  
  Deal with it -- that's just the way it is.
  
  Cheers!
 
 And now you tell me how the strtotime function tells what to use
 either 28 days or 31 days or 4 3/87 days.

It's very simple.  It uses the same day-of-the-month you start from: 1st gets 
you the 1st; 15th gets you the 15th; 31st gets you 31st or equivalent).  Put 
another way, +1 month adds as many days as there are days in the starting 
month; +2 months adds as many days as there are in the starting month and the 
one after (starting in Jan: 31+28 = 59 -- but starting in, say, Jul: 31+31 = 
62); and so on.

Most of the time this gives you exactly what you want -- it's only when you ask 
starting from the 29th, 30th or 31st of a month, and the destination month is 
shorter, that it causes any kind of problem.  Since this is a very small, 
well-defined range of dates, it's fairly simple to deal with it -- once you 
know you need to!!

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



RE: [PHP] html forms and php

2006-01-31 Thread Ford, Mike
On 31 January 2006 16:08, Philippe Reynolds wrote:

 I added the square brakets to the name...now when I select
 all the options
 on the list I can read all values individually.
 
 Here is problem...my javascripts have stopped working, I
 can't move options
 from one list to the next.  Here is the javascript I use
 currently...I would like help in modifing it so that it may work
 while using the 
 brakets on the
 name of the select:

Use the Javascript identity of x.y with x[y], thusly:

input type=button name=SelectAll value= All style=width:
 100px; onClick=MoveAll(fleetForm.trucklist,
 fleetForm.reportinglist)br

   onclick=MoveAll(fleetForm['trucklist[]'], fleetForm['reportinglist[]'])

No need to mess about with the complications of DOM and getElementById -- it's 
much more backward compatible for older browsers, as well, since that identity 
has existed since day one of JavaScript.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



RE: [PHP] form variables issue

2006-01-31 Thread Weber Sites LTD
I'm not sure I understand the problem.
Can you send a link to the page and post some code?

Sincerely 
 
berber 
 
Visit the Weber Sites Today, 
To see where PHP might take you tomorrow. 
PHP code examples : http://www.weberdev.com 
Free Uptime Monitor : http://uptime.weberdev.com
PHP content for your site : http://content.weber-sites.com
 

-Original Message-
From: All U Want [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 31, 2006 1:04 PM
To: [php] PHP General List
Subject: [PHP] form variables issue

Hi folks,

I'm sure it is a very simple question for you but I'm getting almost crazy.

I've got a simple form with several form objects, one of them is a text
field. After submitting the form if one of the form objects hasn't been
modified I will show the same form but keeping the data previously
introduced. My problem is the text field, I can't show any special
characters again, even if there was any space only the first word is shown,
etc.

I've been playing with different function like urldecode, urlencode,
stripslashes, htmlspecialchars, etc. but couldn't show the same text.

Do  you know how I can fix this?


Thanks a lot,
David.

Note that magic_quotes_gpc is enabled.

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

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



Re: [PHP] form variables issue

2006-01-31 Thread Richard Correia
Can you check the source code?

are there values in source, but it is not displayed on the browser?

input type=text value=My Name is Richard name=first_name

check this code snippet

?php
echo get_magic_quotes_gpc(); // 1
echo $_POST['lastname']; // O\'reilly
echo addslashes($_POST['lastname']); // O\\\'reilly

if (!get_magic_quotes_gpc()) {
   $lastname = addslashes($_POST['lastname']);
} else {
   $lastname = $_POST['lastname'];
}

echo $lastname; // O\'reilly
$sql = INSERT INTO lastnames (lastname) VALUES ('$lastname');
?

Thanks
Richard

On 1/31/06, All U Want [EMAIL PROTECTED] wrote:

 Hi folks,

 I'm sure it is a very simple question for you but I'm getting almost
 crazy.

 I've got a simple form with several form objects, one of them is a
 text field. After submitting the form if one of the form objects
 hasn't been modified I will show the same form but keeping the data
 previously introduced. My problem is the text field, I can't show any
 special characters again, even if there was any space only the first
 word is shown, etc.

 I've been playing with different function like urldecode, urlencode,
 stripslashes, htmlspecialchars, etc. but couldn't show the same text.

 Do  you know how I can fix this?


 Thanks a lot,
 David.

 Note that magic_quotes_gpc is enabled.

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




Re: [PHP] Problems with realpath()

2006-01-31 Thread Richard Correia
I think the DOCUMENT_ROOT is changed for new php implementation.

Thanks
Rich


On 1/31/06, Ron King [EMAIL PROTECTED] wrote:

 Hi,

 My hosting isp just upgraded from 4.3.1 to 4.4.1, and some of the
 tools I use (from InterAKT) no longer work.

 After doing quite a bit of research, I've seen a few bugs regarding
 realpath(), but none related to 4.4.1.

 When I try the following:

 ?php
echo phpversion() . \n;
echo dirname(__FILE__) . \n;
echo realpath(__FILE__);
 ?

 With version 4.4.0, I get the following answer:

 4.4.0
 /web
 /web/realpath.php

 But on version 4.4.1 I get a fatal error:

 4.4.1
 /data/...  -- different server, therefore different path, of course
 Fatal error: Call to undefined function: realpath() in /data/...).

 I'm too much of a newbie to know what to do on my own. Is this
 something my ISP has turned off?

 Thanks for any help,

 -- Ron

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




RE: [PHP] image uploads

2006-01-31 Thread Weber Sites LTD
Check this out : 

http://www.weberdev.com/get_example-3938.html
Image Upload And Resize Script

Sincerely 
 
berber 
 
Visit the Weber Sites Today, 
To see where PHP might take you tomorrow. 
PHP  MySQL Forums : http://www.weberforums.com
Learn PHP  MySQL Playing Trivia : http://www.webertrivia.com
 

-Original Message-
From: William Stokes [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 31, 2006 6:58 PM
To: php-general@lists.php.net
Subject: [PHP] image uploads

Hello,

Is there something special about php and images that nobody told me...

I'm writing a image gallery but I have  run to serious trouble with it. I
have one page with form in it. Form's action is $PHP_SELF. In the form there
is just one file field called image.

I test if there's users image to handle with if (isset($img))

if there's one. I greate two new images using

imagecreatefromjpeg()
imagecreatetruecolor()
imagecopyresampled()

in two different functions. At the end of both functions there's
imagedestroy($img). After that the both image information is stored to DB
and, if succeful, at the end I do unset($img) to clear the old image
variable from memory. Both new images are created OK and DB update works OK.

But nothing else doesn't work. I don't know what I have to do to prevent the
image from realoading to server second time if user hits browser refresh
button. The same image is uploaded every time the user hits refresh. Another
thing is that Opera stopped co-operation with this page once and for all. It
just freezes after the page call's itself. IE and Firefox doesn't.

I Really need some help

Thanks
-Will





 

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

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



[PHP] SQL in XML [was PHP and DBase...]

2006-01-31 Thread David BERCOT
  Hi,
  
  I'd like to connect to DBase files (.dbf) in order to do SQL requests.
  Do you know if it is possible ?
  If yes, do you have an example ?
  I'm working on Debian with PHP5.
  
  Thank you very much.
  
  David.
 Blind?
 
 http://de.php.net/dbase

OK. I should have made such a search ;-)
So, it is possible... I'll try...

But, finally, I wonder if I shouldn't use XML files instead ?
Is it possible, directly, to make a SQL request on a XML file ?

In fact, I was looking for a file format which would be modifing on
Windows and on Linux. So, I thought about dbf. But now...

Thank you very much.

David.

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



Re: [PHP] SQL in XML [was PHP and DBase...]

2006-01-31 Thread Miles Thompson

At 03:08 PM 1/31/2006, David BERCOT wrote:


  Hi,
 
  I'd like to connect to DBase files (.dbf) in order to do SQL requests.
  Do you know if it is possible ?
  If yes, do you have an example ?
  I'm working on Debian with PHP5.
 
  Thank you very much.
 
  David.
 Blind?

 http://de.php.net/dbase

OK. I should have made such a search ;-)
So, it is possible... I'll try...

But, finally, I wonder if I shouldn't use XML files instead ?
Is it possible, directly, to make a SQL request on a XML file ?

In fact, I was looking for a file format which would be modifing on
Windows and on Linux. So, I thought about dbf. But now...

Thank you very much.

David.



David,

If I remember correctly, there are a lot of caveats surrounding .dbf files.
If it is data you have to manage, why not use MySQL / PostgresSQl / Firebird?

Cheers - Miles 



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.375 / Virus Database: 267.14.25/246 - Release Date: 1/30/2006

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



Re: [PHP] SQL in XML [was PHP and DBase...]

2006-01-31 Thread David BERCOT
Hi,
   
I'd like to connect to DBase files (.dbf) in order to do SQL requests.
Do you know if it is possible ?
If yes, do you have an example ?
I'm working on Debian with PHP5.
   
Thank you very much.
   
David.
   Blind?
  
   http://de.php.net/dbase
 
 OK. I should have made such a search ;-)
 So, it is possible... I'll try...
 
 But, finally, I wonder if I shouldn't use XML files instead ?
 Is it possible, directly, to make a SQL request on a XML file ?
 
 In fact, I was looking for a file format which would be modifing on
 Windows and on Linux. So, I thought about dbf. But now...
 
 Thank you very much.
 
 David.
 
 
 David,
 
 If I remember correctly, there are a lot of caveats surrounding .dbf files.
 If it is data you have to manage, why not use MySQL / PostgresSQl / Firebird?

In fact, it is only for one table. And I'd like a simple thing. For my
data, I use Oracle !!!

David.

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



RE: [PHP] SQL in XML [was PHP and DBase...]

2006-01-31 Thread Daevid Vincent
 But, finally, I wonder if I shouldn't use XML files instead ?
 Is it possible, directly, to make a SQL request on a XML file ?

How much data are you storing and how fast do you need it?

If you're doing heavy database type queries, then just use mySQL.

XML is kind of a PITA to use IMHO. You have to set up DOM Objects and all
this crap, then loop over nodes and use xpaths and watch out for #text
elements and it's just messy. I'm forced to use XML for part of a project @
work, and I'm always grateful when I can switch back to using a database and
SQL as God intended it to be. ;-p

However, if you're just storing some basic configs or preferences, then I
would suggest looking into a much simpler (and universal):

http://www.php.net/parse_ini_file

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



Re: [PHP] image uploads

2006-01-31 Thread Richard Lynch
On Tue, January 31, 2006 10:58 am, William Stokes wrote:
 Is there something special about php and images that nobody told me...

No. :-)

 I'm writing a image gallery but I have  run to serious trouble with
 it. I
 have one page with form in it. Form's action is $PHP_SELF. In the form
 there
 is just one file field called image.

Add the ENCTYPE=multipart/form-data to the FORM tag, if you don't
have it.

 I test if there's users image to handle with
 if (isset($img))

You mean isset($image), right?...
The name above is image...

Post source code snippets.

 if there's one. I greate two new images using

 imagecreatefromjpeg()
 imagecreatetruecolor()
 imagecopyresampled()

 in two different functions. At the end of both functions there's
 imagedestroy($img). After that the both image information is stored to
 DB

Storing the image in the DB is probably not a Good Idea for a variety
of reasons.

There is a highly-optimized much more mature specialized database
specifically designed for large-file operations (LFO)...

It's called the file system :-)

 and, if succeful, at the end I do unset($img) to clear the old image
 variable from memory. Both new images are created OK and DB update
 works OK.

OK...

 But nothing else doesn't work.

You'd have to give us a lot more than doesn't work...

We've got nothing to work on here.

 I don't know what I have to do to
 prevent the
 image from realoading to server second time if user hits browser
 refresh
 button. The same image is uploaded every time the user hits refresh.

Well, yeah, if they upload the same image again, then you're going to
get it again.

If you don't want to allow that, then include a unique token
http://php.net/uniqid in the form you send them, and when they upload
the first image, mark that token as used and don't let them do it
again.

You could also do a binary-safe string comparison of the new image
with the images already in the database -- That would be slower, but
would dis-allow somebody from filling out the form again with a new
token and uploading the same image a second time.

 Another
 thing is that Opera stopped co-operation with this page once and for
 all. It
 just freezes after the page call's itself. IE and Firefox doesn't.

Opera freezing up is probably a separate problem entirely.  Ignore it
until you get the application working the way you want it to work.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Question about C++ like macros on PHP

2006-01-31 Thread Richard Lynch
On Tue, January 31, 2006 6:20 am, Andrei wrote:
   For debugging purposes I want to send to a function the line and file
 where it is called. The problem is that I want these parameters to be
 added to function as default parameters (changing all function calls
 would not be an option for me)

 function my_func( $param, $line = __LINE__, $file = __FILE__ )
 {
 ...
 }

 won't work as it always gets the file and line where function is
 defined.
   Also I don't want to change all function calls to put __LINE__ and
 __FILE__ parameters.
 I looked into assert too, but I have to change again all function
 calls
 to be assert( my_func(...) ); which again will be a pain in the a...
 as this function is often called in every scripts...

http://php.net/set_error_handler

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Re: Question about C++ like macros on PHP

2006-01-31 Thread Richard Lynch
On Tue, January 31, 2006 6:40 am, Andrei wrote:
 Well I know, I wanted to know if any1 did find a workaround...

To be more clear, since obviously several other posters aren't aware
of it...

http://php.net/set_error_handler allows you to write a function to be
called when an error occurs and that function accepts optional
arguments of $file and $line which PHP will fill with the __FILE__ and
__LINE__ values of the offending code.

Which is precisely what you need.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] CR \ LFs being represented as ascii characters in output of mail()

2006-01-31 Thread Murray @ PlanetThoughtful

Hi All,

I'm having an odd problem with formatting of line feeds in an email my 
site automatically sends to me when someone comments on one of my blog 
entries.


For some reason \r\n characters are coming through exactly like that 
in the email, and yet the same value being stored in the backend MySQL 
database seems to represent the carriage-return \ line-feed characters 
as it should.


A typical example of the value when sent in the email would be:

Lol, hi Duncan.\r\n\r\nIt\'s possible that this post once had some comments. I 
lost most of PT at one point when my host had a harddrive crash, and salvaged a 
lot of entries from local copies on my computer, and notes I\'d scribbled in my 
journals and so on.\r\n\r\nStill, it\'s great to see you commenting on the post 
that made you a legend on PT!\r\n\r\nMuch warmth,\r\n\r\nMr Banderas

The odd thing is that the rest of the email is correctly interpreting 
line-feed characters, it's only the value entered on the comment form 
that represents CR \ LFs as normal characters.


I'm not sure if this is the culprit, but because my remote host for this 
site has magic_quotes_gpc on, and my local setup doesn't, I run the 
following function every time a page is requested where form processing 
is performed:


  function traverse ( $arr )
  {
  if ( !is_array ( $arr ) )
  return;

  foreach ( $arr as $key = $val )
  is_array ( $arr[$key] ) ? traverse ( $arr[$key] ) : ( 
$arr[$key] = stripslashes ( $arr[$key] ) );

  }

Can anyone give me any thoughts on how to represent these CR \ LF 
characters properly in the email?


Many thanks,

Murray

--
Lost in thought :-
http://www.planetthoughtful.org

---

A blog devoted to urban legends,
superstitions, ghost stories, and
all things folkloric. :-

http://www.ulblog.org

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



[PHP] Re: CR \ LFs being represented as ascii characters in output of mail()

2006-01-31 Thread James Benson




Murray @ PlanetThoughtful wrote:
 Hi All,
 
 I'm having an odd problem with formatting of line feeds in an email my
 site automatically sends to me when someone comments on one of my blog
 entries.
 
 For some reason \r\n characters are coming through exactly like that
 in the email, and yet the same value being stored in the backend MySQL
 database seems to represent the carriage-return \ line-feed characters
 as it should.
 
 A typical example of the value when sent in the email would be:
 
 Lol, hi Duncan.\r\n\r\nIt\'s possible that this post once had some
 comments. I lost most of PT at one point when my host had a harddrive
 crash, and salvaged a lot of entries from local copies on my computer,
 and notes I\'d scribbled in my journals and so on.\r\n\r\nStill, it\'s
 great to see you commenting on the post that made you a legend on
 PT!\r\n\r\nMuch warmth,\r\n\r\nMr Banderas
 
 The odd thing is that the rest of the email is correctly interpreting
 line-feed characters, it's only the value entered on the comment form
 that represents CR \ LFs as normal characters.
 
 I'm not sure if this is the culprit, but because my remote host for this
 site has magic_quotes_gpc on, and my local setup doesn't, I run the
 following function every time a page is requested where form processing
 is performed:
 
   function traverse ( $arr )
   {
   if ( !is_array ( $arr ) )
   return;
 
   foreach ( $arr as $key = $val )
   is_array ( $arr[$key] ) ? traverse ( $arr[$key] ) : (
 $arr[$key] = stripslashes ( $arr[$key] ) );
   }
 
 Can anyone give me any thoughts on how to represent these CR \ LF
 characters properly in the email?
 
 Many thanks,
 
 Murray
 



you probably have it surrounded in single quotes, PHP only converts \n
or \r\n when its enclosed within double quotes


James



-

Master CIW Designer  http://www.ciwcertified.com
Zend Certified Engineer  http://www.zend.com


http://www.jamesbenson.co.uk

-

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



Re: [PHP] Embed XHTML code using PHP's XSLT processor

2006-01-31 Thread Björn Bartels
Moin, moin...

Why doesn't 'xsl:element' indent the xml data according to the ident
switch
(yes/no) then? I expected that the complete resulting XHTML
(generated
by the XSLT processor) is either indented or it's completely not
indented.
Unfortunately this is not the case for the imported XHTML from the XML
file.

I'm only 99% sure but I think in this line...

xsl:apply-templates select=node()  

...node()  returns  CDATA  which drops
those unnessasary whitespaces and cr/lf's...

cheers,
bb

Björn Bartels
-Development/IT-Services-

--
dbusiness.de gmbh
digital business  printing gmbh

Greifswalder Str. 152
D-10409 Berlin

Fon: [0.30] 4.21.19.95
Fax: [0.30] 4.21.19.74

www.dbusiness.de
[EMAIL PROTECTED]
ftp://dbusiness.dyndns.org

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

[PHP] session loss

2006-01-31 Thread Dave Goodchild
Hi all - does anyone know why, in certain cases, session variables are lost
from the $_SESSION superglobal array? I am writing a session-driven app and
for some reason the testing crew lose a certain variable while traversing
forms but I cannot replicate the situation myself. Any knowledge of this
will be appreciated!


Re: [PHP] image uploads

2006-01-31 Thread tedd

Richard said:


Storing the image in the DB is probably not a Good Idea for a variety
of reasons.


And they are?

tedd
--

http://sperling.com/

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



RE: [PHP] image uploads

2006-01-31 Thread Weber Sites LTD
The main reason I don't like storing the images in the DB is because
File system is much more fast then DB. FS and the web server know
How to cache images while using the DB makes you access the 
DB for each and every picture.

It's also harder to maintain cause you don't have a physical file you can 
Move from place to place or from dir to dir. Or just look at a bunch of
Random images like you would in a directory.

From my point of view there has to be a very good reason to put images
Inside a DB instead of in the file system.

Sincerely 
 
berber 
 
Visit the Weber Sites Today, 
To see where PHP might take you tomorrow. 
Free Uptime Monitor : http://uptime.weberdev.com
PHP content for your site : http://content.weber-sites.com
 

-Original Message-
From: tedd [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 01, 2006 12:43 AM
To: php-general@lists.php.net
Subject: Re: [PHP] image uploads

Richard said:

Storing the image in the DB is probably not a Good Idea for a variety 
of reasons.

And they are?

tedd
--


http://sperling.com/

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

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



Re: [PHP] session loss

2006-01-31 Thread Richard Correia
Which php version and platform?

Thanks
Rich

On 2/1/06, Dave Goodchild [EMAIL PROTECTED] wrote:

 Hi all - does anyone know why, in certain cases, session variables are
 lost
 from the $_SESSION superglobal array? I am writing a session-driven app
 and
 for some reason the testing crew lose a certain variable while traversing
 forms but I cannot replicate the situation myself. Any knowledge of this
 will be appreciated!




Re: [PHP] session loss

2006-01-31 Thread Ray Hauge
This behavior could happen if your team is using load-balancing on multiple 
T-1s instead of a bonded connection.  That would cause them to use different 
IPs/connections, and would normally close the session.

That's a remote possibility, but that actually happened to me on one of our 
projects.

-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
http://www.americanstudentloan.com
1.800.575.1099

On Tuesday 31 January 2006 04:12 pm, Richard Correia wrote:
 Which php version and platform?

 Thanks
 Rich

 On 2/1/06, Dave Goodchild [EMAIL PROTECTED] wrote:
  Hi all - does anyone know why, in certain cases, session variables are
  lost
  from the $_SESSION superglobal array? I am writing a session-driven app
  and
  for some reason the testing crew lose a certain variable while traversing
  forms but I cannot replicate the situation myself. Any knowledge of this
  will be appreciated!

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



Re: [PHP] image uploads

2006-01-31 Thread Richard Lynch
On Tue, January 31, 2006 4:43 pm, tedd wrote:
Storing the image in the DB is probably not a Good Idea for a variety
of reasons.

 And they are?

... in the archives.

http://marc.theaimsgroup.com/?l=php-general

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Problems with GZIPped content in some cases?!?

2006-01-31 Thread Richard Lynch
On Tue, January 31, 2006 8:15 am, Olaf Greve wrote:
   header(Content-Encoding: .$Encoding);
   echo \x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xFF;

I don't know diddly about gzip-encoding and browsers, but this line
looks pretty hinky to me...

   echo substr(gzcompress($Content,$level),2,-4);

I suspect it may also be that case that broken browsers are simply
lying about what kinds of compression they can handle...

Not much you can do about that...

I've got a real low trust factor in web browser software for some odd
reason... :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP and DBase...

2006-01-31 Thread Richard Lynch
On Tue, January 31, 2006 7:04 am, David BERCOT wrote:
 I'd like to connect to DBase files (.dbf) in order to do SQL requests.
 Do you know if it is possible ?
 If yes, do you have an example ?
 I'm working on Debian with PHP5.

http://www.php.net/dbase

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] SQL in XML [was PHP and DBase...]

2006-01-31 Thread Richard Lynch
On Tue, January 31, 2006 1:08 pm, David BERCOT wrote:
  Hi,
 
  I'd like to connect to DBase files (.dbf) in order to do SQL
 requests.
  Do you know if it is possible ?
  If yes, do you have an example ?
  I'm working on Debian with PHP5.
 
  Thank you very much.
 
  David.
 Blind?

 http://de.php.net/dbase

 OK. I should have made such a search ;-)
 So, it is possible... I'll try...

 But, finally, I wonder if I shouldn't use XML files instead ?
 Is it possible, directly, to make a SQL request on a XML file ?

 In fact, I was looking for a file format which would be modifing on
 Windows and on Linux. So, I thought about dbf. But now...

MySQL and PostgreSQL both work on Windows (and Linux, duh).

If you're starting a NEW database project, DBase is the LAST thing I'd
choose, unless there's some over-riding concern you've not yet
mentioned.

Actually, DBase doesn't even seem to use SQL, so I suppose your
question could have been:  Is there any way to tie standard SQL into
DBase, instead of using the normal PHP DBase extension?...

I'm pretty sure both PostgreSQL and MySQL allow you to input/output
data as XML.

For sure, MySQL has a new Engine type where you can act upon a CSV
file using SQL which is the closest match to what you seem to be
aiming towards...

Though I still suspect your aim is bad, tell you the truth...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] SQL in XML [was PHP and DBase...]

2006-01-31 Thread Richard Lynch
On Tue, January 31, 2006 1:49 pm, David BERCOT wrote:

After reading more and more of this thread, I think you should also
consider this option:

http://www.php.net/sqllite

It lets you use SQL, and it stores the data in a local file, and it's
quite lightweight/cheap/easy.

Personally, though, I'd just toss the table in Oracle and use the
tools you already have, rather than maintain yet another paradigm
within the application...

YMMV

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Clean data / text for XML

2006-01-31 Thread Richard Lynch
On Tue, January 31, 2006 10:21 am, Russell Jones wrote:
 Any good classes or scripts out there to just clean data that will be
 placed
 into XML? I always have a problem with random tokens ruining XML and
 I
 would prefer if I could just find a way to clean all the junk out
 before
 putting it into an xml file.

Not an XML expert, but...

I think wrapping everything in a CDATA should be pretty safe...

You could also base64_encode (or similar) everything before you put it
into the XML, and undo that at the other end, I suppose.

I've also found that different XML engines will choke on different
things -- Firefox will complain about XML that works in nusoap
and/or PHP5 SOAP.

XML usually turns out to be a lot more painful than it seems like it
should, for me at least, unless the original problem was so simplistic
and trival that XMl was overkill in the first place...

YMMV

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Class constructor

2006-01-31 Thread Richard Lynch
On Tue, January 31, 2006 7:46 am, Georgi Ivanov wrote:
 I'm writing a simple class. In order to be compatible with php4 and
 php5 I've
 done this :

 class test{
   function Test(){
   //This will be called in PHP4
   }
   function __construct(){
   //This will be called in PHP5
   $this-Test();
   }
 }

 Is this a solution ? Is there a better way ?

I suppose if you want the code to run under PHP6, 7, 8, 9, 10, ... it
is somewhat forward-looking to the potential day when Test::Test()
might no longer work as the constructor...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] form variables issue

2006-01-31 Thread Richard Lynch
On Tue, January 31, 2006 5:03 am, All U Want wrote:
 I'm sure it is a very simple question for you but I'm getting almost
 crazy.

 I've got a simple form with several form objects, one of them is a
 text field. After submitting the form if one of the form objects
 hasn't been modified I will show the same form but keeping the data
 previously introduced. My problem is the text field, I can't show any
 special characters again, even if there was any space only the first
 word is shown, etc.

 I've been playing with different function like urldecode, urlencode,
 stripslashes, htmlspecialchars, etc. but couldn't show the same text.

 Do  you know how I can fix this?

The first big problem is that you are outputting stuff like this:

input name=foo value=this value has whitespace so is not a value /

instead of this:

input name=foo value=this value has whitespace but quotes matter /

You should call http://php.net/htmlentities on the data right before
you print it into the HTML page.

?php $value_html = htmlentities($value)?
input name=foo value=?php echo $value_html? /

 Note that magic_quotes_gpc is enabled.

In that case, you need to call http://php.net/stripslashes on the data
before you do anything with it, except to cram it into a database.

magic_quotes_gpc *ONLY* made sense in the context of the early days of
PHP when 99.999% of the data was just getting tossed into a MySQL
database and there were a lot less Bad Guys around -- when it was all
guestbooks and lovey-dovey surfers.

In today's world, Magic Quotes should probably just die...

It's a shame, in a way, in that Magic Quotes is a nice simple solution
to those simplistic applications that are just tossing data into a
database, and not doing much else.  But PHP has grown up a lot since
then, and the world is a different place.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP session_id()

2006-01-31 Thread Richard Lynch
On Mon, January 30, 2006 11:54 pm, Jacques wrote:
 Is it possible that the PHP engine can generate duplicate session id's
 for
 one application? Can one assume that the session id generated and
 saved in a
 database will always be unique (never to be repeated)?

I think the odds are pretty good against, but there's no guarantee of
uniqueness...

If you replace the usual 'file' session handler with 'user' you could
check for yourself easily enough, I should think...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP5 Build - test.php not working

2006-01-31 Thread Richard Lynch
On Mon, January 30, 2006 8:08 pm, Tod Thomas wrote:
 I just built phpV5.1.2 with the same options I used to build php4:

 ./configure  --prefix=/opt/php5
 --with-apxs2=/opt/apache/bin/apxs
 --with-mysql=/opt/mysql
 --disable-cgi --with-zlib

 After make install I had libphp5.so in the ./apache/modules directory
 as
 expected.  I commented out my LoadModule directive for php4 and
 uncommented out the directive for php5.  I copied php.ini-dist to
 /opt/php5/lib/php.ini and restarted apache.

 I expected the test.php page that displays the date, time and the
 output
 of phpinfo() to work.  Instead it just prints out all of the text,
 never
 interpreting the code.

 When I switch it back to php4 everything works fine.  Neither the
 access
 or error logs display any problems.  ldd of libphp5.so shows everthing
 as resolved.  The apache user owns that lib as well as liphp4.so so no
 problems there.  httpd -t says everthing is syntactically correct.
 I've
 really changed nothing other than the library and its name in
 httpd.conf.

 What else could I be doing wrong?  Is there something I can try to
 debug
 and get it to tell me what's up?

I think your add-handler would only work for PHP as CGI...

The AddType directives are frequently encased in httpd.conf in blocks
something like:
If mod_php4.c
  AddType application/x-httpd-php .php
/If

That syntax is wrong, but you get the point -- If you've uncommented
the PHP4 Module, the mod_ph4.c (or whatever it is) needs to change to
5 as well, in the conditional expression that enables PHP4/PHP5.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] CR \ LFs being represented as ascii characters in output of mail()

2006-01-31 Thread Chris Shiflett

Murray @ PlanetThoughtful wrote:

For some reason \r\n characters are coming through exactly like
that in the email, and yet the same value being stored in the
backend MySQL database seems to represent the carriage-return \
line-feed characters as it should.


Sounds like you're using data that's been escaped with something like 
mysql_real_escape_string(). You want to do that when you're using it in 
a MySQL query, not when you use it in an email.


Hope that helps.

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

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



[PHP] Running snippets from within PHP

2006-01-31 Thread Eli

Hi,

How can I run non-PHP code snippets from within PHP?
For example: Is it possible to include a C++ code snippet within PHP and 
run it as it was a regular include?
I know there's a solution using exec() and such, but I want to run the 
snippets like inline code.


-thanks, Eli

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



Re: [PHP] HTML Question?

2006-01-31 Thread William Stokes
Those aren't tables

Doesn't matter... (to me:)


Richard Lynch [EMAIL PROTECTED] kirjoitti 
viestissä:[EMAIL PROTECTED]
 On Thu, January 26, 2006 11:35 am, William Stokes wrote:
 This is totally HTML question but I had to post cause I can't get this
 one
 to work myself

 How to print tables to a page so that they are placed side by side
 horizontally as long as there is screen width left and then continue
 to
 second row below? Like in many image galleries where thumpnails are
 dumped
 to screen and the lines of thumpnails scale dynamically according to
 screen
 widht.

 I need to dump my thumpnails to screen and add some image info below
 every
 thumpnail and I want to take advantage of the whole screen widht.

 Those aren't tables, that's CSS, almost for sure...

 -- 
 Like Music?
 http://l-i-e.com/artists.htm
 

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



Re: [PHP] image uploads

2006-01-31 Thread William Stokes
OK. I was a bit vague at the first posting...

To DB a put the filepath to the two images i create. And some additional 
info like upload date, width, height etc. I like storing my files in 
filesystem...

You mean isset($image), right?...

Right !

ENCTYPE=multipart/form-data 

It's there.

I somehow got it back working with Opera. Don't know how :) One question 
still remains. How to make 100% sure that the image isn't re-loaded to 
server if user hits refresh? And he will cause it can take long time to 
upload 2.5Mb pics over a slow link.

Thanks again
-Will




Richard Lynch [EMAIL PROTECTED] kirjoitti 
viestissä:[EMAIL PROTECTED]
 On Tue, January 31, 2006 4:43 pm, tedd wrote:
Storing the image in the DB is probably not a Good Idea for a variety
of reasons.

 And they are?

 ... in the archives.

 http://marc.theaimsgroup.com/?l=php-general

 -- 
 Like Music?
 http://l-i-e.com/artists.htm 

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



RE: [PHP] image uploads

2006-01-31 Thread Albert
William Stokes wrote:
 I somehow got it back working with Opera. Don't know how :) One question 
 still remains. How to make 100% sure that the image isn't re-loaded to 
 server if user hits refresh? And he will cause it can take long time to 
 upload 2.5Mb pics over a slow link.

When you hit refresh/reload in the browser then the browser send the data to
the server again. No way around this. You can make sure that you do nothing
with the data received by follow the uniqid() method described earlier.

Do you really want people uploading 2.5MB a shot to your server? Why not
limit it to 512KB?

Albert



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.25/247 - Release Date: 2006/01/31
 

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



Re: [PHP] Running snippets from within PHP

2006-01-31 Thread Chris

Hi,

Not sure if this does what you want:

http://pear.php.net/package/Inline_C/

Eli wrote:

Hi,

How can I run non-PHP code snippets from within PHP?
For example: Is it possible to include a C++ code snippet within PHP and 
run it as it was a regular include?
I know there's a solution using exec() and such, but I want to run the 
snippets like inline code.


-thanks, Eli



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



[PHP] Wysiwyg editors?

2006-01-31 Thread William Stokes
Hello,

Once again no PHP question...

If I want to allow users to design and create their own static pages and 
store them to a server as a part of  larger site what ways I have to do 
this?

I once tested htmlarea (http://www.htmlarea.com/) and I think thats 
something I'm looking for. I don't have time or skills to do the editor all 
by myself so I have to use some already available components. They also 
should be freeware since it's a non-commercial site and I'm doing this as a 
hobby. I think there's no free version of htmlarea anymore?

First of all. In the htmlareas site there's a comment: Both Mozilla 
(includes FireFox) and Internet Explorer include a way to make sections of a 
page editable. IE has the MSHTML Editing Platform, and Mozilla has Midas. 
So what about Opera? Are there wysiwyg editors for Opera? The one time I 
tested Htmlarea it only worked on IE.

Second. What are the ways to store user created pages? Just dump all the 
code the editor outputs to database? Or are there other options?

Thank You
-Will

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