OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 8 Dec 2005 16:20:32 -0000 Issue 3839

php-general-digest-helplists.php.net
Date: Thu Dec 08 2005 - 10:20:32 CST


php-general Digest 8 Dec 2005 16:20:32 -0000 Issue 3839

Topics (messages 227105 through 227148):

Re: ob_start & session_start
        227105 by: Joe Harman
        227107 by: Chris Shiflett
        227108 by: Zack Bloom
        227109 by: Joe Harman
        227111 by: Curt Zirzow
        227115 by: Chris Shiflett
        227120 by: Zack Bloom
        227121 by: Zack Bloom

Re: [PHP-DB] ftp_put
        227106 by: Joe Harman

array carrying from one php page to another
        227110 by: Eternity Records Webmaster
        227112 by: Curt Zirzow
        227113 by: Ligaya Turmelle
        227114 by: Chris Shiflett
        227119 by: Zack Bloom
        227122 by: Curt Zirzow

Re: references, circular references, oop, and garbage collection in PHP5
        227116 by: Curt Zirzow
        227148 by: Alan Pinstein

broken code....
        227117 by: Eternity Records Webmaster
        227128 by: Jochem Maas

Re: Anyone getting bounces from
        227118 by: Curt Zirzow
        227123 by: David Robley

Re: What software do you use for writing PHP?
        227124 by: David Robley
        227125 by: David Robley
        227126 by: David Robley
        227130 by: Zack Bloom

Re: Class Constant PHP 5
        227127 by: Jochem Maas
        227139 by: Jay Blanchard

Re: Non-trivial task of converting text to HTML
        227129 by: Jochem Maas
        227146 by: Eric Gorr
        227147 by: David Grant

Re: PHP Warning: imagettftext() expects parameter 2 to be double
        227131 by: Jochem Maas

Re: Multiple callback_outputs for ob_start
        227132 by: Jochem Maas

Call to undefined function mysql_real_escape_string()]
        227133 by: Paul Hickey
        227135 by: David Grant
        227136 by: Paul Hickey
        227137 by: David Grant
        227140 by: John Nichel
        227141 by: John Nichel
        227142 by: David Grant

Mime-type handling
        227134 by: Manuel Vacelet

Re: Preventing Cross Site Scripting Vulnerbilities
        227138 by: Marco Kaiser
        227143 by: Ford, Mike

PEAR Validate email question
        227144 by: Eric Butera
        227145 by: David Grant

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Okay.. makes sense after you spelled it out to me... LOL... I always
start my session first.. so, that must why i have never had any
problems

Cheers & Thanks!
Joe

On 12/7/05, Zack Bloom <zackbloomgmail.com> wrote:
> yes, it will display the content in the buffer before creating the session.
> If your session uses cookies (this is usually automatically decided by php)
> it cannot send out the header after the buffer.
>
>
> On 12/7/05, Joe Harman <cjharmangmail.com> wrote:
> >
> > Hello,
> >
> > Something just crossed my mind about using output buffering.... is
> > there any reason why you should start a session before calling
> > ob_start() ???
> >
> > Just curious which way would be the proper way of doing it... or
> > doesn't it matter?
> >
> > Thanks
> >
> > --
> > Joe Harman
> > ---------
> > * My programs never have bugs, they just develop random features.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>

--
Joe Harman
---------
* My programs never have bugs, they just develop random features.

attached mail follows:


Joe Harman wrote:
> Okay...makes sense after you spelled it out to me.

That didn't make sense to me (and I missed the original reply). Mind
elaborating? :-)

Chris

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

attached mail follows:


Sure, ob_start begins a buffer allowing you to display content in the
browser before your script has finished executing. This is useful when
loading a time intensive page to tell the user to wait. When you create a
session (provide php is not configured otherwise) php attempts to store a
cookie with the session id that corisponds to the session file on the
server. If it cannot set this cookie it appends the session id to pages in
the get format. If you were to call session_start() after the output
buffering, content and consequentially the headers would have been already
sent to the browser. Since cookies must be set in the headers and the
headers must be set before any content is sent to the page, to use cookie
based sessions you must begin the session before the buffer.

Hope that cleared it up,

Zack Bloom

 On 12/8/05, Chris Shiflett <shiflettphp.net> wrote:
>
> Joe Harman wrote:
> > Okay...makes sense after you spelled it out to me.
>
> That didn't make sense to me (and I missed the original reply). Mind
> elaborating? :-)
>
> Chris
>
> --
> Chris Shiflett
> Brain Bulb, The PHP Consultancy
> http://brainbulb.com/
>
> --
> PHP General Mailing List ( http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


I guess this was just out of general curiousity... If you started
'session_start()' after 'ob_start()' would the sessions work
correctly? k.. maybe I am still confused... lol... I normally do
session_start() before the ob_start()...

----
Zack Said : 'yes, it will display the content in the buffer before
creating the session. If your session uses cookies (this is usually
automatically decided by php) it cannot send out the header after the
buffer.'
----

So, the question is really... in what order is the best way to do
this... I would think that you always want to start a session first...
but then again, you guys are the experts... i am sure someone knows a
reason when you should not do that.

;o)
Joe

On 12/8/05, Chris Shiflett <shiflettphp.net> wrote:
> Joe Harman wrote:
> > Okay...makes sense after you spelled it out to me.
>
> That didn't make sense to me (and I missed the original reply). Mind
> elaborating? :-)
>
> Chris
>
> --
> Chris Shiflett
> Brain Bulb, The PHP Consultancy
> http://brainbulb.com/
>

--
Joe Harman
---------
* My programs never have bugs, they just develop random features.

attached mail follows:


On Thu, Dec 08, 2005 at 01:23:40AM -0500, Joe Harman wrote:
>
> So, the question is really... in what order is the best way to do
> this... I would think that you always want to start a session first...
> but then again, you guys are the experts... i am sure someone knows a
> reason when you should not do that.

The first thing I would ask is why are you using/need ob_start().

session_start() should be the first thing that happens in most
cases. Since, well, any code that exist is potentially going to
rely on a session state.

If you are trying to use ob_start() to rid of the common error
'headers already sent in some_file.php on line such and such', i
would first consider why that is causing the error and how can you
call session_start() before that happens.

Since '97 i think i've used ob_start twice, in all my php apps, and
that was cause I wanted to filter the output either with tidy or
modify the data in a very obscure way.

Curt.
--
cat .signature: No such file or directory

attached mail follows:


Zack Bloom wrote:
> Sure, ob_start begins a buffer allowing you to display content in
> the browser before your script has finished executing.

