Re: [PHP] sorting associative array

2005-01-24 Thread Abdul-Wahid Paterson
Hi,

How about this


  foreach ($data as $key => $row) {
$scores[$key] = $row['scores'];
  }
 array_multisort($scores, SORT_ASC, $data);


Abdul-Wahid


On Mon, 24 Jan 2005 00:39:17 +1100, Jeffery Fernandez
<[EMAIL PROTECTED]> wrote:
> I have the following multi-dimentional array and I want to sort it by
> the "score" key value
> 
> print_r($data);
> 
> Array
> (
> [0] => Array
> (
> [video_id] => 71
> [old_id] => 7854
> [title] => When the fire comes
> [video_copies] => 1
> [running_time] => 48
> [date_published] => 06/02
> [place_published] => Australia
> [abstract] => ABC TV Gives details on many aspects of bushfires: 
> ...
> [library_medium_id] => 5
> [library_type] => 4
> [score] => 6.3310546875
> )
> 
> [1] => Array
> (
> [video_id] => 9
> [old_id] => 7792
> [title] => Fire awareness
> [video_copies] => 1
> [running_time] => 15
> [date_published] =>
> [place_published] => Victoria
> [abstract] => Safetycare Australia A general video lookin.
> [library_medium_id] => 5
> [library_type] => 4
> [score] => 3.1997931003571
> )
> 
> )
> 
> any ideas. Thanks
> 
> Jeffery
> 
> --
> 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] sessions

2005-01-24 Thread Jochem Maas
Sam Webb wrote:
I've installed Apache 2 and PHP 5 on Windows XP, and I'm having some
issues with sessions. Everything else I've tried to do in PHP works
fine, but for some reason every time I try to use session_start() i
get the following errors:
Warning: session_start() [function.session-start]:
open(C:\PHP\sessiondata\sess_29eb1a211c118cc8083168f24e32ee75, O_RDWR)
failed: No such file or directory (2) in C:\Program Files\Apache
Group\Apache2\htdocs\Games\main.php on line 3
C:\PHP\sessiondata\ does not exist or permissions don't allow whatever
user php5 is running under to write the session storage file.
create the dir and make sure the relevant user has write permissions.
if that doesn't work - please come back ;-)
Warning: session_start() [function.session-start]: Cannot send session
cookie - headers already sent by (output started at C:\Program
Files\Apache Group\Apache2\htdocs\Games\main.php:3) in C:\Program
Files\Apache Group\Apache2\htdocs\Games\main.php on line 3
Warning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at C:\Program
Files\Apache Group\Apache2\htdocs\Games\main.php:3) in C:\Program
Files\Apache Group\Apache2\htdocs\Games\main.php on line 3
these 2 warnings merely state that the session could not be started - the 
reason
being that the first error caused php to send out output (i.e. the warning
about not being able to write the session storage file) which means headers
can no longer be sent for that request. if you fix the first error these will go
away too.
Any suggestions?
Sam
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP Application server

2005-01-24 Thread Jochem Maas
Devraj Mukherjee wrote:
We are evaulating the idea of writing a PHP application server. Its aimed
to be a stateful environment for writing PHP applications and we believe
it will be quite advantegous to the entire community.
Any ideas if there are a similar solutions that already exists out there,
and what is the general feel of a solution like this.
google on SRM + PHP ( + Derick Rethans ), you'll quickly find
Script Running Machine - which may be something in the line of where you
wish to be headed
Thanks for your time and feedback.
Devraj
---
Devraj Mukherjee ([EMAIL PROTECTED])
Eternity Technologies Pty. Ltd. ACN 107 600 975
P O Box 5949 Wagga Wagga NSW 2650 Australia
Voice: +61-2-69717131 / Fax: +61-2-69251039
http://www.eternitytechnologies.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] sorting associative array

2005-01-24 Thread Jochem Maas
...

This won't work for me as I have 500+ records to sort based on the 
score key.. looking at jochem's class now. Thanks

which wont help much - assuming what you say is true
(why wont it work? have you tried it).
sort method from the class:
function sort()
{
   if(count($this->sortKeys)) {
   usort($this->dataArray, array($this,"_sortcmp"));
   }
}

Thanks jochem, I had a second look at it and I figured it out. I had 
problem implementing it with a class but now I have figured how to use it.

cheers,
Jeffery
ok, does that mean using usort() on your array works? my class is just a
fancy wrapper around usort - and ofcourse it allows you to sort on more than
1 'column' in the second dimension of the array (kind of like a multi-column
sort in an SQL statement). -- the point being that the usort() example Kurt
(I think that was his name) sent would work also.
anyway glad you could use it. :-)

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


Re: [PHP] sorting associative array

2005-01-24 Thread Jeffery Fernandez
Jochem Maas wrote:
...

This won't work for me as I have 500+ records to sort based on the 
score key.. looking at jochem's class now. Thanks


which wont help much - assuming what you say is true
(why wont it work? have you tried it).
sort method from the class:
function sort()
{
   if(count($this->sortKeys)) {
   usort($this->dataArray, array($this,"_sortcmp"));
   }
}

Thanks jochem, I had a second look at it and I figured it out. I had 
problem implementing it with a class but now I have figured how to 
use it.

cheers,
Jeffery

ok, does that mean using usort() on your array works? my class is just a
fancy wrapper around usort - and ofcourse it allows you to sort on 
more than
1 'column' in the second dimension of the array (kind of like a 
multi-column
sort in an SQL statement). -- the point being that the usort() example 
Kurt
(I think that was his name) sent would work also.

anyway glad you could use it. :-)

Yes the example sent by Kurt Yoder worked for me. I coudn't work out the 
errors with the class you sent me. I realised it was written for PHP5 in 
mind ?... or maybe I wasn't patient enough to spent time debugging it :-(

 /**
  * This function is to sort a multi-dimentional array. This is a 
call-back function.
  * Replace the value of $this->mArraySortKey with the appropriate key
  * before calling the call-back function
  */
 function sort_array($x, $y)
 {
   if ( $x[$this->mArraySortKey] == $y[$this->mArraySortKey] )
 return 0;
   else if ( $x[$this->mArraySortKey] < $y[$this->mArraySortKey] )
 return 1;
   else
 return -1;
 }

and within my class I am calling the following two lines:
   // Sort the array
   $this->mArraySortKey = 'score';
   usort($this->mSearchData, array(& $this, 'sort_array'));
cheers,
Jeffery Fernandez
http://melbourne.ug.php.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] sorting associative array

2005-01-24 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 23 January 2005 22:37, Jeffery Fernandez wrote:

> Kurt Yoder wrote:
> 
> > Use usort (stealing from php docs):
> > 
> > 
> > 
> > function cmp($a['score'], $b['score'])

That should be:

function cmp($a, $b)

> > {
> >if ($a['score'] == $b['score']) {
> >return 0;
> >}
> >return ($a['score'] < $b['score']) ? -1 : 1;
> > }
> > 
> > $data = array(...);
> > 
> > usort($data, "cmp");
> > 
> > 
> This won't work for me as I have 500+ records to sort based on the
> score key..

Sure it will, given the correction above.

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 

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



RE: [PHP] Issue with virtual() calls...

2005-01-24 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 21 January 2005 22:01, Potter, Jeff wrote:

> Hello,
> 
> Could someone help me understand why later versions of PHP (4.3.9,
> 4.3.10, & 5.0.3) do not maintain the same
> ordering for virtual() call output as the older versions?

Sounds like a known bug, which should already be fixed for future versions;
see http://bugs.php.net/bug.php?id=30446 for more details.

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 

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



Re: [PHP] sorting associative array

2005-01-24 Thread Jochem Maas
Jeffery Fernandez wrote:
Jochem Maas wrote:
...

Yes the example sent by Kurt Yoder worked for me. I coudn't work out the 
errors with the class you sent me. I realised it was written for PHP5 in 
mind ?... or maybe I wasn't patient enough to spent time debugging it :-(