Calling ob_start() turns on PHP's output buffering. In other words, it
buffers output from the moment this function is called until the buffer
is flushed (whether explicitly or because the script finishes).

As long as PHP is buffering the output, the client can't get it.

> This is useful when loading a time intensive page to tell the user
> to wait.

I think you might be thinking of flush(), which flushes PHP's output
buffer as well as the output buffer of the web server (or whatever
backend PHP is using).

> When you create a session (provide php is not configured otherwise)
> php attempts to store a cookie with the session id that corisponds
> to the session file on the server. If it cannot set this cookie it
> appends the session id to pages in the get format.

Yeah, PHP includes a Set-Cookie header in its response. If
session.use_trans_sid is enabled, it will also rewrite URLs to include
the session identifier. When PHP receives a request that includes a
session identifier, it knows whether the client accepts cookies.

if (session identifier in cookie)
{
     cookies enabled
}
elseif (session identifier in URL)
{
     cookies disabled
}
else
{
     new user
}

> If you were to call session_start() after the output buffering,
> content and consequentially the headers would have been already
> sent to the browser.

Maybe you're getting the buffering and flushing concepts reversed? Think
of a toilet - buffering is the handle up, and flushing is the handle
down. :-)

Hope that helps!

Chris

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

attached mail follows:


I have never tried it but if it did work i doubt it would use cookies, it
would probably pass it in the addresses or throw an error.

On 12/8/05, Joe Harman <cjharmangmail.com> wrote:
>
> I guess this was just out of general curiousity... If you started
> 'session_start()' after 'ob_start()' would the sessions work
> correctly? k.. maybe I am still confused... lol... I normally do
> session_start() before the ob_start()...
>
> ----
> Zack Said : 'yes, it will display the content in the buffer before
> creating the session. If your session uses cookies (this is usually
> automatically decided by php) it cannot send out the header after the
> buffer.'
> ----
>
> So, the question is really... in what order is the best way to do
> this... I would think that you always want to start a session first...
> but then again, you guys are the experts... i am sure someone knows a
> reason when you should not do that.
>
> ;o)
> Joe
>
>
>
>
> On 12/8/05, Chris Shiflett <shiflettphp.net> wrote:
> > Joe Harman wrote:
> > > Okay...makes sense after you spelled it out to me.
> >
> > That didn't make sense to me (and I missed the original reply). Mind
> > elaborating? :-)
> >
> > Chris
> >
> > --
> > Chris Shiflett
> > Brain Bulb, The PHP Consultancy
> > http://brainbulb.com/
> >
>
>
> --
> Joe Harman
> ---------
> * My programs never have bugs, they just develop random features.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Sorry it looked like the rest of your email was part of the previous one.
To answer your question it is better to call session_start() before
ob_start()

On 12/8/05, Zack Bloom <zackbloomgmail.com> wrote:
>
> I have never tried it but if it did work i doubt it would use cookies, it
> would probably pass it in the addresses or throw an error.
>
> On 12/8/05, Joe Harman <cjharmangmail.com> wrote:
> >
> > I guess this was just out of general curiousity... If you started
> > 'session_start()' after 'ob_start()' would the sessions work
> > correctly? k.. maybe I am still confused... lol... I normally do
> > session_start() before the ob_start()...
> >
> > ----
> > Zack Said : 'yes, it will display the content in the buffer before
> > creating the session. If your session uses cookies (this is usually
> > automatically decided by php) it cannot send out the header after the
> > buffer.'
> > ----
> >
> > So, the question is really... in what order is the best way to do
> > this... I would think that you always want to start a session first...
> > but then again, you guys are the experts... i am sure someone knows a
> > reason when you should not do that.
> >
> > ;o)
> > Joe
> >
> >
> >
> >
> > On 12/8/05, Chris Shiflett <shiflettphp.net > wrote:
> > > Joe Harman wrote:
> > > > Okay...makes sense after you spelled it out to me.
> > >
> > > That didn't make sense to me (and I missed the original reply). Mind
> > > elaborating? :-)
> > >
> > > Chris
> > >
> > > --
> > > Chris Shiflett
> > > Brain Bulb, The PHP Consultancy
> > > http://brainbulb.com/
> > >
> >
> >
> > --
> > Joe Harman
> > ---------
> > * My programs never have bugs, they just develop random features.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>

attached mail follows:


Hi Chris... sometimes there is no replacement for a FTP program... but
you can use INI_SET() at in your PHP file to temporarily set the file
upload size. i think you will have to change the time out settings
also

look at the manual on ini_set... also search this list for ini_set

even better... take a look at this http://www.radinks.com/upload/config.php

Joe

On 12/8/05, Chris Payne <chrisartistwd.com> wrote:
> Hi there everyone,
>
>
>
> I'm using FTP to upload a file from a form, the information is stored in a
> MySQL DB and then FTP'd to the server. Is it possible - without altering
> the php.ini file as I don't have access to this on my clients server - to be
> able to upload large files rather than small ones? I know with POST there
> are limits, but we're talking about megabytes rather than KB's needing to be
> uploaded. They HAVE to be uploaded via some kind of form as it sends the
> data to a database such as the file name and location so that it can easily
> be found by the system otherwise I'd just tell them to use normal FTP
> software.
>
>
>
> What's the best way of achieving this? I'm talking file 5-20megs in size.
>
>
>
> Thanks everyone.
>
>
>
> Chris
>
>
>

--
Joe Harman
---------
* My programs never have bugs, they just develop random features.

attached mail follows:


I have an array $journal that I want to carry from a page (where it was
created) to another page (a popup that shows the variables contents). Is
this automatically available? or do I have to do something special to php??

attached mail follows:


On Thu, Dec 08, 2005 at 01:33:52AM -0500, Eternity Records Webmaster wrote:
> I have an array $journal that I want to carry from a page (where it was
> created) to another page (a popup that shows the variables contents). Is
> this automatically available? or do I have to do something special to php??

It can be sort of automatically:

<?php
$array = array('my', 'list', 'of', 'stuff');
$_SESSION['array_for_popup'] = $array;
?>

And in the code that is called in the popup:

<?php
if(!isset($_SESSION['array_for_popup']) {
  die('you should not be here anyway, only on a popup is this allowed');
}

$array = $_SESSION['array_for_popup'];
// .. do your magic.

// optionally clean things up. so the session var is removed.
unset($_SESSION['array_for_popup']);
?>

Curt.
--
cat .signature: No such file or directory

attached mail follows:


Session variable or hidden field maybe

Eternity Records Webmaster wrote:
> I have an array $journal that I want to carry from a page (where it was
> created) to another page (a popup that shows the variables contents). Is
> this automatically available? or do I have to do something special to php??
>

--

life is a game... so have fun.

attached mail follows:


Curt Zirzow wrote:
> <?php
> $array = array('my', 'list', 'of', 'stuff');
> $_SESSION['array_for_popup'] = $array;
> ?>
>
> And in the code that is called in the popup:
>
> <?php
> if(!isset($_SESSION['array_for_popup']) {
> die('you should not be here anyway, only on a popup is this allowed');
> }
>
> $array = $_SESSION['array_for_popup'];
> // .. do your magic.
>
> // optionally clean things up. so the session var is removed.
> unset($_SESSION['array_for_popup']);
> ?>

Don't forget session_start(). :-)

(You might have session.auto_start enabled, but it's not by default.)

Chris

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

attached mail follows:


you could just pass in in the address, eg:
www.example.com?var1=$var1&var2=$var2

to get them use $_REQUEST['var1']

to pass an array you could use serialize($var1) and unserialize($var1)

On 12/8/05, Chris Shiflett <shiflettphp.net> wrote:
>
> Curt Zirzow wrote:
> > <?php
> > $array = array('my', 'list', 'of', 'stuff');
> > $_SESSION['array_for_popup'] = $array;
> > ?>
> >
> > And in the code that is called in the popup:
> >
> > <?php
> > if(!isset($_SESSION['array_for_popup']) {
> > die('you should not be here anyway, only on a popup is this allowed');
> > }
> >
> > $array = $_SESSION['array_for_popup'];
> > // .. do your magic.
> >
> > // optionally clean things up. so the session var is removed.
> > unset($_SESSION['array_for_popup']);
> > ?>
>
> Don't forget session_start(). :-)
>
> (You might have session.auto_start enabled, but it's not by default.)
>
> Chris
>
> --
> Chris Shiflett
> Brain Bulb, The PHP Consultancy
> http://brainbulb.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


On Thu, Dec 08, 2005 at 02:39:46AM -0500, Zack Bloom wrote:
> you could just pass in in the address, eg:
> www.example.com?var1=$var1&var2=$var2
>
> to get them use $_REQUEST['var1']
>
> to pass an array you could use serialize($var1) and unserialize($var1)

Or just use http_build_query() (php5 only)

Curt.
--
cat .signature: No such file or directory

attached mail follows:


On Wed, Dec 07, 2005 at 09:30:36PM -0500, Alan Pinstein wrote:
>
> On Dec 7, 2005, at 12:36 AM, Curt Zirzow wrote:
> >
> >I'm not sure how you mean a weak reference, and well a refcount is
> >rather meaning less in php userland.
>
> So, this gets interesting. I don't know if you're familiar with the
> circular-reference problem. But if you have two instances that have
> references to each other, even once you remove all references to the
> objects, they will not be GC'd since they have a mutual deadlock on
> each other:
>
> $a = new MyObj;
> $b = new MyObj;
> $a->setB($b); // does $this->b = $b;
> $b->setA($a); // does $this->a = $a;
>
> $a = NULL;
> $b = NULL;
>
> The actual instances pointed to by $a and $b WILL NOT GET FREED HERE
> as you would *wish*. However this is expected behavior.

I would have to disagree with the 'as you would *wish*' part.

if I pass something to a function/method via copy (vs reference) i
would hardly expect code outside the function/method to affect
their existance.

>
> Only by changing MyObj to store "weak references", that is references
> to the objects that are NOT reference-counted, can you get the GC to
> free the instances.
>
> function setB(&$B) { $this->b = &$a; }
> function setA(&$B) { $this->a = &$b; }
>
> Now, the instances will be freed when the $a and $b are null'd out.

I think you meant to type:

  function setB(&$a) { $this->b = &$a; }
  function setA(&$b) { $this->a = &$b; }

And consider the definition written as:

  function setB(&$a) { $this->b = $a; }
  function setA(&$b) { $this->a = $b; }

does the $a = null; and $b = null; outside the class cause the
objects to get null'd inside the class as well?

> So, while I now feel more confident of how references act with
> respect to objects (which is, they act the same as they do for any
> variable), I still am not sure what "$this->this" is and why it
> worked so magically.

You lost me on your $this->this statement.

Curt.
--
cat .signature: No such file or directory

attached mail follows:


/* comments inline */

On Dec 8, 2005, at 2:34 AM, Curt Zirzow wrote:

> On Wed, Dec 07, 2005 at 09:30:36PM -0500, Alan Pinstein wrote:
>>
>> On Dec 7, 2005, at 12:36 AM, Curt Zirzow wrote:
>>>
>>> I'm not sure how you mean a weak reference, and well a refcount is
>>> rather meaning less in php userland.
>>
>> So, this gets interesting. I don't know if you're familiar with the
>> circular-reference problem. But if you have two instances that have
>> references to each other, even once you remove all references to the
>> objects, they will not be GC'd since they have a mutual deadlock on
>> each other:
>>
>> $a = new MyObj;
>> $b = new MyObj;
>> $a->setB($b); // does $this->b = $b;
>> $b->setA($a); // does $this->a = $a;
>>
>> $a = NULL;
>> $b = NULL;
>>
>> The actual instances pointed to by $a and $b WILL NOT GET FREED HERE
>> as you would *wish*. However this is expected behavior.
>
> I would have to disagree with the 'as you would *wish*' part.
>
> if I pass something to a function/method via copy (vs reference) i
> would hardly expect code outside the function/method to affect
> their existance.

I'll ask you to reconsider :) Let me explain...

After both $a and $b are set to null, your script NO LONGER HAS ANY
REFERENCES TO $a OR $b! The objects are now "orphaned" as far as you
are concerned. So if you cannot access the objects, why would you
still want them to take up memory?

This is why I say "as you would *wish*. The fact that the objects are
not freed here is a memory leak. Now, the party responsible for the
memory leak is the coder, NOT PHP. PHP is doing the "right" thing
because according to its internal GC both $a and $b still have a
refcount of 1.

So, it is up to the developer to make sure that they code in such a
way that the objects do not have a refcount deadlock in such a
situation. This is the point of my entire thread; I want to confirm
the correct way to do this in PHP.

Apple's Cocoa documentation has a good explanation of this. Read the
sections "Retaining Objects", "Retain Cycles", and "Weak References"
that begin here. It's just a few paragraphs. Cocoa's memory
management and garbage collection is very similar in concept to
PHP's, except that you must EXPLICITLY control reference counts.

[ watch for wrapped link ]
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/
Concepts/ObjectOwnership.html#//apple_ref/doc/uid/20000043-1000698

>> Only by changing MyObj to store "weak references", that is references
>> to the objects that are NOT reference-counted, can you get the GC to
>> free the instances.
>>
>> function setB(&$B) { $this->b = &$a; }
>> function setA(&$B) { $this->a = &$b; }
>>
>> Now, the instances will be freed when the $a and $b are null'd out.
>
> I think you meant to type:
>
> function setB(&$a) { $this->b = &$a; }
> function setA(&$b) { $this->a = &$b; }

Oops yes.

> And consider the definition written as:
>
> function setB(&$a) { $this->b = $a; }
> function setA(&$b) { $this->a = $b; }
>
> does the $a = null; and $b = null; outside the class cause the
> objects to get null'd inside the class as well?

Well, this is different from what I wrote; you took away the &
operator on $a and $b in the assignment. This then causes the
refcounts to be bumped, so in the code as YOU'VE re-written it, in
fact nulling the objects outside the class DOES NOT cause them to be
released.

However, let's talk about the version I wrote:

> function setB(&$a) { $this->b = &$a; }
> function setA(&$b) { $this->a = &$b; }

In this case, nulling out the $a and $b that were passed in DOES in
fact release these linked objects. But that's OK, because you don't
have a way to access these objects anymore anyway, as described above.

Now, this example is just for explanatory purposes; typically you do
not have two objects that mutually store weak references to each
other. Typical, one side of the two-way link typically is the "owner"
and has a "refcounted" reference to the other object, while the other
side of the link has the weak reference to the other object. Normally
the parent object retains, and the child object has a weak reference.

>> So, while I now feel more confident of how references act with
>> respect to objects (which is, they act the same as they do for any
>> variable), I still am not sure what "$this->this" is and why it
>> worked so magically.
>
> You lost me on your $this->this statement.

Well, in reality, with a parent-child situation, you have

$a->addChildObject($b);

class A
{
    function addChildObject($b)
    {
       $this->children[] = $b; // refcount+1
       $b->setParent($this);
    }
}
class B
{
    function setParent(&$b)
    {
        $this->parent = &$b;
    }
}

However, I tried this, and it doesn't work. The $b->setParent($this)
line still bumps the refcount. After experimenting, I realize that if
I do $b->setParent($this->this) then it works as expected.

But what the heck is $this->this?

And this is my question, why does this work? Can I count on it? Why
doesn't just referencing $this work as expected?

I understand that this is a bit complicated, as memory management
often is. But memory leaks are a big deal when writing PHP CLI
scripts that import say 75,000 records and leak 4k per iteration.

Alan

attached mail follows:


I have this code that doesnt print the db results like they should... it
uses pear::db package for the database. Was wondering if anybody can figure
out how come it doesnt work...

<?php
require_once 'DB.php';
error_reporting('E_ALL');

$db =& DB::connect('mysql://root:3987957localhost/eternityrecords');
if (PEAR::isError($db)) {
die($db->getMessage()); }
$results->query('select * from eternityrecords.journal');
if (PEAR::isError($results)) {
die($db->getMessage()); }
//test the results out..
?>
<table>
<?php
while($results->fetchInto($journal, DB_FETCHMODE_ASSOC)){
?>
<tr>
<td><?php echo $journal['ID']; ?></td>
<td> <?php echo $journal['Date']; ?> </td>
<td> <?php echo $journal['Subject']; ?> </td>
<td> <?php echo $journal['Entry']; ?> </td>
</tr>
<?php }?>
</table>
<?php
$db->disconnect();
?>

attached mail follows:


Eternity Records Webmaster wrote:
> I have this code that doesnt print the db results like they should... it

'like it should' means what exactly?

> uses pear::db package for the database. Was wondering if anybody can figure
> out how come it doesnt work...

what does not work?

>
> <?php
> require_once 'DB.php';
> error_reporting('E_ALL');
>
> $db =& DB::connect('mysql://root:3987957localhost/eternityrecords');
> if (PEAR::isError($db)) {
> die($db->getMessage()); }
> $results->query('select * from eternityrecords.journal');
> if (PEAR::isError($results)) {
> die($db->getMessage()); }
> //test the results out..
> ?>
> <table>
> <?php
> while($results->fetchInto($journal, DB_FETCHMODE_ASSOC)){
> ?>
> <tr>
> <td><?php echo $journal['ID']; ?></td>
> <td> <?php echo $journal['Date']; ?> </td>
> <td> <?php echo $journal['Subject']; ?> </td>
> <td> <?php echo $journal['Entry']; ?> </td>
> </tr>
> <?php }?>
> </table>
> <?php
> $db->disconnect();
> ?>
>

attached mail follows:


On Wed, Dec 07, 2005 at 08:36:05AM -0600, Jay Blanchard wrote:
> MAILER-DAEMONmlm.mariotti.lan ?
>
> I am getting failure notices out the wazoo for some very old messages to the
> general list.
>

expect some more of them, if you've sent a message recently. time
to get him/her unsubscribed..

Curt.
--
cat .signature: No such file or directory

attached mail follows:


Max Belushkin wrote:

> John Nichel wrote:
>> Jay Blanchard wrote:
>>> MAILER-DAEMONmlm.mariotti.lan ?
>>>
>>> I am getting failure notices out the wazoo for some very old messages
>>> to the
>>> general list.
>
> I am too.

<Waves hand in air> Ask me! Ask me!

No, I'm not getting them

Cheers
--
David Robley

A clean desk is a sign of a cluttered desk drawer.

attached mail follows:


John Nichel wrote:

> Miles Thompson wrote:
>> At 11:45 AM 12/7/2005, Jay Blanchard wrote:
>>
>>> [snip]
>>> > Two words .... punch cards. 'Nuff said.
>>> >
>>>
>>> Come on now Jay, we know you're old and all, but everyone knows that you
>>> cannot edit php with punch cards. Hanging chads will cause too many
>>> fatal errors. ;)
>>> [/snip]
>>>
>>>
>>> ROFLMMFAO!!!!
>>
>>
>> Why these clumsy interfaces?
>>
>> Just plug the Firewire in your ear!
>
> n00b
>
> ;)
>

Punch cards? Looxury. Toggle switches on the front of the computer....

Cheers
--
David Robley

Circular Definition: see Definition, Circular.

attached mail follows:


Jim Moseby wrote:

>>
>> Curt Zirzow wrote:
>> > On Tue, Dec 06, 2005 at 06:36:33PM +0100, M. Sokolewicz wrote:
>> >
>> >>Jason Petersen wrote:
>> >>
>> >>>On 12/6/05, Jeff McKeon <jmckeontelaurus.com> wrote:
>> >>>
>> >>>
>> >>>>Hey all,
>> >>>>
>> >>>>Forever now I've been using Frontpage for all my web work
>> including php.
>> >>>>I'm sure there's better software out there that is more suited to
>> >>>>writing and editing PHP pages. What do you all use?
>> >>>>
>> >>>
>> >>>
>> >>>Vim is my editor of preference. If I have to use Windows,
>> I usually go
>> >>>with
>> >>>Homesite (because I already have a licensed copy) or
>> Textpad (because it's
>> >>>better than Notepad).
>> >>>
>> >>>IDEs? Who needs 'em ;)
>> >>>
>> >>>Best,
>> >>>Jason
>> >>>
>> >>
>> >>same here :)
>> >>Vim on UNIX machines, and Textpad on Windows
>> >
>> >
>> > man you guys are wimps.. gvim on windows... :)
>>
>> Pffffttttt....'Edit' in DOS. ;)
>>
>
> (Pfffft * 2) 'edlin' in DOS. :P