I did change it for php5 (to get rid of E_STRICT warnings IIR)
- but the change was fairly cosmetic:
the class def starts like:
class MDASort {
private $dataArray; //the array we want to sort.
private $sortKeys;  //the order in which we want the array to be sorted.
if you change that to:
class MDASort {
var $dataArray; //the array we want to sort.
var $sortKeys;  //the order in which we want the array to be sorted.
then the class should work under php4 as advertised (adding an '&' as you
do below in the callback definition wouldn't hurt either).
...
and within my class I am calling the following two lines:
   // Sort the array
   $this->mArraySortKey = 'score';
   usort($this->mSearchData, array(& $this, 'sort_array'));

cool, taking apart someone elses code and rewriting it one of the best ways
of learning/understanding IMHO. btw the '&' before $this is not strictly 
required,
but it should save you a few cycles :-)

cheers,
Jeffery Fernandez
http://melbourne.ug.php.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] sorting associative array

2005-01-24 Thread Jeffery Fernandez
Jochem Maas wrote:
Jeffery Fernandez wrote:
Jochem Maas wrote:
...

Yes the example sent by Kurt Yoder worked for me. I coudn't work out 
the errors with the class you sent me. I realised it was written for 
PHP5 in mind ?... or maybe I wasn't patient enough to spent time 
debugging it :-(

I did change it for php5 (to get rid of E_STRICT warnings IIR)
- but the change was fairly cosmetic:
the class def starts like:
class MDASort {
private $dataArray; //the array we want to sort.
private $sortKeys;  //the order in which we want the array to be 
sorted.

if you change that to:
class MDASort {
var $dataArray; //the array we want to sort.
var $sortKeys;  //the order in which we want the array to be sorted.
then the class should work under php4 as advertised (adding an '&' as you
do below in the callback definition wouldn't hurt either).
...
and within my class I am calling the following two lines:
   // Sort the array
   $this->mArraySortKey = 'score';
   usort($this->mSearchData, array(& $this, 'sort_array'));

cool, taking apart someone elses code and rewriting it one of the best 
ways
of learning/understanding IMHO. btw the '&' before $this is not 
strictly required,
but it should save you a few cycles :-)

You always learn by re-writing someone elses code ;-)
I had done the changes to the variable declaration and also changed the 
constructor name to be the name of the class and it still gave me 
errors. Perhaps I will test it without any Error reporting on... needs 
some tweaking I guess.

cheers,
Jeffery Fernandez
http://melbourne.ug.php.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Procedural to OOP

2005-01-24 Thread Mike Smith
Thanks Matthew,

I appreciate your feedback. I'll be working on it this morning, and I
might take a look at Smarty too.

Thanks,
Mike

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



[PHP] setcookie command

2005-01-24 Thread Reza Milan
Dear sir,
 
When I use setcookie command I recieve the following message error:
 
Warning: Cannot modify header information - headers already sent by (output 
started at C:\Inetpub\wwwroot\test.php:9) in C:\Inetpub\wwwroot\test.php on 
line 15

WinXp - IE 6
On Localhost and Server
 
 
Thanks
Reza M.


-
Do you Yahoo!?
 Yahoo! Search presents - Jib Jab's 'Second Term'

Re: [PHP] Is this even possible?

2005-01-24 Thread Jason Barnett
Tony Di Croce wrote:
Is it even possible to connect to a postgres server (thats running on
linux) from a windows CLI php script?
I'm seeing a pg_connect() error... FATAL: no pg_hba.conf  entry for
host 192.168.1.100
Any ideas?
The easiest way to get PG up and running on a Windows system is cygwin. 
 Or at least that's my opinion... YMMV

--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY | 
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

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


[PHP] Important m$6h?3p

2005-01-24 Thread dan
See the ghg5%&6gfz65!4Hf55d!46gfgf

 


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

RE: [PHP] Important m$6h?3p

2005-01-24 Thread Mikey
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 24 January 2005 16:35
To: php-general@lists.php.net
Subject: [PHP] Important m$6h?3p

See the ghg5%&6gfz65!4Hf55d!46gfgf

 

Yoiks!

When did this list decide that gibberish was the default language?  Have I
missed *another* meeting?!?

Mikey

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



Re: [PHP] Is this even possible?

2005-01-24 Thread Greg Donald
On Mon, 24 Jan 2005 10:28:09 -0500, Jason Barnett
<[EMAIL PROTECTED]> wrote:
> Tony Di Croce wrote:
> > Is it even possible to connect to a postgres server (thats running on
> > linux) from a windows CLI php script?

Yup.

> > I'm seeing a pg_connect() error... FATAL: no pg_hba.conf  entry for
> > host 192.168.1.100

So edit your pg_hba.conf and add an entry.

> The easiest way to get PG up and running on a Windows system is cygwin.
>   Or at least that's my opinion... YMMV

The 8.0 beta installed for me just fine with no cygwin.


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



Re: [PHP] setcookie command

2005-01-24 Thread Greg Donald
On Mon, 24 Jan 2005 07:24:19 -0800 (PST), Reza Milan
<[EMAIL PROTECTED]> wrote:
> Dear sir,
> 
> When I use setcookie command I recieve the following message error:
> 
> Warning: Cannot modify header information - headers already sent by (output 
> started at C:\Inetpub\wwwroot\test.php:9) in C:\Inetpub\wwwroot\test.php on 
> line 15

Do not set cookies after you have ouput anything, set them before.  Or
use the output buffering functions.


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



[PHP] String to Date and Date to String Functions?

2005-01-24 Thread Ben Edwards
Being trying to work out haw to handle dates.  Basically I need a
function to convert a Date to a String and another function to convert
a string to a date.

Exactly what format the date is held in is not relevant as long as it
is some type of  standard (i.e. Unix Timestamps).

Both the functions will require a format string (such ad DD/MM/YYY)
and again the format/syntax of this is irrelevant, as long as they are
the same for both .

String to Date Function

return date stringToDate( str Date, str Format )  
e.g. $todayDt = stringToDate( '01/01/2003','DD/MM/' );

Date to String Function

return str dateToString( date Date, str Format )  
e.g. $todayStr = dateToString ( $todayDt,'DD/MM/' );

Anyone know of any functions that do this or have pointers as to how
it can be done.

Ben


-- 
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)

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



Re: [PHP] php5 --enable-soap compile error

2005-01-24 Thread Marten Lehmann
Is noone compiling PHP5 on its own, but just using preconfigured rpm's? 
Can't a developer og php have a look on this?

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


RE: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Jay Blanchard
[snip]
Being trying to work out haw to handle dates.  Basically I need a
function to convert a Date to a String and another function to convert
a string to a date.

Exactly what format the date is held in is not relevant as long as it
is some type of  standard (i.e. Unix Timestamps).

Both the functions will require a format string (such ad DD/MM/YYY)
and again the format/syntax of this is irrelevant, as long as they are
the same for both .

String to Date Function

return date stringToDate( str Date, str Format )  
e.g. $todayDt = stringToDate( '01/01/2003','DD/MM/' );

Date to String Function

return str dateToString( date Date, str Format )  
e.g. $todayStr = dateToString ( $todayDt,'DD/MM/' );

Anyone know of any functions that do this or have pointers as to how
it can be done.
[/snip]

You've looked at http://www.php.net/date ?

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



RE: [PHP] Issue with virtual() calls...

2005-01-24 Thread Potter, Jeff
Hi Mike,

I would seem so, but the patch (in snapshot php4-200501201930) only
seems to work when the output_buffering is set to 0.  With
output_buffering set to the default 4096, the virtual() calls are sent
to the browser out of order. The concern with turning the output
buffering off is that the performance will drop off, or there will be an
increase in resource utilization, etc.  The pages and configuration that
are not rendering properly under PHP 4.3.9 have been QA tested without
this issue in PHP 4.3.7 for months, and seem to work fine in PHP 4.3.8.

Any advice or guidance would be appreciated.

Thanks,
JP

-Original Message-
From: Ford, Mike [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 24, 2005 6:40 AM
To: Potter, Jeff; php-general@lists.php.net
Subject: RE: [PHP] Issue with virtual() calls...


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



On 21 January 2005 22:01, Potter, Jeff wrote:

> Hello,
> 
> Could someone help me understand why later versions of PHP (4.3.9, 
> 4.3.10, & 5.0.3) do not maintain the same ordering for virtual() call 
> output as the older versions?

Sounds like a known bug, which should already be fixed for future
versions; see http://bugs.php.net/bug.php?id=30446 for more details.

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 

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



Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Ben Edwards
On Mon, 24 Jan 2005 10:38:03 -0600, Jay Blanchard
<[EMAIL PROTECTED]> wrote:
> [snip]
> 
> String to Date Function
> 
> return date stringToDate( str Date, str Format )
> e.g. $todayDt = stringToDate( '01/01/2003','DD/MM/' );
> 
> Date to String Function
> 
> return str dateToString( date Date, str Format )
> e.g. $todayStr = dateToString ( $todayDt,'DD/MM/' );
> 
> Anyone know of any functions that do this or have pointers as to how
> it can be done.
> [/snip]
> 
> You've looked at http://www.php.net/date ?
> 
Yes.  It douse the dateToString bit but how do I do the reverse.  I
can use it to convert a timestamp to a string but how do I convert a
string to a timestamp.

I must say i've used a few languages in my time and the PHP data/time
functions are a mess.  Generaly when you find a function to do
something to a data item there is an obvious way of reversing this
(i.e. it has a simeler name).  This douse not seem to be the case with
PHP;(

Ben

-- 
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)

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



[PHP] PHP editor suggestion?

2005-01-24 Thread Merlin
Hi there,
I am now using Homesite 4.5.x  since a few years since I found it the 
most relieble editor arround.

Now I would like to have a look around to see if there are better 
solutions nowadays.

I am looking for a relieable, stable and quick PHP/HTML editor.
Can anybody suggest a good one? I tried phpdesigner, but it seems to 
have lots of bugs and is quite slow.

Thank you for any suggestions,
Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP editor suggestion?

2005-01-24 Thread trobi
Merlin  wrote / napísal (a):
Hi there,
I am now using Homesite 4.5.x  since a few years since I found it the 
most relieble editor arround.

Now I would like to have a look around to see if there are better 
solutions nowadays.

I am looking for a relieable, stable and quick PHP/HTML editor.
Can anybody suggest a good one? I tried phpdesigner, but it seems to 
have lots of bugs and is quite slow.

Thank you for any suggestions,
Merlin
phpeclipse?
trobi
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Eval string to array

2005-01-24 Thread Gerard Samuel
Im trying to evaluate a string representation of the output of 
var_export(),
as an array.
To make a long story short, Im using curl to fetch another php page,
that uses var_export to echo out php data structures.
The fetched data via curl, is a string.  Something like ->
array ( 'foo' => 'bar', )

I would like to convert this to a real array.
Im currently trying this ->
$ret = curl_exec($this->curl_handle);
$str = '$array = $ret;';
eval($str);
var_dump($ret, $array);
The resulting var_dump() shows that my eval'ed data is still a string.
string(27) "array ( 'foo' => 'bar', )" string(27) "array ( 'foo' => 
'bar', )"
What should I be doing to get it as an array ->
array(1) { ["foo"]=> string(3) "bar" }

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


Re: Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread hitek
How about the strtotime() function?
http://us4.php.net/manual/en/function.strtotime.php

> 
> From: Ben Edwards <[EMAIL PROTECTED]>
> Date: 2005/01/24 Mon PM 12:03:34 EST
> To: Jay Blanchard <[EMAIL PROTECTED]>
> CC: PHP General List 
> Subject: Re: [PHP] String to Date and Date to String Functions?
> 
> On Mon, 24 Jan 2005 10:38:03 -0600, Jay Blanchard
> <[EMAIL PROTECTED]> wrote:
> > [snip]
> > 
> > String to Date Function
> > 
> > return date stringToDate( str Date, str Format )
> > e.g. $todayDt = stringToDate( '01/01/2003','DD/MM/' );
> > 
> > Date to String Function
> > 
> > return str dateToString( date Date, str Format )
> > e.g. $todayStr = dateToString ( $todayDt,'DD/MM/' );
> > 
> > Anyone know of any functions that do this or have pointers as to how
> > it can be done.
> > [/snip]
> > 
> > You've looked at http://www.php.net/date ?
> > 
> Yes.  It douse the dateToString bit but how do I do the reverse.  I
> can use it to convert a timestamp to a string but how do I convert a
> string to a timestamp.
> 
> I must say i've used a few languages in my time and the PHP data/time
> functions are a mess.  Generaly when you find a function to do
> something to a data item there is an obvious way of reversing this
> (i.e. it has a simeler name).  This douse not seem to be the case with
> PHP;(
> 
> Ben
> 
> -- 
> Ben Edwards - Poole, UK, England
> WARNING:This email contained partisan views - dont ever accuse me of
> using the veneer of objectivity
> If you have a problem emailing me use
> http://www.gurtlush.org.uk/profiles.php?uid=4
> (email address this email is sent from may be defunct)
> 
> -- 
> 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] Eval string to array

2005-01-24 Thread Jochem Maas
Gerard Samuel wrote:
Im trying to evaluate a string representation of the output of 
var_export(),
as an array.
To make a long story short, Im using curl to fetch another php page,
that uses var_export to echo out php data structures.
The fetched data via curl, is a string.  Something like ->
array ( 'foo' => 'bar', )
something LIKE? or exactly that?
anyway I don't have problems with this...
php -r '
eval("\$arr = array ( \"foo\" => \"bar\", );");
$arr1 = var_export($arr, true);
eval("\$arr2 = $arr1;");
var_dump($arr,$arr1,$arr2);
'
...took me a couple of
mins to figure out how you could be
I would like to convert this to a real array.
Im currently trying this ->
$ret = curl_exec($this->curl_handle);
$str = '$array = $ret;';
this is your problems. its to do with string interpolation.
your exec() call is equivelant to
$array = $ret;
guess what that makes $array?
so it should be:
exec("\$array = $ret;");
which will replace the string $ret into the string to be
exec()'ed. alternatively:
exec('$array = '.$ret.';');
geddit?
eval($str);
var_dump($ret, $array);
next time paste the actual var_dump output, its easier. :-)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php5 --enable-soap compile error

2005-01-24 Thread Richard Lynch
Marten Lehmann wrote:
> Is noone compiling PHP5 on its own, but just using preconfigured rpm's?
> Can't a developer og php have a look on this?

It's far more likely that noone is using SOAP... :-^

Try posting the error messages and your exact configure line to
php-install for the maximum odds of a useful response.

If that fails, post same to http://bugs.php.net

As it is, nobody here can even BEGIN to guess what's wrong, since you
haven't provided enough info.

-- 
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] Maxing out sessions?

2005-01-24 Thread Matt
Hi,
I have a high load server which will have anywhere between 500 and 700
session files in the /tmp directory at max load times.  I've also
noticed that session information seems to get lost sometimes during
high load times... like a "remember me" function won't work... or
you'll log in and go right back to the login page as though you had
not logged in yet.

What are my solutions to rectify this?   The machine itself is not
overloaded, just seems like the sessions holding tank is overloaded.

~ Matt

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



RE: [PHP] Issue with virtual() calls...

2005-01-24 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 24 January 2005 16:42, Potter, Jeff wrote:

> Hi Mike,
> 
> I would seem so, but the patch (in snapshot php4-200501201930) only
> seems to work when the output_buffering is set to 0.  With
> output_buffering set to the default 4096, the virtual() calls are sent
> to the browser out of order. The concern with turning the output
> buffering off is that the performance will drop off, or there
> will be an
> increase in resource utilization, etc.  The pages and
> configuration that
> are not rendering properly under PHP 4.3.9 have been QA tested without
> this issue in PHP 4.3.7 for months, and seem to work fine in
> PHP 4.3.8.
> 
> Any advice or guidance would be appreciated.

There's been a fix to the fix today which may or may not have some bearing
on this (I haven't looked at it in detail, and probably wouldn't understand
it if I did!) -- so look for a snapshot dated after about 200501241155.

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 

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



Re: [PHP] skip file_get_contents

2005-01-24 Thread Richard Lynch
Ahmed Abdel-Aliem wrote:
> hi, i have a script that parses data from xml document
> my problem is sometimes i get error when getting file content from xml
> file fails
> so how can u make the script ignore that part when it fails to pull
> the data from the xml file.
>
> here is the script :
>
> $xp = xml_parser_create();
> xml_set_character_data_handler($xp,'h_char');
> xml_set_element_handler($xp,'h_estart','h_eend');
> $listing = 0;
> $found_listings = array();
> $tag_name = '';

$text = file_get_contents("http://someXMLdocument.xml";);
if ($text){
  xml_parse($xp, $text);
}

//> xml_parse($xp,file_get_contents("http://someXMLdocument.xml";));
>
> function h_char($xp,$cdata) {
>   global $listing, $tag_name;
>   if (is_array($listing) and $tag_name) {
>   $listing[$tag_name] .=
> str_replace(''',"'",str_replace('&','&',str_replace('\\$','$',$cdata)));
>   }
>   return true;
> }
>
> function h_estart($xp,$name,$attr) {
>   global $listing, $tag_name;
>   if ($name == 'SITE') {
>   $listing = array();
>   }
>   else {
>   $tag_name = strtolower($name);
>   }
>   return true;
> }
>
> function h_eend($xp,$name) {
>   global $listing, $tag_name, $found_listings;
>   if ($name == 'SITE') {
>   $found_listings[] = $listing;
>   $listing = null;
>   }
>   $tag_name = '';
>   return true;
> }
>
> echo "hi, i am xml data"
> xml_parser_free($xp);
>
> can anyone help me with that please?
> --
> Ahmed Abdel-Aliem
> Web Developer
> www.ApexScript.com
> 0101108551
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
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-db@lists.php.net

2005-01-24 Thread Richard Lynch
Ralph Frost wrote:
> I had a php routine on a shared server running as a CGI script that
> encrypted and sent email text.
>
> It was running fine under PHP version 4.3.6. Then the ISP upgraded to
> 4.3.10  on December 16, 2004 and several of the features in the gpg
> encryption script running in cgi-bin stopped working.
>
> phpinfo()  in a script run from cgi-bin reports  Server
> API  =  Apache.Isn't it supposed to be CGI??

Depends on how the ISP set up cgi-bin -- It would be kind of "odd" for
them to force that to use PHP as a Module, but perhaps they thought that
would be better.

> The ISP did something, and  got it back so fopen() and mail() works, but

Did what?

> Isn't running the script in cgi-bin  SUPPOSED TO run as myusername rather
> than as nobody?

Completely dependent on what the ISP put in httpd.conf

> What mistakes m I making?  Is this a php upgrade/configuration problem
> that
> the ISP needs to look at,

Yes.

> or it is a general security issue which used to
> work but  now is not going to be allowed...

Not from PHP itself, but perhaps from your ISP.

> and the ISP doesn't want to
> tell me?

Perhaps they simply don't understand what they used to have set up, nor
what they have done now...

Or they had problems with users abusing cgi-bin / PHP CGI usage.

There *are* issues involved that are not readily solved in the options
among CGI and Module usage, and ISPs tend to alter things when they have
problems.  These usually just open up other, different problems, but there
it is.

-- 
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] setcookie command

2005-01-24 Thread Richard Lynch
Reza Milan wrote:
> Dear sir,
>
> When I use setcookie command I recieve the following message error:
>
> Warning: Cannot modify header information - headers already sent by
> (output started at C:\Inetpub\wwwroot\test.php:9) in
> C:\Inetpub\wwwroot\test.php on line 15
>
> WinXp - IE 6
> On Localhost and Server

When a web page is sent from the web server to the browser, there are
*TWO* distinct sections sent out.

First, is the 'headers', which are called 'headers' because they come at
the head (beginning) of the data.

Then comes a blank line, to signify the END of headers.

Finally, the 'body' comes out, which is what you see when you do "View
Source" -- It's the actual HTML.

Headers include meta-information such as the type of Content (text/html or
image/jpeg or image/gif or ...)

In your case, test.php has something on line 9 that is sending out some
HTML (or blank lines or ...)

Once that happens, PHP has to dump out all the headers collected so far,
and then a blank line, and then start your content.

If you try to set a cookie *AFTER* that, when the headers are already
gone, and the blank line has gone out to signify the end of headers, IT'S
TOO LATE.

You have to re-arrange your code to get the Cookies and any other headers
to happen *FIRST* and then your HTML after that.

You can cheat and turn on "output buffering," but that comes with its own
performance penalties and issues.

You'll probably have a cleaner, more clear, more easily maintained body of
PHP code if you arrange your headers to come out first anyway.

-- 
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: Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Ben Edwards
On Mon, 24 Jan 2005 12:58:52 -0500, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> How about the strtotime() function?
> http://us4.php.net/manual/en/function.strtotime.php

No good, it douse not take a format string.  What if I wanted to
convert the timestamp to 'DD-MM-YYY', display it on a form, validate
it, and then convert it back to a timestamp.

I cant beleve the PHP date/time functions suck this bad;(

Ben

> > From: Ben Edwards <[EMAIL PROTECTED]>
> > Date: 2005/01/24 Mon PM 12:03:34 EST
> > To: Jay Blanchard <[EMAIL PROTECTED]>
> > CC: PHP General List 
> > Subject: Re: [PHP] String to Date and Date to String Functions?
> >
> > On Mon, 24 Jan 2005 10:38:03 -0600, Jay Blanchard
> > <[EMAIL PROTECTED]> wrote:
> > > [snip]
> > >
> > > String to Date Function
> > > 
> > > return date stringToDate( str Date, str Format )
> > > e.g. $todayDt = stringToDate( '01/01/2003','DD/MM/' );
> > >
> > > Date to String Function
> > > 
> > > return str dateToString( date Date, str Format )
> > > e.g. $todayStr = dateToString ( $todayDt,'DD/MM/' );
> > >
> > > Anyone know of any functions that do this or have pointers as to how
> > > it can be done.
> > > [/snip]
> > >
> > > You've looked at http://www.php.net/date ?
> > >
> > Yes.  It douse the dateToString bit but how do I do the reverse.  I
> > can use it to convert a timestamp to a string but how do I convert a
> > string to a timestamp.
> >
> > I must say i've used a few languages in my time and the PHP data/time
> > functions are a mess.  Generaly when you find a function to do
> > something to a data item there is an obvious way of reversing this
> > (i.e. it has a simeler name).  This douse not seem to be the case with
> > PHP;(
> >
> > Ben
> >
> > --
> > Ben Edwards - Poole, UK, England
> > WARNING:This email contained partisan views - dont ever accuse me of
> > using the veneer of objectivity
> > If you have a problem emailing me use
> > http://www.gurtlush.org.uk/profiles.php?uid=4
> > (email address this email is sent from may be defunct)
> > 
> > --
> > 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
> 
> 


-- 
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)

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



RE: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 24 January 2005 17:04, Ben Edwards wrote:

> On Mon, 24 Jan 2005 10:38:03 -0600, Jay Blanchard
> <[EMAIL PROTECTED]> wrote:
> > [snip]
> > 
> > String to Date Function
> > 
> > return date stringToDate( str Date, str Format )
> > e.g. $todayDt = stringToDate( '01/01/2003','DD/MM/' );
> > 
> > Date to String Function
> > 
> > return str dateToString( date Date, str Format )
> > e.g. $todayStr = dateToString ( $todayDt,'DD/MM/' );
> > 
> > Anyone know of any functions that do this or have pointers as to
> > how it can be done. [/snip]
> > 
> > You've looked at http://www.php.net/date ?
> > 
> Yes.  It douse the dateToString bit but how do I do the reverse.  I
> can use it to convert a timestamp to a string but how do I convert a
> string to a timestamp. 

Right at the top of the description of date(), the second Note reads:

   Note: To generate a timestamp from a string representation of the
   date, you may be able to use strtotime(). 

This should give you a clue.

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 

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



[PHP] Date ranges

2005-01-24 Thread Mikey
Hi NG,

I have a page that is for booking attendance to events, and instead of using
a date picker, I want to display drop-down selects which cover the ranges of
dates that the event is occurring at. My question is, is there an easy way
to determine the dates in between the date from and to that is stored in the
database?  I know how to easily determine the number of days

I know that if I spent time on it, I would be able to do it, but I have a
very close deadline and if anyone else has been through this I would
*really* appreciate the help...

Mikey

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



Re: [PHP] Eval string to array

2005-01-24 Thread Gerard Samuel
Jochem Maas wrote:
Gerard Samuel wrote:
Im trying to evaluate a string representation of the output of 
var_export(),
as an array.
To make a long story short, Im using curl to fetch another php page,
that uses var_export to echo out php data structures.
The fetched data via curl, is a string.  Something like ->
array ( 'foo' => 'bar', )

something LIKE? or exactly that?
anyway I don't have problems with this...
php -r '
eval("\$arr = array ( \"foo\" => \"bar\", );");
$arr1 = var_export($arr, true);
eval("\$arr2 = $arr1;");
var_dump($arr,$arr1,$arr2);
'
...took me a couple of
mins to figure out how you could be

For now, exactly like.
This is what I extracted from your example for it to work ->
$ret = str_replace("\n", '', curl_exec($this->curl_handle));
eval("\$arr = $ret;");
$arr1 = var_export($arr, true);
var_dump($arr);

I would like to convert this to a real array.
Im currently trying this ->
$ret = curl_exec($this->curl_handle);
$str = '$array = $ret;';

this is your problems. its to do with string interpolation.
your exec() call is equivelant to
$array = $ret;
guess what that makes $array?
so it should be:
exec("\$array = $ret;");
which will replace the string $ret into the string to be
exec()'ed. alternatively:
exec('$array = '.$ret.';');
geddit?

gotit

eval($str);
var_dump($ret, $array);

next time paste the actual var_dump output, its easier. :-)

It was in the original email.  Just not where you thought it would have 
been ;)

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


RE: Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Jay Blanchard
[snip]
On Mon, 24 Jan 2005 12:58:52 -0500, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> How about the strtotime() function?
> http://us4.php.net/manual/en/function.strtotime.php

No good, it douse not take a format string.  What if I wanted to
convert the timestamp to 'DD-MM-YYY', display it on a form, validate
it, and then convert it back to a timestamp.

I cant beleve the PHP date/time functions suck this bad;(
[/snip]

Well, you could always write some extensions to PHP to cover it, as soon
as you learn to spell does :)

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



RE: [PHP] Date ranges

2005-01-24 Thread Jay Blanchard
[snip]
I have a page that is for booking attendance to events, and instead of
using
a date picker, I want to display drop-down selects which cover the
ranges of
dates that the event is occurring at. My question is, is there an easy
way
to determine the dates in between the date from and to that is stored in
the
database?  I know how to easily determine the number of days

I know that if I spent time on it, I would be able to do it, but I have
a
very close deadline and if anyone else has been through this I would
*really* appreciate the help...
[/snip]

Are you using MySQL? If so you can start with the DATE_ADD and DATE_SUB
functions. http://www.mysql.com/date Then RTFM http://www.php.net/date,
spacifically http://www.php.net/mktime. With a combination of the two
you can do all sorts of things.

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



Re: [PHP] gzip functions and error

2005-01-24 Thread Richard Lynch
Dmitry wrote:
> Hello!
> How disable error messages when i send incorrect data into gzip* "extract"
> functions, such as gzinflate or gzuncompress?
>
> For example:
>
> function _pack($data) {
>  $data = serialize($data);
>  $data = gzdeflate($data,9);
>  $data = base64_encode($data);
>  $data = urlencode($data);
>  return $data;
> } # _pack()
>
> function _unpack($data) {
>  $data = urldecode($data);
>  $data = base64_decode($data);
>  $data = gzinflate($data);
>  $data = unserialize($data);
>  return $data;
> } # _unpack()
>
> $s = _pack("123"); //  K7YytlIyNDJWsgYA
> $s = _unpack("K7YytlIyNDJWsgYA"); // 123
> $s = _unpack("123"); //  Warning: gzinflate() [function.gzinflate]: data
> error
>
> How disable this warnings? error_reporting(0) or @ operators does not help
> me.

error_reporting(0) *SHOULD* do it...

And you may want to try putting the @ in front of the whole line:
@$s = _unpack("123");

> But I dont want use error_handler functions.

U.  Okay.
Assuming the error_reporting() and @ really really don't work, you've just
rulee out the only solution remaining...

-- 
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] Classes and parents.

2005-01-24 Thread Richard Lynch




Dmitry wrote:
> Greetings.
>
> If i run this code (php5):
> --
> class a {
>  function say() { echo "A"; }
>  function run() { $this->say(); }
> }
> class b extends a {
//>  function say() { echo "B"; }

function say() { parent::say(); echo "B";}

>  function run() { parent::run(); }
> }
>
> $obj = new b;
> $obj->run();
> ---
>
> I will get "B", but how i may get "A"?


-- 
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] Date ranges

2005-01-24 Thread Mikey

*PLEASE NOTE*
>>I know that if I spent time on it, I would be able to do it, but I have
>>A very close deadline and if anyone else has been through this I would
>>*really* appreciate the help...

>Are you using MySQL? If so you can start with the DATE_ADD and DATE_SUB
>functions. http://www.mysql.com/date Then RTFM http://www.php.net/date,
>spacifically http://www.php.net/mktime. With a combination of the two
>you can do all sorts of things.

So you haven't been through this, and didn't bother to read what I said?
Thanks!

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



Re: [PHP] Re: multiple sessions on same server/domain

2005-01-24 Thread Richard Lynch
Jordi Canals wrote:
> On Fri, 21 Jan 2005 09:43:38 -0800 (PST), Richard Lynch <[EMAIL PROTECTED]>
> wrote:
>
>> Thus my point remains:
>> On a shared server, I don't need to resort to calling this function to
>> hijack your Cookie/session.  PHP can read the raw session files.  I can
>> write a PHP script to read the raw session files, regardless of what
>> directory the Cookie is set to use to store/retrieve the Cookie whose
>> purpose is to identify those files.
>>
>> This is not something you can "fix" in any real-world scenario where it
>> matters.
>
> Of course you can fix it! You can change your sessions handler and
> save your session data in a database. For that you can use the
> session_set_save_handler().

The OP ruled out a database session very very early on in the thread.

He also has only just now mentioned that he's using suexec and/or cgi, so
PHP runs as a specific user.

So, now, the problem, as I understand it, boils down to:

User A, running via suexec and session_set_cookie_params() can set a
Cookie in User B's Cookie "realm" also running via suexec.

So User A can hijack User B's cookies, even though they can't read the
session files directly.

Oddly enough, my answer remains the same:

If you don't have a high enough level of trust between A and B, then a
shared server environment is INAPPROPRIATE and they should get dedicated
servers.

I really don't *CARE* if you are talking about COOKIES or sessions or
the Cookies used by sessions, or the server path that the browser will
read/send Cookies to/from for the Cookies used by sessions, my answer
remains the same:

If you don't have a high enough level of trust between A and B, then a
shared server environment is INAPPROPRIATE and they should get dedicated
servers.

It's called a "shared" server for a reason -- The users share things.  If
your users can't share nicely, they shouldn't be on a shared server.  Duh.

Even if you somehow hacked session_set_cookie_params to disallow setting
values to "Bad" data -- perhaps using some php.ini directives or
httpd.conf settings to segregate the Cookie realms (paths) you've only
changed one drop in an ocean:  They still share a server, and have the
ability to damage each other.  [shrug]

That said:  If anybody wants to fix this, go right ahead and code up some
new directives in php.ini and/or httpd.conf so that PHP can "know" what
are allowed values for session_set_cookier_params() for any given user. 
That's what OpenSource is all about.

-- 
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 --enable-soap compile error

2005-01-24 Thread Mikey

>Marten Lehmann wrote:
>> Is noone compiling PHP5 on its own, but just using preconfigured rpm's?
>> Can't a developer og php have a look on this?

>It's far more likely that noone is using SOAP... :-^

>Try posting the error messages and your exact configure line to
>php-install for the maximum odds of a useful response.

>If that fails, post same to http://bugs.php.net

>As it is, nobody here can even BEGIN to guess what's wrong, since you
>haven't provided enough info.

I know this won't help much, but I have managed to build this from source
with no problems at all.  Have you got the dev libraries for libxml
installed?

Mikey

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



Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Bret Hughes
On Mon, 2005-01-24 at 11:03, Ben Edwards wrote:
> On Mon, 24 Jan 2005 10:38:03 -0600, Jay Blanchard
> <[EMAIL PROTECTED]> wrote:
> > [snip]
> > 
> > String to Date Function
> > 
> > return date stringToDate( str Date, str Format )
> > e.g. $todayDt = stringToDate( '01/01/2003','DD/MM/' );
> > 
> > Date to String Function
> > 
> > return str dateToString( date Date, str Format )
> > e.g. $todayStr = dateToString ( $todayDt,'DD/MM/' );
> > 
> > Anyone know of any functions that do this or have pointers as to how
> > it can be done.
> > [/snip]
> > 
> > You've looked at http://www.php.net/date ?
> > 
> Yes.  It douse the dateToString bit but how do I do the reverse.  I
> can use it to convert a timestamp to a string but how do I convert a
> string to a timestamp.
> 
> I must say i've used a few languages in my time and the PHP data/time
> functions are a mess.  Generaly when you find a function to do
> something to a data item there is an obvious way of reversing this
> (i.e. it has a simeler name).  This douse not seem to be the case with
> PHP;(


I have never come across something that I could not achieve using a
combination of mktime, date, time, and strtotime.  I think mktime is the
piece you are missing.  I have been irritated by date parsing in the
past but "If it works ... " 

HTH
Bret

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



Re: [PHP] Notice:Use of undefined constant

2005-01-24 Thread Richard Lynch
> PHP Notice:  Use of undefined constant HOST - assumed 'HOST' in
> /home/hegedus/bin/hae_chng.php on line 4

This *always* means you typed HOST where you needed 'HOST' or "HOST"

Most PHP installations "hide" this "Notice" message from you by the
default php.ini settings.

Course, that also means you've probably got OTHER bugs hidden from you...

Wish List: PHP 6 uses E_ALL by default install.

-- 
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] help with nl2br

2005-01-24 Thread Richard Lynch
Phillip S. Baker wrote:
> Due to style sheet stuff I need to modify the nl2br (IE create or use a
> different function).
>
> I am pulling data from a database and using nl2br, which does the
> standard.
>
> some text copy
> 
> Some more copy
>
> What I want instead is
> Some text copy
>
> some more text copy
>
> Again this is because of css and the designer I am workign with. Is there
> a
> built in function that can do something like this or another function out
> there. So far I cannot see anything. Or is there a way to view the coding
> of
> the nl2br function so I can create a new function modifying how it does
> it.
>
> Just asking so I do not have to create something from scratch.
> Thanks.

//Maybe you just want:
function nl2p($text){
  return str_replace("\n", "\n", $text);
}

//Or, perhaps:
function nl2p($text){
  $result = str_replace("\n\n", "", $text);
  $result = nl2br($result);
  return $result;
}

But it might be worse than that, and you want to replace 2 OR MORE \n with
 tags, at which point you probably want something like:

function nl2p($text){
  $result = preg_replace("/[\n]{2,}/", "", $text);
  //$result = nl2br($result); //Maybe uncomment...
  return $result;
}

All depends on how the original data was typed in, and what your designer
is aiming for.

-- 
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] phpinfo() doesn't report correctly for php 5.0.3

2005-01-24 Thread Cere Davis
Has anyone else noticed this?

When I install php5.0.3 with:

make clean &&

./configure  --prefix=/usr/local --with-mysqli=shared,/usr/bin/mysql_config
--enable-soap  --enable-cli --with-pear --with-apxs2=/usr/bin/apxs2
--enable-xmlrpc --no-create --no-recursion --with-soap --with-xmlrpc
--with-xslt --with-xml2 --with-jpeg --with-png --with-gd --with-zlib
--with-tiff --with-readline --enable-sockets --enable-shared-pdflib
--enable-force-cgi-redirect --with-gettext --enable-mailparse --with-curl
--enable-exif --with-fastcgi --enable-discard-path --with-versioning
--with-layout=GNU  

&& make install

phpinfo() reports that it was built by ./configure with no switches (as
shown below).  

PHP Version => 5.0.3

System => Linux ubu 2.6.8-1-686 #1 Thu Nov 25 04:34:30 UTC 2004 i686
Build Date => Jan 23 2005 20:05:22
Configure Command =>  './configure'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /usr/local/lib
PHP API => 20031224
PHP Extension => 20041030
Zend Extension => 220040412
Debug Build => no
Thread Safety => disabled
IPv6 Support => enabled
Registered PHP Streams => php, file, http, ftp
Registered Stream Socket Transports => tcp, udp, unix, udg


Has anyone else had this problem?
Any advice?

Thanks,
-Cere

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



Re: [PHP] Issue with virtual() calls...

2005-01-24 Thread Richard Lynch
Potter, Jeff wrote:

> is still broken on others.  The content generated from the virtual()
> call inside a page ends up in the browser
> before the opening  tag.   See the simplified example below:

Work-Around:

Until you get this hammered out, you could use file_get_contents() with a
URL instead.

Granted, it's not an Apache sub-request, and it goes in the access_log, so
it's not THE SAME as virtual(), but your HTML output will be correct, at
least...

I'm guessing that performance will suffer slightly, as chewing up a whole
'nother HTTP connection is probably a bit more expensive than a
sub-request...  Or maybe not.  You'll have to test on your server to find
out.

-- 
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] Date ranges

2005-01-24 Thread Bret Hughes
On Mon, 2005-01-24 at 14:07, Mikey wrote:
> 
> *PLEASE NOTE*
> >>I know that if I spent time on it, I would be able to do it, but I have
> >>A very close deadline and if anyone else has been through this I would
> >>*really* appreciate the help...
> 
> >Are you using MySQL? If so you can start with the DATE_ADD and DATE_SUB
> >functions. http://www.mysql.com/date Then RTFM http://www.php.net/date,
> >spacifically http://www.php.net/mktime. With a combination of the two
> >you can do all sorts of things.
> 
> So you haven't been through this, and didn't bother to read what I said?
> Thanks!
> 

I have done a fair bit of date parsing/ processing and if you had not
been so rude to this guy I would have helped just because it is a neat
exercise.  I may do it anyway.  if I do I will post it.  

And no, I have not done this exact thing so I guess that disqualifies me
from making suggestions that might be helpful as well.

Bummer.

Bret

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



Re: [PHP] Maxing out sessions?

2005-01-24 Thread Richard Lynch
Matt wrote:
> I have a high load server which will have anywhere between 500 and 700
> session files in the /tmp directory at max load times.  I've also
> noticed that session information seems to get lost sometimes during
> high load times... like a "remember me" function won't work... or
> you'll log in and go right back to the login page as though you had
> not logged in yet.
>
> What are my solutions to rectify this?   The machine itself is not
> overloaded, just seems like the sessions holding tank is overloaded.

What does "df -h /tmp" show under high load?

If the file system is full, re-partition for more room in /tmp

I'm also wondering if you haven't focussed in too quickly on /tmp and
sessions...

Perhaps under high load, things are breaking long before they get to the
session and /tmp stuff, and then they aren't logged in and get re-directed
to login.  I guess I'm just saying that you need to be sure you understand
the problem for sure before you flail away at it...  Or at least keep an
open mind to the possibilities being larger than you currently 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: Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 24 January 2005 19:01, Ben Edwards wrote:

> On Mon, 24 Jan 2005 12:58:52 -0500, [EMAIL PROTECTED]
> <[EMAIL PROTECTED]> wrote:
> > How about the strtotime() function?
> > http://us4.php.net/manual/en/function.strtotime.php
> 
> No good, it douse not take a format string.  What if I wanted to
> convert the timestamp to 'DD-MM-YYY', display it on a form, validate
> it, and then convert it back to a timestamp.

Well, if you're going to validate it, you'll have to figure out which bits
are the day, month and year -- having done that, you'll have them as three
separate bits of information, so you can use mktime() on them, or glue them
back together to feed to strtotime() in one of the various formats it
recognizes.  Seems to me a format string is pretty irrelevant in all of
this.

Speaking for myself personally, I would never accept a wholly textual date
from a form -- I would have drop-downs for the day and month, and maybe also
for the year depending on the valid range, and then it's a snap just to hand
the resulting values to mktime().

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 

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



Re: Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Richard Lynch
Ben Edwards wrote:
> On Mon, 24 Jan 2005 12:58:52 -0500, [EMAIL PROTECTED] <[EMAIL PROTECTED]> 
> wrote:
>> How about the strtotime() function?
>> http://us4.php.net/manual/en/function.strtotime.php
>
> No good, it douse not take a format string.  What if I wanted to
> convert the timestamp to 'DD-MM-YYY', display it on a form, validate
> it, and then convert it back to a timestamp.
>
> I cant beleve the PHP date/time functions suck this bad;(

Feel free to write an "undate" function that is the inverse of date()
since that's what you seem to want...

Though, really, since by the time it comes back to you, all you need is:

list($dd, $mm, $) = explode('-', $input_date);
$date = mktime(0, 0, 0, $mm, $dd, $);

I'm not quite sure why you think this sucks so bad...
[shrug]

-- 
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] Date ranges

2005-01-24 Thread Jay Blanchard
[snip]
*PLEASE NOTE*
>>I know that if I spent time on it, I would be able to do it, but I
have
>>A very close deadline and if anyone else has been through this I would
>>*really* appreciate the help...

>Are you using MySQL? If so you can start with the DATE_ADD and DATE_SUB
>functions. http://www.mysql.com/date Then RTFM http://www.php.net/date,
>spacifically http://www.php.net/mktime. With a combination of the two
>you can do all sorts of things.

So you haven't been through this, and didn't bother to read what I said?
Thanks!
[/snip]

Yes, Mikey, I read what you said. Since you did not post what you wished
the end result to be I could not extrapolate without speculation as to
what you wanted. Since there are several possibble solutions to the
vague situation you posed I pointed you to the tools that would help. My
bad. 

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



Re: [PHP] Date ranges

2005-01-24 Thread Richard Lynch
Mikey wrote:
> I have a page that is for booking attendance to events, and instead of
> using
> a date picker, I want to display drop-down selects which cover the ranges
> of
> dates that the event is occurring at. My question is, is there an easy way
> to determine the dates in between the date from and to that is stored in
> the
> database?  I know how to easily determine the number of days
>
> I know that if I spent time on it, I would be able to do it, but I have a
> very close deadline and if anyone else has been through this I would
> *really* appreciate the help...

Never done it, but here's a try:

$start = '1/24/2005';
$end = '2/14/2005';
list($m, $d, $y) = explode('/', $start);
$start_t = mktime(0, 0, 0, $m, $d, $y);
list($m, $d, $y) = explode('/', $end);
$end_t = mktime(0, 0, 0, $m, $d, $y);
for ($d1 = $d; mktime(0, 0, 0, $m, $d1, $y) <= $end_t; $d1++){
  echo date("m/d/Y", mktime(0, 0, 0, $m, $d1, $y)), "";
}

It's up to you to format the popups or whatever in the way that you want
them...

-- 
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] Problem after upgrade PHP 5 with array-merge

2005-01-24 Thread PHP Question



Dear all,
 
After my provider decided to upgrade PHP to version 
5, i'm getting the following error:
 
Warning: array_merge() [function.array-merge]: 
Argument #2 is not an array.
 
This is the line where it gets stuck:
 
$_SESSION['aanhefmr'] = 
array_merge($_SESSION['aanhefmr'], $_POST['aanhefmr']);
 
How can i convert it properly to PHP 5? I've wrote 
this two years ago.. So my mind let me down a little.
 
Somebody help?
 
THANKS!!!
 
Frank
 
 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.2 - Release Date: 21-1-2005

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

Re: [PHP] Date ranges

2005-01-24 Thread Jason Wong
On Tuesday 25 January 2005 04:07, Mikey wrote:
> *PLEASE NOTE*
>
> >>I know that if I spent time on it, I would be able to do it, but I have
> >>A very close deadline and if anyone else has been through this I would
> >>*really* appreciate the help...
> >
> >Are you using MySQL? If so you can start with the DATE_ADD and DATE_SUB
> >functions. http://www.mysql.com/date Then RTFM http://www.php.net/date,
> >spacifically http://www.php.net/mktime. With a combination of the two
> >you can do all sorts of things.
>
> So you haven't been through this, and didn't bother to read what I said?
> Thanks!

Perhaps you should have made it clear, something along the lines of:

"I don't want to know how to do it for myself. I just want some ready to use 
code, and I want it yesterday"

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP] Problem after upgrade PHP 5 with array-merge

2005-01-24 Thread Richard Lynch
PHP Question wrote:
> After my provider decided to upgrade PHP to version 5, i'm getting the
> following error:
>
> Warning: array_merge() [function.array-merge]: Argument #2 is not an
> array.
>
> This is the line where it gets stuck:
>
> $_SESSION['aanhefmr'] = array_merge($_SESSION['aanhefmr'],
> $_POST['aanhefmr']);
>
> How can i convert it properly to PHP 5? I've wrote this two years ago.. So
> my mind let me down a little.

$_SESSION[''aanhefmr'] = array_merge($_SESSION['aanhefmr'],
is_array($_POST['aanhefmr']) ? $_POST['aanhefmr'] : array());

This seems kinda dangerous to me, just blindly stuffing all POST data into
SESSION data, though...

Hopefully you sanitize it elsewhere...

-- 
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] Avoiding NOTICEs with list()

2005-01-24 Thread trlists
This construct:

list($v1, $v2, $v3) = explode($sep, $string, 3);

will generate NOTICE level errors if there are not enough parts of the 
string to fill all the variables in the list.  What I really want is 
for list() to set the variables that have a corresponding array 
element, and then either don't change the others, or set them to NULL --
I could live with either approach.

Anyone see a way to get rid of these errors short of this approach:

$parts = explode($sep, $string, 3);
switch(count($parts)) {
case 3:
$v3 = $parts[2];
case 2:
$v2 = $parts[1];
case 1:
$v1 = $parts[0];
}

I did try @list(... and it made no difference.

Thanks,

--
Tom

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



Re: [PHP] PHP editor suggestion?

2005-01-24 Thread Robert Cummings
On Mon, 2005-01-24 at 12:26, Merlin wrote:
> Hi there,
> 
> I am now using Homesite 4.5.x  since a few years since I found it the 
> most relieble editor arround.
> 
> Now I would like to have a look around to see if there are better 
> solutions nowadays.
> 
> I am looking for a relieable, stable and quick PHP/HTML editor.
> 
> Can anybody suggest a good one? I tried phpdesigner, but it seems to 
> have lots of bugs and is quite slow.
> 
> Thank you for any suggestions,
> 
> Merlin

Let me recommend something far better: A SEARCH ENGINE

If that should fail: A BRAIN

At the very least: RTFA

This topic spams the list every week or two. It was just on last week.
At least have a little self respect and try to find an answer for
yourself before posting the same old off topic crap.

Cheers,
Rob. 
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



RE: [PHP] Issue with virtual() calls...

2005-01-24 Thread Potter, Jeff
Mike,

Thanks for the information.  The php4-200501241930 snapshot works much
better...  It looks like Joe Orton's ap_rflush() fix works with output
buffering turned on (output_buffering = 4096).

Regards,
JP

-Original Message-
From: Ford, Mike [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 24, 2005 1:09 PM
To: Potter, Jeff; php-general@lists.php.net
Subject: RE: [PHP] Issue with virtual() calls...


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



On 24 January 2005 16:42, Potter, Jeff wrote:

> Hi Mike,
> 
> I would seem so, but the patch (in snapshot php4-200501201930) only 
> seems to work when the output_buffering is set to 0.  With 
> output_buffering set to the default 4096, the virtual() calls are sent

> to the browser out of order. The concern with turning the output 
> buffering off is that the performance will drop off, or there will be 
> an increase in resource utilization, etc.  The pages and
> configuration that
> are not rendering properly under PHP 4.3.9 have been QA tested without
> this issue in PHP 4.3.7 for months, and seem to work fine in
> PHP 4.3.8.
> 
> Any advice or guidance would be appreciated.

There's been a fix to the fix today which may or may not have some
bearing on this (I haven't looked at it in detail, and probably wouldn't
understand it if I did!) -- so look for a snapshot dated after about
200501241155.

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 

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



Re: [PHP] Maxing out sessions?

2005-01-24 Thread Matt
/tmp is not it's own partition... but I have 6Gig free on the / drive.
Right now I have 401 sessions and am pushing 2Gig on the /tmp directory.

At the moment I am not having any session issues.   Ok.. if it isn't a
/tmp issue (and maybe it isn't)... whatelse should I look at?   It's
definately SOMETHING with sessions.. because you can be logged into an
application.. and all of a sudden you'll get kicked out back to the
"login" screen (which is where i have it programmed to go if you try
to go to a page and aren't logged in)... you can try to log in and it
will just keep returning you to the login page... if I go and wipe
/tmp all is fine...

What do you make of this?


On Mon, 24 Jan 2005 12:34:21 -0800 (PST), Richard Lynch <[EMAIL PROTECTED]> 
wrote:
> Matt wrote:
> > I have a high load server which will have anywhere between 500 and 700
> > session files in the /tmp directory at max load times.  I've also
> > noticed that session information seems to get lost sometimes during
> > high load times... like a "remember me" function won't work... or
> > you'll log in and go right back to the login page as though you had
> > not logged in yet.
> >
> > What are my solutions to rectify this?   The machine itself is not
> > overloaded, just seems like the sessions holding tank is overloaded.
> 
> What does "df -h /tmp" show under high load?
> 
> If the file system is full, re-partition for more room in /tmp
> 
> I'm also wondering if you haven't focussed in too quickly on /tmp and
> sessions...
> 
> Perhaps under high load, things are breaking long before they get to the
> session and /tmp stuff, and then they aren't logged in and get re-directed
> to login.  I guess I'm just saying that you need to be sure you understand
> the problem for sure before you flail away at it...  Or at least keep an
> open mind to the possibilities being larger than you currently 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] Maxing out sessions?

2005-01-24 Thread Greg Donald
On Mon, 24 Jan 2005 16:22:23 -0500, Matt <[EMAIL PROTECTED]> wrote:
> /tmp is not it's own partition... but I have 6Gig free on the / drive.
> Right now I have 401 sessions and am pushing 2Gig on the /tmp directory.

What does

cat /proc/sys/fs/file-max

say?


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



Re: [PHP] Maxing out sessions?

2005-01-24 Thread Richard Lynch
Matt wrote:
> /tmp is not it's own partition... but I have 6Gig free on the / drive.
> Right now I have 401 sessions and am pushing 2Gig on the /tmp directory.
>
> At the moment I am not having any session issues.   Ok.. if it isn't a
> /tmp issue (and maybe it isn't)... whatelse should I look at?   It's
> definately SOMETHING with sessions.. because you can be logged into an
> application.. and all of a sudden you'll get kicked out back to the
> "login" screen (which is where i have it programmed to go if you try
> to go to a page and aren't logged in)... you can try to log in and it
> will just keep returning you to the login page... if I go and wipe
> /tmp all is fine...
>
> What do you make of this?

Perhaps your OS only allows N files in a single directory...

Though several hundred seems awfully low...

Perhaps, right before the re-direct, you could log something into Apache
about the state of the world -- what PHPSESSID is, why the session
couldn't be started, etc.

-- 
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] Avoiding NOTICEs with list()

2005-01-24 Thread James Kaufman
On Mon, Jan 24, 2005 at 03:54:45PM -0500, [EMAIL PROTECTED] wrote:
> This construct:
> 
>   list($v1, $v2, $v3) = explode($sep, $string, 3);
> 
> will generate NOTICE level errors if there are not enough parts of the 
> string to fill all the variables in the list.  What I really want is 
> for list() to set the variables that have a corresponding array 
> element, and then either don't change the others, or set them to NULL --
> I could live with either approach.
> 
> Anyone see a way to get rid of these errors short of this approach:
> 
>   $parts = explode($sep, $string, 3);
>   switch(count($parts)) {
>   case 3:
>   $v3 = $parts[2];
>   case 2:
>   $v2 = $parts[1];
>   case 1:
>   $v1 = $parts[0];
>   }
> 
> I did try @list(... and it made no difference.

I just tried it with php 4.3.8 and it did not throw a NOTICE with @list.
I suppose you could try @explode as well as @list.

-- 
Jim Kaufman
Linux Evangelist
public key 0x6D802619, CISSP# 65668

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



Re: [PHP] PHP editor suggestion?

2005-01-24 Thread Christopher Fulton
[quote]
> I am looking for a relieable, stable and quick PHP/HTML editor.
> 
> Can anybody suggest a good one? I tried phpdesigner, but it seems to
> have lots of bugs and is quite slow.
> 
[/quote]

Just a suggestionA mailing list may not be the best place to find
the answer for this question.  A person's choice in an editor is going
to be different depending on who you talk to.  One person may love vi,
whereas another person may love Dreamweaver.  If you read the
archives, you'll see several responses going many different ways as to
what editor is the best.  My suggestion would be to decide what are
the most important things you want in an editor (ie...syntax
highlighting, speed, a built in code debugger, cross platform
compatibility, etc...).  Then, once you have decided what is
"essential" for you, do a google search for editors with those things.
 Try a few out, and decide what works best for you.

Happy Searching, 
Chris  

---
Christopher Fulton
http://www.fultonfam.com

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



Re: [PHP] Maxing out sessions?

2005-01-24 Thread Matt
[EMAIL PROTECTED] tmp]$ cat /proc/sys/fs/file-max
52403



On Mon, 24 Jan 2005 15:39:08 -0600, Greg Donald <[EMAIL PROTECTED]> wrote:
> On Mon, 24 Jan 2005 16:22:23 -0500, Matt <[EMAIL PROTECTED]> wrote:
> > /tmp is not it's own partition... but I have 6Gig free on the / drive.
> > Right now I have 401 sessions and am pushing 2Gig on the /tmp directory.
> 
> What does
> 
> cat /proc/sys/fs/file-max
> 
> say?
> 
> --
> Greg Donald
> Zend Certified Engineer
> http://destiney.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] Maxing out sessions?

2005-01-24 Thread Matt
That's actually a great idea... I know how to log sessionId... but how
would I go about logging why the session couldn't be started (I'm sure
that would lead me on somewhat of a track of the issue...)... like is
there a variable I should read, or where do I get that information
from?

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



[PHP] Allowing Users to Edit HTML

2005-01-24 Thread trlists
I am a consultant developing a PHP-based site (fully operational now, 
we're adding some new features).

One thing I need to do is allow resellers of my client's services to 
edit HTML which will then be used on the web pages their customers see. 
In other words they get to customize the appearance of their portion of 
the site.  Most of the data entry involved is stuff where they plug in 
some data and I create the HTML with it -- stuff like colors and 
titles.  But in some cases I need to allow them to enter HTML code 
themselves.

I am currently running the code through htmlentities() before 
displaying it in the form field for them to edit.  The _POST data is 
run through trim(), then substr() to limit the length, then 
html_entity_decode(), before doing any further processing.  We also use 
strip_tags() on all fields in _POST except the HTML data, and 
everything that goes into the database is run through 
mysql_real_escape_string().

Do these methods seem reasonably secure?  Am I missing something?  The 
risk is minimized by the fact that the HTML the user enters is 
displayed to their own customers, whom they presumably don't want to 
attack (and if they did they could just do it on their own web site).  
But I still want to avoid as many opportunities as possible for either 
inadvertent or deliberate errors to cause trouble.

Thanks for any comments,

--
Tom

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



Re: [PHP] Allowing Users to Edit HTML

2005-01-24 Thread Jochem Maas
[EMAIL PROTECTED] wrote:
I am a consultant developing a PHP-based site (fully operational now, 
we're adding some new features).

One thing I need to do is allow resellers of my client's services to 
edit HTML which will then be used on the web pages their customers see. 
In other words they get to customize the appearance of their portion of 
the site.  Most of the data entry involved is stuff where they plug in 
some data and I create the HTML with it -- stuff like colors and 
titles.  But in some cases I need to allow them to enter HTML code 
themselves.

I am currently running the code through htmlentities() before 
displaying it in the form field for them to edit.  The _POST data is 
run through trim(), then substr() to limit the length, then 
html_entity_decode(), before doing any further processing.  We also use 
strip_tags() on all fields in _POST except the HTML data, and 
everything that goes into the database is run through 
mysql_real_escape_string().

Do these methods seem reasonably secure?  Am I missing something?  The 
risk is minimized by the fact that the HTML the user enters is 
displayed to their own customers, whom they presumably don't want to 
attack (and if they did they could just do it on their own web site).  
But I still want to avoid as many opportunities as possible for either 
inadvertent or deliberate errors to cause trouble.
something that springs to mind...



Thanks for any comments,
--
Tom
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Date ranges

2005-01-24 Thread Mikey
>> >>I know that if I spent time on it, I would be able to do it, but I have
>> >>A very close deadline and if anyone else has been through this I would
>> >>*really* appreciate the help...
>> >
>> >Are you using MySQL? If so you can start with the DATE_ADD and DATE_SUB
>> >functions. http://www.mysql.com/date Then RTFM http://www.php.net/date,
>> >spacifically http://www.php.net/mktime. With a combination of the two
>> >you can do all sorts of things.
>>
>> So you haven't been through this, and didn't bother to read what I said?
>> Thanks!
>
>Perhaps you should have made it clear, something along the lines of:
>
>"I don't want to know how to do it for myself. I just want some ready to
>use code, and I want it yesterday"

Sorry, I thought that saying "I know that if I spent time on it I could do
it myself, but I have a really close deadline and if anyone else has been
through this I would *really* appreciate the help..." was fairly clear.

Anyway, my apologies to Jay for being short and my thanks to Richard, whose
code kinda worked and did save me some time.

Mikey

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



Re: [PHP] Extending a Class

2005-01-24 Thread Jason Barnett
Matthew Weier O'Phinney wrote:
* Phillip S. Baker <[EMAIL PROTECTED]>:
...
The object *instance* only gets to access the overridden method (assuming
it's an instance of the child class):
$instance->someMethod();
This is 100% correct, but just to clarify: it is possible to do 
something like this:

class myParent
{
  function someMethod()
  {
return "I am myParent.\n";
  }
}
class myChild extends myParent
{
  function someMethod()
  {
echo parent::someMethod();
echo "I am myChild\n";
  }
}
$instance = new myChild();
$instance->someMethod();
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY | 
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

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


Re: [PHP] Allowing Users to Edit HTML

2005-01-24 Thread Richard Lynch
> Do these methods seem reasonably secure?  Am I missing something?  The
> risk is minimized by the fact that the HTML the user enters is
> displayed to their own customers, whom they presumably don't want to
> attack (and if they did they could just do it on their own web site).
> But I still want to avoid as many opportunities as possible for either
> inadvertent or deliberate errors to cause trouble.

Assuming you are authenticating them correctly so that a Bad Guy can't
change the HTML out from under them, it seems reasonable to me -- Not much
point to cross-site vandalism on one's own site, eh?

-- 
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] Maxing out sessions?

2005-01-24 Thread Richard Lynch
Matt wrote:
> That's actually a great idea... I know how to log sessionId... but how
> would I go about logging why the session couldn't be started (I'm sure
> that would lead me on somewhat of a track of the issue...)... like is
> there a variable I should read, or where do I get that information
> from?

Well...

session_start() may or may not have a return code to check, and may or may
not set some kind of error message somewhere...

You could find that in the manual, of course.

After that, you may want to log some info about the session itself that's
about to fail -- Or rather, information about the request and referer and
the current state of variables/data that came with this session failure.

You probably don't want to dump *everything* that has been input, but it
might be instructive to log all the cookies they *DO* have, just to see if
you've got something going on where a link to/from 'www.example.com' and
'example.com' are messing you up, or...

Just some ideas to toss out -- On the plus side, there can only be so many
things already 'set' in terms of variables, since it's messing up before
you even start the session.

-- 
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] Maxing out sessions?

2005-01-24 Thread Richard Lynch
Matt wrote:
> [EMAIL PROTECTED] tmp]$ cat /proc/sys/fs/file-max
> 52403

To be 100% certain this ain't the problem, do something like:
exec("ls /tmp/ | wc -l", $result, $error);
if ($error){
  error_log("Attempt to count number of sessions failed: $error" .
implode("", $result));
}
else{
  error_log("Currently there are " . implode($result) . " sessions");
}

The goal being to make absolutely certain that there are not more than
52403 files in /tmp when things fail...  Of course, between the time it
fails and the time you do the exec() a bunch of /tmp files could
appear/disappear, but hopefully you'll find out quickly if you're in the
same ballpark as 52K files in the directory.

This is probably *NOT* really the problem, just one example of something
which *could* be going on.

PS  Try to write any code that error-checks the session_start() as REAL
code, not just debugging junk you'll rip out.  Error-checking is Good. :-)

-- 
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] Maxing out sessions?

2005-01-24 Thread Richard Lynch
> On Mon, 24 Jan 2005 16:22:23 -0500, Matt <[EMAIL PROTECTED]> wrote:
>> /tmp is not it's own partition... but I have 6Gig free on the / drive.
>> Right now I have 401 sessions and am pushing 2Gig on the /tmp directory.

Re-reading this...

If you've got 2Gig in /tmp, on a 6Gig free drive, I'd say that's an awful
LOT of /tmp activity...  Maybe I'm just being naive here, though, and
that's perfectly normal for a busy site.

Is the whole / partition < 60 Gig?

It's kind of Good Practice (so I've been told) to be sure you have 10%
hard drive space free for each partition at any given time...

Another idea for ya:

Try setting up PHP to use trans_sid stuff -- so the Session ID is passed
via the URL instead of Cookies, and see if that has any effect.  If you
can isolate the problem to Cookies or No Cookies being involved, you've
whacked away a very large portion of "things that could be wrong" if you
know what I mean :-)

You'll probably want to do this on a Development server and throw ab at
it, assuming you can reproduce the problem that way in the first place...

Or you might be able to transition with both Cookies and URL passsing of
the session ID for while, then switch to just URL, so that users don't
experience any discontinuity...

-- 
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] String to Date and Date to String Functions?

2005-01-24 Thread Ben Edwards
On Mon, 24 Jan 2005 19:22:40 -, Ford, Mike <[EMAIL PROTECTED]> wrote:
> To view the terms under which this email is distributed, please go to 
> http://disclaimer.leedsmet.ac.uk/email.htm
> 
> 
> On 24 January 2005 17:04, Ben Edwards wrote:
> 
> > On Mon, 24 Jan 2005 10:38:03 -0600, Jay Blanchard
> > <[EMAIL PROTECTED]> wrote:
> > > [snip]
> > >
> > > String to Date Function
> > > 
> > > return date stringToDate( str Date, str Format )
> > > e.g. $todayDt = stringToDate( '01/01/2003','DD/MM/' );
> > >
> > > Date to String Function
> > > 
> > > return str dateToString( date Date, str Format )
> > > e.g. $todayStr = dateToString ( $todayDt,'DD/MM/' );
> > >
> > > Anyone know of any functions that do this or have pointers as to
> > > how it can be done. [/snip]
> > >
> > > You've looked at http://www.php.net/date ?
> > >
> > Yes.  It douse the dateToString bit but how do I do the reverse.  I
> > can use it to convert a timestamp to a string but how do I convert a
> > string to a timestamp.
> 
> Right at the top of the description of date(), the second Note reads:
> 
>Note: To generate a timestamp from a string representation of the
>date, you may be able to use strtotime().

As I have said in a previous email to date function takes a format
string and the strtodate douse not.  Therefore the strtodate() only
works on a small subset of what date() can produce.  The format I am
interested in is DD-MM- which is the way dates are specified in
the UK, strtodate() cant handle this.  strtodate is not the reverse of
date.

Your email address seems to indicate you are in the UK - so you may of
come across the way UK dates are normaly specified;)

Ben
 
> This should give you a clue.
> 
> 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
> 


-- 
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)

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



Re: Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Ben Edwards
On Mon, 24 Jan 2005 13:32:36 -0600, Jay Blanchard
<[EMAIL PROTECTED]> wrote:
> [snip]
> On Mon, 24 Jan 2005 12:58:52 -0500, [EMAIL PROTECTED] <[EMAIL PROTECTED]> 
> wrote:
> > How about the strtotime() function?
> > http://us4.php.net/manual/en/function.strtotime.php
> 
> No good, it douse not take a format string.  What if I wanted to
> convert the timestamp to 'DD-MM-YYY', display it on a form, validate
> it, and then convert it back to a timestamp.
> 
> I cant beleve the PHP date/time functions suck this bad;(
> [/snip]
> 
> Well, you could always write some extensions to PHP to cover it, as soon
> as you learn to spell does :)
> 

That is awfull grammer.  Ime dyslexic, whats your excuse.

Was wondering if someone else has writern the function, dont have time
at the mo and thought someone else may of.

Ben
-- 
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)

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



Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Jason Wong
On Tuesday 25 January 2005 08:07, Ben Edwards wrote:

> As I have said in a previous email to date function takes a format
> string and the strtodate douse not.  Therefore the strtodate() only
> works on a small subset of what date() can produce.  The format I am
> interested in is DD-MM- which is the way dates are specified in
> the UK, strtodate() cant handle this.  

If that is the *only* format you're interested in then why the argument 
'Format'? It's surplus to requirements.

> return str dateToString( date Date, str Format ) 

> strtodate is not the reverse of 
> date.

No, but it's not exactly hard to write a function to change DD-MM- into a 
timestamp. explode() should get you on your way, and examples abound in the 
archives.

The thing with PHP is that you're not limited to using the built-in functions, 
you can write your own (fancy that).

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
New Year Resolution: Ignore top posted posts

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



Re: Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Ben Edwards
On Mon, 24 Jan 2005 20:15:15 -, Ford, Mike <[EMAIL PROTECTED]> wrote:
> To view the terms under which this email is distributed, please go to 
> http://disclaimer.leedsmet.ac.uk/email.htm
> 
> On 24 January 2005 19:01, Ben Edwards wrote:
> 
> > On Mon, 24 Jan 2005 12:58:52 -0500, [EMAIL PROTECTED]
> > <[EMAIL PROTECTED]> wrote:
> > > How about the strtotime() function?
> > > http://us4.php.net/manual/en/function.strtotime.php
> >
> > No good, it douse not take a format string.  What if I wanted to
> > convert the timestamp to 'DD-MM-YYY', display it on a form, validate
> > it, and then convert it back to a timestamp.
> 
> Well, if you're going to validate it, you'll have to figure out which bits
> are the day, month and year -- having done that, you'll have them as three
> separate bits of information, so you can use mktime() on them, or glue them
> back together to feed to strtotime() in one of the various formats it
> recognizes.  Seems to me a format string is pretty irrelevant in all of
> this.

Different users have can have the date displayed in there local form. 
And no, I dont have to split the date up, the date() function should
be able to be used to validate the date.  I asume it returns null, or
something sensable, if the date is invalid.  Anyway as the date format
is user defined I need both functions.

> Speaking for myself personally, I would never accept a wholly textual date
> from a form -- I would have drop-downs for the day and month, and maybe also
> for the year depending on the valid range, and then it's a snap just to hand
> the resulting values to mktime().

In this case it is a back end administration form as the (power) user
does not want to have to fiddle about with drop downs.  In fact they
can use / or - or . as a seperater.  The split function can handle
that.

L8r,
ben

> 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
> 


-- 
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)

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



Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Jason Wong
On Tuesday 25 January 2005 08:09, Ben Edwards wrote:

> > Well, you could always write some extensions to PHP to cover it, as soon
> > as you learn to spell does :)
>
> That is awfull grammer.  Ime dyslexic, whats your excuse.

Does is spelt 'does' not 'douse', that grammar looks OK to me.

> Was wondering if someone else has writern the function, dont have time
> at the mo and thought someone else may of.

You could find some time to pay someone to search the archives for you to find 
the numerous examples of code which does that, or you could even pay someone 
to write the code for you.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP] String to Date and Date to String Functions?

2005-01-24 Thread Rick Fletcher
Ben Edwards wrote:
The format I am
interested in is DD-MM- which is the way dates are specified in
the UK, strtodate() cant handle this.
Ben, there is no (built in) string->timestamp function that takes a 
format.  strtotime() is pretty smart about interpreting your input, but 
it's limited to the GNU date input formats: 
http://www.gnu.org/software/tar/manual/html_chapter/tar_7.html

The topmost comment on the strtotime() manual page 
(http://us2.php.net/manual/en/function.strtotime.php) describes the 
function you're looking for, and links to it: 
http://www.evilwalrus.com/viewcode.php?codeEx=627

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


[PHP] Get full url

2005-01-24 Thread Dmitry
How?

Dont tell me about simple solutions such as
$_SERVER["HTTPS"] .
$_SERVER["REMOTE_ADDR"] .
$_SERVER["SERVER_PORT"] .
$_SERVER["PHP_SELF"] .
$_SERVER["QUERY_STRING"]

I want get really good solution.

Thanks. 

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



Re: [PHP] Get full url

2005-01-24 Thread John Holmes
Dmitry wrote:
How?
Dont tell me about simple solutions such as
$_SERVER["HTTPS"] .
$_SERVER["REMOTE_ADDR"] .
$_SERVER["SERVER_PORT"] .
$_SERVER["PHP_SELF"] .
$_SERVER["QUERY_STRING"]
I want get really good solution.
I want a million dollars and hot redheaded twin mistresses... we don't 
always get what we want, do we?

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Notice:Use of undefined constant

2005-01-24 Thread Jordi Canals
> 
> Wish List: PHP 6 uses E_ALL by default install.
> 

I wish E_ALL | E_STRICT

Regards,
Jordi.

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



Re: [PHP] Get full url

2005-01-24 Thread Justin

Dmitry wrote: in Re: [PHP] Get full url
How?
Dont tell me about simple solutions such as
$_SERVER["HTTPS"] .
$_SERVER["REMOTE_ADDR"] .
$_SERVER["SERVER_PORT"] .
$_SERVER["PHP_SELF"] .
$_SERVER["QUERY_STRING"]
I want get really good solution.

What does that even mean?
Possibly SCRIPT_URI + '?' + QUERY_STRING is what you want but the 
question pretty unclear. What about post variables or redirects for 
example. No mention of webserver or OS either.

If www.server.com/abc redirects on the serverside to www.server.com/xyz 
which url do you want?  Ask a better question.

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


[PHP] Id_num = ""

2005-01-24 Thread Steve Marquez
Greetings!

If I do the following, it gives me a blank page. However, instead of using
the variable, if I put in $id_num = "191" Then it will display the
information. 

Does anyone know what I am doing wrong? I hope you understand my question...

Thank you in advance!



Here is the link I use to this page:

view

---





Prayer for 













---

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



Re: [PHP] Extending a Class

2005-01-24 Thread Matthew Weier O'Phinney
* Jason Barnett <[EMAIL PROTECTED]>:
> Matthew Weier O'Phinney wrote:
> > * Phillip S. Baker <[EMAIL PROTECTED]>:
> ...
> > The object *instance* only gets to access the overridden method (assuming
> > it's an instance of the child class):
> > 
> > $instance->someMethod();
> > 
>
> This is 100% correct, but just to clarify: it is possible to do 
> something like this:
>
> class myParent
> {
>function someMethod()
>{
>  return "I am myParent.\n";
>}
> }
>
> class myChild extends myParent
> {
>function someMethod()
>{
>  echo parent::someMethod();
>  echo "I am myChild\n";
>}
> }
>
> $instance = new myChild();
> $instance->someMethod();

Which... if you'd read further in my post, I mentioned -- you typically
do this -- s you did in your example --  when in an overridden method
and need access to the parent class' version of the method.

-- 
Matthew Weier O'Phinney   | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org

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



Re: [PHP] PHP editor suggestion?

2005-01-24 Thread The Disguised Jedi
jEdit is one of the bestdownloadable PHP parser to check for
errors, recognizes syntax perfectly, and is free.

www.jedit.org

I LOVE IT!


On Mon, 24 Jan 2005 13:41:55 -0800, Christopher Fulton
<[EMAIL PROTECTED]> wrote:
> [quote]
> > I am looking for a relieable, stable and quick PHP/HTML editor.
> >
> > Can anybody suggest a good one? I tried phpdesigner, but it seems to
> > have lots of bugs and is quite slow.
> > 
> [/quote]
> 
> Just a suggestionA mailing list may not be the best place to find
> the answer for this question.  A person's choice in an editor is going
> to be different depending on who you talk to.  One person may love vi,
> whereas another person may love Dreamweaver.  If you read the
> archives, you'll see several responses going many different ways as to
> what editor is the best.  My suggestion would be to decide what are
> the most important things you want in an editor (ie...syntax
> highlighting, speed, a built in code debugger, cross platform
> compatibility, etc...).  Then, once you have decided what is
> "essential" for you, do a google search for editors with those things.
>  Try a few out, and decide what works best for you.
> 
> Happy Searching,
> Chris
> 
> ---
> Christopher Fulton
> http://www.fultonfam.com
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
The Disguised Jedi
[EMAIL PROTECTED]

PHP rocks!
"Knowledge is Power.  Power Corrupts.  Go to school, become evil"

Disclaimer: Any disclaimer attached to this message may be ignored.
This message is Certified Virus Free

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



[PHP] php 5.0.3 in httpd 2.0.52

2005-01-24 Thread bone
Hi there,
   Originally, I installed php 5.0.3 and httpd 2.0.51, it's fine, but when I
upgrade httpd to 2.0.52, php doesn't work, I try to re-configure php, got
errors below,

Sorry, I cannot run apxs.  Possible reasons follow:

1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)

The output of /usr/sbin/apxs follows:
sh: line 1: /usr/sbin/envvars: No such file or directory
apxs:Error: Sorry, no shared object support for Apache.
apxs:Error: available under your platform. Make sure.
apxs:Error: the Apache module mod_so is compiled into.
apxs:Error: your server binary `/usr/sbin/httpd'..
configure: error: Aborting
error: Bad exit status from /var/tmp/rpm-tmp.30018 (%build)


RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.30018 (%build)


I check phpinfo(), the configure  '--with-apxs2=/usr/sbin/apxs' , how can I
solve this problem


Thanks a lot.

-- 


¹ù½«©ú
http://www.bone.idv.tw


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



Re: [PHP] Id_num = ""

2005-01-24 Thread John Holmes
Steve Marquez wrote:
If I do the following, it gives me a blank page. However, instead of using
the variable, if I put in $id_num = "191" Then it will display the
information. 

view
Use $_GET['id_num'] instead of $id_num and read up on the 
register_globals setting.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: php 5.0.3 in httpd 2.0.52

2005-01-24 Thread bone
My configure

 './configure' '--host=i686-pc-linux-gnu' '--build=i686-pc-linux-gnu'
'--target=i386-redhat-linux' '--program-prefix=' '--prefix=/usr'
'--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin'
'--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include'
'--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var'
'--sharedstatedir=/usr/com' '--mandir=/usr/share/man'
'--infodir=/usr/share/info' '--cache-file=../config.cache'
'--with-libdir=lib' '--with-config-file-path=/etc'
'--with-config-file-scan-dir=/etc/php.d' '--enable-force-cgi-redirect'
'--disable-debug' '--enable-pic' '--disable-rpath'
'--enable-inline-optimization' '--with-bz2' '--with-db4=/usr' '--with-curl'
'--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr'
'--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp'
'--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png'
'--with-pspell' '--with-expat-dir=/usr' '--with-pcre-regex=/usr'
'--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-exif'
'--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode'
'--enable-sockets' '--enable-sysvsem' '--enable-sysvshm'
'--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx'
'--with-pear=/usr/share/pear' '--with-kerberos' '--enable-ucd-snmp-hack'
'--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-shmop'
'--enable-calendar' '--enable-dbx' '--enable-dio'
'--with-mime-magic=/usr/share/file/magic.mime' '--without-sqlite'
'--with-libxml-dir=/usr' '--with-xml' '--with-apxs2=/usr/sbin/apxs'
'--without-mysql' '--without-gd' '--without-odbc' '--disable-dom'

All php related packages
php-xml-5.0.3-1
php-odbc-5.0.3-1
php-ldap-5.0.3-1
php-5.0.3-1
php-xmlrpc-5.0.3-1
php-snmp-5.0.3-1
php-pear-5.0.3-1
php-ncurses-5.0.3-1
php-mysql-5.0.3-1
php-mbstring-5.0.3-1
php-imap-5.0.3-1
php-devel-5.0.3-1
php-soap-5.0.3-1
php-pgsql-5.0.3-1
php-gd-5.0.3-1

All httpd related packages
httpd-2.0.52-1
httpd-manual-2.0.52-1
httpd-devel-2.0.52-1

httpd compiled in modules
  core.c
  prefork.c
  http_core.c
  mod_so.c

Not all php function failed, but some key points are after upgrade httpd to
2.0.52, below are error messages,
PHP Warning:  preg_match: internal pcre_fullinfo() error -3 in
/var/www/data/forum/includes/sessions.php on line 392
[client 192.168.2.139] PHP Warning:  preg_match_all: internal
pcre_fullinfo() error -3 in /var/www/data/forum/includes/template.php on
line 295
preg_match: internal pcre_fullinfo() error -3 in
/var/www/data/tikiwiki-1.9.RC3.1/db/tiki-db.php on line 62
[client 192.168.2.139] PHP Fatal error:  Call to undefined function
ADONewConnection() in /var/www/data/tikiwiki-1.9.RC3.1/db/tiki-db.php on
line 104

phpbb -> 2.0.11 doesn't work after upgrade httpd
tikiwiki -> 1.9RC3.1 doesn't work after upgrade httpd

I've upgrade ADODB too today, but the same

OS: Fedora Core 1


"Bone" <[EMAIL PROTECTED]> ¦b¶l¥ó news:[EMAIL PROTECTED]
¤¤¼¶¼g...
> Hi there,
>Originally, I installed php 5.0.3 and httpd 2.0.51, it's fine, but when
I
> upgrade httpd to 2.0.52, php doesn't work, I try to re-configure php, got
> errors below,
> 
> Sorry, I cannot run apxs.  Possible reasons follow:
>
> 1. Perl is not installed
> 2. apxs was not found. Try to pass the path
using --with-apxs2=/path/to/apxs
> 3. Apache was not built using --enable-so (the apxs usage page is
displayed)
>
> The output of /usr/sbin/apxs follows:
> sh: line 1: /usr/sbin/envvars: No such file or directory
> apxs:Error: Sorry, no shared object support for Apache.
> apxs:Error: available under your platform. Make sure.
> apxs:Error: the Apache module mod_so is compiled into.
> apxs:Error: your server binary `/usr/sbin/httpd'..
> configure: error: Aborting
> error: Bad exit status from /var/tmp/rpm-tmp.30018 (%build)
>
>
> RPM build errors:
> Bad exit status from /var/tmp/rpm-tmp.30018 (%build)
> 
>
> I check phpinfo(), the configure  '--with-apxs2=/usr/sbin/apxs' , how can
I
> solve this problem
>
>
> Thanks a lot.
>
> -- 
>
> 
> ¹ù½«©ú
> http://www.bone.idv.tw
> 

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



[PHP] grabbing the range

2005-01-24 Thread blackwater dev
Let's say I have 100 rows in the database, I need to loop throw them
ten at a time and for each set grab the max and min ages...I then need
to return a multi-dimensional array of all the ranges...I basically
want to do this but of course this query won't work:

***this is just pseudo code***

I would run this query for each set and return max and min ages into the array.

 select max(age) as max_age, min(age) as min_age
  from customers  limit 10,20;

How should I do this?  Do I have to run a query like this:
   select  age from customers limit 10,20 

and loop through the result set putting all these values into an array
and then pull the min and max out of the array?
 
Hope this makes sense.

Thanks!

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



Re: [PHP] Id_num = ""

2005-01-24 Thread Santa
> $id_num = $_POST["id_num"];
$id_num = $_GET['id_num'];

RTFM -> diffrent between _GET & _POST

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



Re: [PHP] Get full url

2005-01-24 Thread Santa
В сообщении от Вторник 25 Январь 2005 04:31 Dmitry написал(a):
> How?
>
> Dont tell me about simple solutions such as
> $_SERVER["HTTPS"] .
> $_SERVER["REMOTE_ADDR"] .
> $_SERVER["SERVER_PORT"] .
> $_SERVER["PHP_SELF"] .
> $_SERVER["QUERY_STRING"]
>
> I want get really good solution.
>
> Thanks.

how about

$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] ?

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



Re: [PHP] Id_num = ""

2005-01-24 Thread Steve Slater

> $id_num = $_POST["id_num"];
$id_num = $_GET['id_num'];
RTFM -> diffrent between _GET & _POST
You can also use $_REQUEST['id_num'] if you don't care
how the variable gets there (GET, POST, or COOKIE).
Note that if the value is set in more than one input (say both a
GET and a COOKIE set id_num), the variables_order variable in
php.ini determines which one will overwrite the other.
Steve
--
Steve Slater
[EMAIL PROTECTED]
PHP / MySQL / Web App Security (LAMP) Training:
http://www.handsonsecurity.com/training.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: String to Date and Date to String Functions?

2005-01-24 Thread David Robley
On Tuesday 25 January 2005 03:01, Ben Edwards wrote:

> Being trying to work out haw to handle dates.  Basically I need a
> function to convert a Date to a String and another function to convert
> a string to a date.
> 
> Exactly what format the date is held in is not relevant as long as it
> is some type of  standard (i.e. Unix Timestamps).
> 
> Both the functions will require a format string (such ad DD/MM/YYY)
> and again the format/syntax of this is irrelevant, as long as they are
> the same for both .
> 
> String to Date Function
> 
> return date stringToDate( str Date, str Format )
> e.g. $todayDt = stringToDate( '01/01/2003','DD/MM/' );
> 
> Date to String Function
> 
> return str dateToString( date Date, str Format )
> e.g. $todayStr = dateToString ( $todayDt,'DD/MM/' );
> 
> Anyone know of any functions that do this or have pointers as to how
> it can be done.
> 
> Ben

Have you looked at date() and strtotime() ?

-- 
David Robley

How do you make Windows faster ? Throw it harder

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