(Pfffft * 3) SPF on IBM mainframe

Cheers
--
David Robley

You have two choices for dinner: Take it or Leave it.

attached mail follows:


John Nichel wrote:

> Jay Blanchard wrote:
>> [snip]
>>
>>>>>man you guys are wimps.. gvim on windows... :)
>>>>>
>>>>
>>>>Pffffttttt....'Edit' in DOS. ;)
>>>>
>>>>
>>>
>>>(Pfffft * 2) 'edlin' in DOS. :)
>>
>>
>> Infinitely recursive pfffffft.... A pencil and a piece of paper and
>> ringing people to describe the cool web site you've just drawn,
>> [/snip]
>>
>> Two words .... punch cards. 'Nuff said.
>>
>
> Come on now Jay, we know you're old and all, but everyone knows that you
> cannot edit php with punch cards. Hanging chads will cause too many
> fatal errors. ;)
>

Suitable underware will prevent hanging... oh wait, he said _chads_

Cheers
--
David Robley

If little else, the brain is an educational toy.

attached mail follows:


I wish I had the punch card version. I have to rewire my php box everytime
I want to change something.

On 12/8/05, David Robley <robleydozemail.com.au> wrote:
>
> John Nichel wrote:
>
> > Miles Thompson wrote:
> >> At 11:45 AM 12/7/2005, Jay Blanchard wrote:
> >>
> >>> [snip]
> >>> > Two words .... punch cards. 'Nuff said.
> >>> >
> >>>
> >>> Come on now Jay, we know you're old and all, but everyone knows that
> you
> >>> cannot edit php with punch cards. Hanging chads will cause too many
> >>> fatal errors. ;)
> >>> [/snip]
> >>>
> >>>
> >>> ROFLMMFAO!!!!
> >>
> >>
> >> Why these clumsy interfaces?
> >>
> >> Just plug the Firewire in your ear!
> >
> > n00b
> >
> > ;)
> >
>
> Punch cards? Looxury. Toggle switches on the front of the computer....
>
>
>
> Cheers
> --
> David Robley
>
> Circular Definition: see Definition, Circular.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> Jim Moseby wrote:
>
> >>
> >> Curt Zirzow wrote:
> >> > On Tue, Dec 06, 2005 at 06:36:33PM +0100, M. Sokolewicz wrote:
> >> >
> >> >>Jason Petersen wrote:
> >> >>
> >> >>>On 12/6/05, Jeff McKeon <jmckeontelaurus.com> wrote:
> >> >>>
> >> >>>
> >> >>>>Hey all,
> >> >>>>
> >> >>>>Forever now I've been using Frontpage for all my web work
> >> including php.
> >> >>>>I'm sure there's better software out there that is more suited to
> >> >>>>writing and editing PHP pages. What do you all use?
> >> >>>>
> >> >>>
> >> >>>
> >> >>>Vim is my editor of preference. If I have to use Windows,
> >> I usually go
> >> >>>with
> >> >>>Homesite (because I already have a licensed copy) or
> >> Textpad (because it's
> >> >>>better than Notepad).
> >> >>>
> >> >>>IDEs? Who needs 'em ;)
> >> >>>
> >> >>>Best,
> >> >>>Jason
> >> >>>
> >> >>
> >> >>same here :)
> >> >>Vim on UNIX machines, and Textpad on Windows
> >> >
> >> >
> >> > man you guys are wimps.. gvim on windows... :)
> >>
> >> Pffffttttt....'Edit' in DOS. ;)
> >>
> >
> > (Pfffft * 2) 'edlin' in DOS. :P
>
> (Pfffft * 3) SPF on IBM mainframe
>
>
> Cheers
> --
> David Robley
>
> You have two choices for dinner: Take it or Leave it.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Jay,

gonna have to correct you on this lot.... (sorry ;-)

Jay Blanchard wrote:
> [snip]
> is there a way to dynamically define a class constant during runtime
> in PHP 5?
>
> for example I would like to achieve the result of something like:
>
> class Example {
> const FOO = bar();
> }
>
> However this would obviously give a parse error.
>
> I know it is possible with variables but I would like it to be a
> constant.
> [/snip]
>
> Well, first of all the syntax you describe above does not define a constant
> at all, you would need to use define()

the syntax is fine (apart from the function call which is illegal where it is),
it defines a class constant. e.g.

<?php

class Test
{
        const MY_CLASS_CNST = 'qux';
}
echo Test::MY_CLASS_CNST;

?>

which is legal.

>
> The second thing is good old basic OOP theory, you should declare a private
> static variable

... with a public static getter method (so that value can be reached from outside
the class, just like a class constant can)

>
> http://us3.php.net/private
> http://us3.php.net/manual/en/language.oop5.static.php

I agree that this is the sane/correct way to do what the OP wants.
there is one alternative (but it comes with big neon warning signs):

http://php.net/manual/en/function.runkit-constant-redefine.php

runkit is very very clever - lots of rope to hang yourself - use at
your own risk :-)

>
> Of course you could define a global constant and then pass it into your
> object when instantiating it, but that is a bad idea generally.
>
> Thirdly, you could never use a function to derive your constant value...it
> would then be an oxymoron. If the value generated by the function bar()
> changes, FOO is a variable. Constants are for simple values. For instance,
> we can all agree that pi is 3.14159 (to 5 decimal places, so defining a
> constant pi makes sense;
>
> define("PI", 3.14159);
>
> If we do not know what the outcome of a function will be it makes the value
> of the outcome a variable, always. It would be foolish (and would fail
> anyhow) to do something like this;
>
> define("RANDOM", rand(5,12));

it doesn't fail and is not imho foolish by definition ... the value of the constant,
although changing stays the same for the duration of the request,

IIRC Rasmus himself once mentioned that it can be useful to be able to set
a constant to a 'dynamic' value like this - nuff said really :-)

>

attached mail follows:


[snip]
it doesn't fail and is not imho foolish by definition ... the value of the
constant,
although changing stays the same for the duration of the request,

IIRC Rasmus himself once mentioned that it can be useful to be able to set
a constant to a 'dynamic' value like this - nuff said really :-)
[/snip]

Thanks for the education there Jochem, I'd forgotten about const mostly
because I am in the habit of declaring private static variables and using
get and set methods for this kind of thing because I do a lot of C++ work
too and the theory holds up in both languages. And it is correct in the fact
that a class constant cannot contain a function (as I hadn't clearly stated
earlier) as the OP had requested, the syntax would fail.

I guess that I am old school enough (I see John Nichel's hands racing to the
keyboard now!) that expect a constant to be just that. The concept of a
changing constant is what we would normally call a variable. I suppose that
a holy war could ensue over this. In the end a class constant is constant
and its visibility is public.

For the OP I found the following manual page;

http://us2.php.net/manual/en/language.oop5.constants.php

attached mail follows:


Roman Ivanov wrote:
> Task:
> Create a script that converts text into HTML with paragraphs.
>
> Problem:
> Input text could use the book notation, as well as the web notation,
> plus it can contain HTML.
>
> ==
> <h1>This is a title</h1>
>
> This is a Book paragraph.
> This is another book paragraph.
> This is yet another book paragraph, but it's not indented with spaces,
> because user wrote it in OpenOffice.
> ==
>
> ==
> This is a web paragraph.
>
> This is another web paragraph.

what is a book paragraph, what is a web paragraph? (exactly)

have you looked at the Tidy extension? in short it kicks ass
at cleaning up junk HTML - possibly a good start.

>
> This is yet another web paragraph, which is indented with spaces for
> some unknown reason.
> ==
>
> Output text should be correctly formatted without using lots of br's and
> &nbsp;'s. Doing so manually is not a problem, I would just use <p> for
> web paragraphs, and <p class="book"> for book paragraphs. However,
> formatting such text with a scrip is very difficult. Does anyone knows a
> good exaple of such script?
>

attached mail follows:


Quoting Roman Ivanov <gamblergluckyahoo.com>:

> Eric Gorr wrote:
>> Quoting Roman Ivanov <gamblergluckyahoo.com>:
>>
>>> Output text should be correctly formatted without using lots of
>>> br's and &nbsp;'s. Doing so manually is not a problem, I would just
>>> use <p> for web paragraphs, and <p class="book"> for book
>>> paragraphs. However, formatting such text with a scrip is very
>>> difficult. Does anyone knows a good exaple of such script?
>>
>>
>> How do you intend to distinguish between a web paragraph and a book
>> paragraph?
>
> Good question. I don't know. If I would know, than writing scipt
> would be simple. It would be interesting to hear how other developers
> deal with such kind of things.
>
>> How can you even accomplish this manually?
>
> By reading the text. *smiley*

Based on the samples you provides, it is unclear how you can
distinguish between
the two based on reading the text without an understanding of what the text is
saying.

If you are seeking an algorithm that can accurately determine what the text is
saying and make a decision on how to proceed, I am afraid you won't find
anything.

attached mail follows:


Hi Roman,

Check out this: http://www.michelf.com/projects/php-markdown/

Would this help you?

Cheers,

David

Roman Ivanov wrote:
> Task:
> Create a script that converts text into HTML with paragraphs.
>
> Problem:
> Input text could use the book notation, as well as the web notation,
> plus it can contain HTML.
>
> ==
> <h1>This is a title</h1>
>
> This is a Book paragraph.
> This is another book paragraph.
> This is yet another book paragraph, but it's not indented with spaces,
> because user wrote it in OpenOffice.
> ==
>
> ==
> This is a web paragraph.
>
> This is another web paragraph.
>
> This is yet another web paragraph, which is indented with spaces for
> some unknown reason.
> ==
>
> Output text should be correctly formatted without using lots of br's and
> &nbsp;'s. Doing so manually is not a problem, I would just use <p> for
> web paragraphs, and <p class="book"> for book paragraphs. However,
> formatting such text with a scrip is very difficult. Does anyone knows a
> good exaple of such script?
>

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

attached mail follows:


Jeffrey Sambells wrote:
> You've got 83px in you XML file for the fontsize. the 'px' is messing
> it up change it to just 83 in the XML file or cast the value to (float)
> which will extract the 83 and remove the px:

well spotted Jeffery; James didn't I say to var_dump() the vars you
create inside the loop?? print_r() and var_dump() are your friends!

>
> <snip>
> foreach ($xml->textblock as $text) {
>
> $fontsize=(float)$text->fontsize;
> $fontangle=(float)$text->fontangle;
> $fontxpos=(int)$text->fontxpos;
> $fontypos=(int)$text->fontypos;
> $text=$text->text;

i.e.

var_dump($fontsize, $fontangle, $fontxpos, $fontypos, $text);

>
>
> imagettftext($image['png'],$fontsize,$fontangle,$fontxpos,$fontypos,$fon
> t['color'],$font['type'],"$text",array());

one other thing, there is no point in writing:

"$text"

the quotes have no use (assuming $text is a string), in
fact its a [very small] waste of processing power.

>
> }
> </snip>
>
> - Jeff
>
> On 7-Dec-05, at 7:06 AM, James wrote:
>
>> Hi,
>>
>> Thank you for getting back to me, your the first.
>>
>> The array works fine – I have tested it using var_dump().
>>
>> Attached are the two files – xml.test – this holds the array of the
>> text blocks which is being parsed by image.php.
>>
>> Line 38 is the problem, if you comment around the foreach()
>> statement and un-comment the commented lines you should see it
>> working fine, its when its within the foreach statement when it errors.
>>
>> Regards,
>>
>> James
>>
>>
>> Jochem Maas Wrote:
>>
>>> James wrote:
>>> > Hi there,
>>> >
>>> > I have been using the GD functions from PHP5.0 on Mac OS X.
>>> >
>>> > I have a simple script that creates a PNG image with text on the
>>> image using
>>> > fonts using FreeType 2.
>>> >
>>> > I am trying to use the imagettftext() function within a foreach
>>> loop – but I
>>> > get the following error:
>>> >
>>> > PHP Warning: imagettftext() expects parameter 2 to be double
>>>
>>> what does paramter 2 contain in each case? var_dump(), print_r(),
>>> echo ?!?
>>>
>>> >
>>> > The code is as follows:
>>> >
>>> > $font['type']="./fonts/font.ttf”;
>>> >
>>> >
>>> >
>>> $font['color']=imageColorAllocate($card['png'],$font['hexcolor']['r'],
>>> $font[
>>> > 'hexcolor']['g'],$font['hexcolor']['b']);
>>> >
>>> > imageFill($card['png'],0,0,$card['color']);
>>> >
>>> > foreach ($xml->textblock as $text) {
>>> > $fontsize=$text->fontsize; $fontangle=$text->fontangle;
>>> > $fontxpos=$text->fontxpos; $fontypos=$text->fontypos;
>>> > $text=$text->text;
>>>
>>> try var_dump($text); or print_r($text); to see what you have
>>> (if its an XML node object - dump $fontsize, $fontxpos instead!!!)
>>>
>>> >
>>> imagettftext($image['png'],$fontsize,$fontangle,$fontxpos,$fontypos,$f
>>> ont['c
>>> > olor'],$font['type'],$text); }
>>> >
>>> > It works fine if I add just one line outside of the loop – but as
>>> soon as
>>> > its within the loop it errors.
>>> >
>>> > Cheers,
>>> >
>>> > James
>>> >
>>
>>
>> <image.php><test.xml>--
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


Chris Shiflett wrote:
> Mathijs wrote:
>
>> How can i add more callback_outputs to ob_start?
>>
>> I want to have both: ob_start('switchContent');
>> and: ob_start('ob_gzhandler');
>
>
> I don't think you can, but you could have a single function that calls
> both, then specify that function in ob_start().

I think you can by simply stacking multiple output buffers on top
of each other:

ob_start('switchContent'); // first buffer, for first callback
ob_start('ob_gzhandler'); // second buffer, for second callback

take care to define the handlers in the 'right' order
(the order that they are run in may be important to your output/code)

// rest of code.

I implemented a class once that stacks a list of callbacks
which could then all be run by its callback handler, psuedo-code:

class CB
{
        private static $cbs = array();

        public static function addCB($cb)
        {
                if (is_callable($cb)) {
                        self::$cbs[] = $cb;
                }
        }

        public static function run($data)
        {
                foreach (self::$cbs as $cb) {
                        $data = call_user_func($cb, $data);
                }

                return $data;
        }
}

ob_start( array('CB','run') );

>
> Chris
>

attached mail follows:


Can someone help me overcome this recurring problem? I am using the
Joomla content management system and I keep coming across the following
errors.

Fatal error: Call to undefined function mysql_real_escape_string()
in /usr/local/apache2/htdocs/common.php on line 24

Fatal error: Call to undefined function mysql_real_escape_string()
in /usr/local/apache2/htdocs/class.inputfilter.php on line 344

I notice in my Dynamic Extensions section of php.ini there are no
extensions called for; if that helps. Joomla works fine, but when adding
components or modules the problems start. One component author made a
test for the mysql_real_escape_string and I think avoided using it then
the component worked. I think that's probably not the best solution.

Fedora Core 3

Apache 2.0.55

PHP 5.0.5 (compiled with mysqli vice mysql)
'./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--enable-ftp'
'--enable-inline-optimization' '--enable-magic-quotes' '--enable-
mbstring' '--enable-track-vars' '--enable-trans-sid' '--enable-
wddx=shared' '--enable-xml' '--with-dom' '--with-gd' '--with-gettext'
'--with-mysqli=/usr/local/mysql/bin/mysql_config' '--with-regex=system'
'--with-xml' '--with-zlib-dir=/usr/lib'

MySQL 4.1.15

TIA,

Paul Hickey
Christian Patriot
Palm Bay Fl

attached mail follows:


Try using mysqli, instead of mysql.

Have you tried Joomla! support channels?

Paul Hickey wrote:
> Can someone help me overcome this recurring problem? I am using the
> Joomla content management system and I keep coming across the following
> errors.
>
> Fatal error: Call to undefined function mysql_real_escape_string()
> in /usr/local/apache2/htdocs/common.php on line 24
>
> Fatal error: Call to undefined function mysql_real_escape_string()
> in /usr/local/apache2/htdocs/class.inputfilter.php on line 344
>
> I notice in my Dynamic Extensions section of php.ini there are no
> extensions called for; if that helps. Joomla works fine, but when adding
> components or modules the problems start. One component author made a
> test for the mysql_real_escape_string and I think avoided using it then
> the component worked. I think that's probably not the best solution.
>
> Fedora Core 3
>
> Apache 2.0.55
>
> PHP 5.0.5 (compiled with mysqli vice mysql)
> './configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--enable-ftp'
> '--enable-inline-optimization' '--enable-magic-quotes' '--enable-
> mbstring' '--enable-track-vars' '--enable-trans-sid' '--enable-
> wddx=shared' '--enable-xml' '--with-dom' '--with-gd' '--with-gettext'
> '--with-mysqli=/usr/local/mysql/bin/mysql_config' '--with-regex=system'
> '--with-xml' '--with-zlib-dir=/usr/lib'
>
> MySQL 4.1.15
>
>
> TIA,
>
>
> Paul Hickey
> Christian Patriot
> Palm Bay Fl
>

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

attached mail follows:


I have PHP compiled with mysqli.

The standard answer from the Joomla forums is that I need to have
"mysql" vice "mysqli". I was looking for a more global solution than
having to modify the code for every component, module, mambot I want to
use.

I don't understand why I'm getting "undefined function" errors.

PHP.ini has no reference to mysqli. I don't know if changing this would
enable the functions specific to PHP > 4.x.

Paul Hickey
Christian Patriot
Palm Bay Fl

attached mail follows:


Is there no way to specify the database functions in Joomla?

You're getting undefined function because you haven't compiled it with
mysql, but mysqli instead, which means the functions you need are
prefixed with mysqli instead of mysql.

Paul Hickey wrote:
> I have PHP compiled with mysqli.
>
> The standard answer from the Joomla forums is that I need to have
> "mysql" vice "mysqli". I was looking for a more global solution than
> having to modify the code for every component, module, mambot I want to
> use.
>
> I don't understand why I'm getting "undefined function" errors.
>
> PHP.ini has no reference to mysqli. I don't know if changing this would
> enable the functions specific to PHP > 4.x.
>
> Paul Hickey
> Christian Patriot
> Palm Bay Fl
>

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

attached mail follows:


Paul Hickey wrote:
> Can someone help me overcome this recurring problem? I am using the
> Joomla content management system and I keep coming across the following
> errors.
>
> Fatal error: Call to undefined function mysql_real_escape_string()
> in /usr/local/apache2/htdocs/common.php on line 24
>
> Fatal error: Call to undefined function mysql_real_escape_string()
> in /usr/local/apache2/htdocs/class.inputfilter.php on line 344
>
> I notice in my Dynamic Extensions section of php.ini there are no
> extensions called for; if that helps. Joomla works fine, but when adding
> components or modules the problems start. One component author made a
> test for the mysql_real_escape_string and I think avoided using it then
> the component worked. I think that's probably not the best solution.
>
> Fedora Core 3
>
> Apache 2.0.55
>
> PHP 5.0.5 (compiled with mysqli vice mysql)
> './configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--enable-ftp'
> '--enable-inline-optimization' '--enable-magic-quotes' '--enable-
> mbstring' '--enable-track-vars' '--enable-trans-sid' '--enable-
> wddx=shared' '--enable-xml' '--with-dom' '--with-gd' '--with-gettext'
> '--with-mysqli=/usr/local/mysql/bin/mysql_config' '--with-regex=system'
> '--with-xml' '--with-zlib-dir=/usr/lib'
>
> MySQL 4.1.15

I'm pretty sure this was answered yesterday...oh yeah, it was. ;)

http://marc.theaimsgroup.com/?l=php-general&m=113397347124908&w=2

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
jnicheldotcomholdingsofbuffalo.com

attached mail follows:


Paul Hickey wrote:
> I have PHP compiled with mysqli.
>
> The standard answer from the Joomla forums is that I need to have
> "mysql" vice "mysqli". I was looking for a more global solution than
> having to modify the code for every component, module, mambot I want to
> use.
>
> I don't understand why I'm getting "undefined function" errors.
>
> PHP.ini has no reference to mysqli. I don't know if changing this would
> enable the functions specific to PHP > 4.x.

In your configuration line (how php was configured then compiled), you
have...

--with-mysqli=/usr/local/mysql/bin/mysql_config

That is why you are getting undefined function errors. Your version of
php is using mysqli, not mysql. You have two options: a) Recompile php
or b) Change all mysql_* functions to their counterparts in mysqli_*

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
jnicheldotcomholdingsofbuffalo.com

attached mail follows:


Hi John,

John Nichel wrote:
> Paul Hickey wrote:
>> I don't understand why I'm getting "undefined function" errors.
>> PHP.ini has no reference to mysqli. I don't know if changing this would
>> enable the functions specific to PHP > 4.x.
>
> In your configuration line (how php was configured then compiled), you
> have...
>
> --with-mysqli=/usr/local/mysql/bin/mysql_config
>
> That is why you are getting undefined function errors. Your version of
> php is using mysqli, not mysql. You have two options: a) Recompile php
> or b) Change all mysql_* functions to their counterparts in mysqli_*

Hmm, that's how I *should* have put it. :)

Cheers,

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

attached mail follows:


Hi all,

I'm facing a bad behaviour of 'file' command used by fileinfo PECL module
(recommanded for mime-type checking):
* Some Microsoft Excel documents are detected as Microsoft Word documents
* Some HTML files are just text/plain
* ...

I tested on multiple machines (with different version of file) and I
sometimes obtain a diffrent behaviour but never the one expected :/ I also
looked for the latest version of file but it seems that the file used to
detect the mime-type is out of date...

My questions are:
* If you already encounter this problem, how did you solve it ?
* Where can I find an up-to-date version of magic number list usable with
file for mime type checking ?

Thanks,
Regards,
Manuel

attached mail follows:


Hi,

IMO, the best way to avoid XSS is to filter _output_.
>
> My script:
> http://nengine.korsengineering.com/files/src/misc/HtmlFilter.phps
>

uhm,

1st. filter input
2nd escape output

--
Marco Kaiser

attached mail follows:


> -----Original Message-----
> From: Jason Gerfen [mailto:jason.gerfenscl.utah.edu]
> Sent: 07 December 2005 19:34
> To: comex
> Cc: php-generallists.php.net
> Subject: Re: [PHP] Preventing Cross Site Scripting Vulnerbilities

> function chk_input( $string ) {
> if( eregi( "^[0-9a-z_ -]$", $string ) ) {
> return 0;
> } else {
> return 1;
> }
> }
>
> if( chk_input( $string ) == 0 ) {
> echo "valid";
> } else {
> echo "invalid";
> }

Urgh! Nothing like making the simple things complicated! ;)

The above is effectively the same as (the more readable and more
efficient):

   function chk_input( $string ) {
     return eregi( "^[0-9a-z_ -]$", $string );
   }
 
   if (chk_input( $string )) {
     echo "valid";
   else {
     echo "invalid";
   }

And, personally, I'd use preg in there rather than ereg, as it's more
efficient, more up-to-date, and more supported.
Cheers!

Mike
 
------------------------------------------------------------------------
----------------
Mike Ford, Electronic Information Services Adviser, Learning Support
Services,
JG125, The Library, James Graham Building, Headingley Campus, Beckett
Park,
LEEDS, LS6 3QS, United Kingdom
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

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

attached mail follows:


Hello,

I'm using the PEAR Validate::email method to validate email addresses on our
contact forms since the spam bots have gotten so bad. I am using the
"check_domain" flag which calls the php function "checkdnsrr." This form
processor is used on several sites now and all is going well except one
problem. It seems this "checkdnsrr" function randomly returns false on
valid email addresses. I built a little debug feature into the processor to
let me know when the script fails and any error messages it has generated
along the way to try and stay ahead of the spammers.

I've been getting randomly occurring failure notices. Most of the time it
works, sometimes it doesn't. Every failure is a valid DNS and email
address. If I try running the email address against Validate::email later
it works. I was hoping somebody can shine some light on why checkdnsrr
would work sometimes and why it wouldn't work others. Any help or advice
would be greatly appreciated.

Thanks in advance!

attached mail follows:


Validate::email appears to check for a MX or A record. I'm a bit rusty
on my RFCs, but isn't is possible the mail host could be specified using
a CNAME?

Cheers,

David

Eric Butera wrote:
> Hello,
>
> I'm using the PEAR Validate::email method to validate email addresses on our
> contact forms since the spam bots have gotten so bad. I am using the
> "check_domain" flag which calls the php function "checkdnsrr." This form
> processor is used on several sites now and all is going well except one
> problem. It seems this "checkdnsrr" function randomly returns false on
> valid email addresses. I built a little debug feature into the processor to
> let me know when the script fails and any error messages it has generated
> along the way to try and stay ahead of the spammers.
>
> I've been getting randomly occurring failure notices. Most of the time it
> works, sometimes it doesn't. Every failure is a valid DNS and email
> address. If I try running the email address against Validate::email later
> it works. I was hoping somebody can shine some light on why checkdnsrr
> would work sometimes and why it wouldn't work others. Any help or advice
> would be greatly appreciated.
>
> Thanks in advance!
>

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