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 6 Dec 2006 23:20:35 -0000 Issue 4500

php-general-digest-helplists.php.net
Date: Wed Dec 06 2006 - 17:20:35 CST


php-general Digest 6 Dec 2006 23:20:35 -0000 Issue 4500

Topics (messages 245546 through 245589):

Reading and changing XML
        245546 by: Rosen
        245547 by: T.Lensselink

Re: Newsgroup connect time has become very long
        245548 by: Colin Guthrie
        245560 by: Ivo F.A.C. Fokkema
        245562 by: Ivo F.A.C. Fokkema
        245566 by: Chris
        245576 by: João Cândido de Souza Neto
        245586 by: Jonesy

Include problem
        245549 by: Ashley Hales
        245551 by: Dave Goodchild

Re: Help with strange include problem in PHP 5.2.0
        245550 by: Markus Mayer

Re: Explicit Stream Flush with fsockopen()
        245552 by: Oliver John V. Tibi

PHP analytics
        245553 by: Rick.
        245554 by: André Medeiros
        245555 by: Edward Kay
        245556 by: André Medeiros
        245557 by: Jochem Maas
        245558 by: Vincent DUPONT
        245559 by: André Medeiros
        245567 by: Colin Guthrie

Re: Sending E-mail
        245561 by: Ivo F.A.C. Fokkema

Re: firefox only problem
        245563 by: Youri LACAN-BARTLEY
        245564 by: Al
        245565 by: Al

PHP5 Inheritance/method override problem
        245568 by: Richard Morris
        245569 by: Roman Neuhauser
        245570 by: Edward Kay
        245571 by: Jochem Maas
        245572 by: Brad Fuller
        245574 by: Edward Kay
        245577 by: Richard Morris

PHP Grammar
        245573 by: yo plop
        245575 by: Satyam

Byte order Mark (BOM, UTF-8, Header)
        245578 by: Bernhard Zwischenbrugger
        245579 by: Jon Anderson

PHP Accelerator
        245580 by: Tim Traver
        245581 by: Robert Cummings

Ensuring that variable contains a number
        245582 by: Dotan Cohen
        245583 by: Dotan Cohen
        245584 by: Brad Fuller
        245585 by: Ray Hauge
        245587 by: Dotan Cohen

How to not be abused by mail form injectors?
        245588 by: Peter Lauri
        245589 by: Peter Lauri

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:


Hi,
I need some help. Which is the best way to parse XML file ( reading some
fields ) and change some of them ?

Thanks in advance,
Rosen

attached mail follows:


If you want to do some simple XML handeling you could go for simpleXML : http://nl3.php.net/manual/en/ref.simplexml.php
For the more advanced XML handeling i would go for DOM : http://nl3.php.net/manual/en/ref.dom.php

On Wed, 6 Dec 2006 12:47:01 +0200, "Rosen" <rosenpernikinfo.com> wrote:
> Hi,
> I need some help. Which is the best way to parse XML file ( reading some
> fields ) and change some of them ?
>
> Thanks in advance,
> Rosen
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


Al wrote:
> Anyone having problems connecting the last few days? Or, is there
> something wrong on my end. Al other sites are working just fine.

Newsgroup? I presume you are using Gmane (as I am).

Seems fine for me.

Col.

attached mail follows:


On Wed, 06 Dec 2006 10:49:52 +0000, Colin Guthrie wrote:

> Al wrote:
>> Anyone having problems connecting the last few days? Or, is there
>> something wrong on my end. Al other sites are working just fine.
>
> Newsgroup? I presume you are using Gmane (as I am).

I'm using Pan and it's taking aaaaages for me to connect. It just queues
my tasks and then suddenly it connects and executes the tasks. Then after
a minute or so of inactivity it closes the connection again. It gets
really annoying and I seem to have lost a post of mine as well.

Ivo

attached mail follows:


On Wed, 06 Dec 2006 10:49:52 +0000, Colin Guthrie wrote:

> Al wrote:
>> Anyone having problems connecting the last few days? Or, is there
>> something wrong on my end. Al other sites are working just fine.
>
> Newsgroup? I presume you are using Gmane (as I am).

I'm using Pan and it's taking aaaaages for me to connect. It just queues
my tasks and then suddenly it connects and executes the tasks. Then after
a minute or so of inactivity it closes the connection again. It gets
really annoying and I seem to have lost a post of mine as well.

Ivo

attached mail follows:


I'm having terrible response times for connecting to the news server,
getting new headers and downloading messages.

Can take minutes to do one task or times out.

I'm using Outlook Express 6.

"Al" <newsridersite.org> wrote in message
news:54.B5.15259.DB116754pb1.pair.com...
> Anyone having problems connecting the last few days? Or, is there
> something wrong on my end. Al other sites are working just fine.
>
> Thanks.....

attached mail follows:


I´m using outtlook express 6 as well and i´m facing the same trouble.

""Chris"" <chris.sidleserv.net> escreveu na mensagem
news:E3.B0.54198.7CCC6754pb1.pair.com...
> I'm having terrible response times for connecting to the news server,
> getting new headers and downloading messages.
>
> Can take minutes to do one task or times out.
>
> I'm using Outlook Express 6.
>
>
> "Al" <newsridersite.org> wrote in message
> news:54.B5.15259.DB116754pb1.pair.com...
>> Anyone having problems connecting the last few days? Or, is there
>> something wrong on my end. Al other sites are working just fine.
>>
>> Thanks.....

attached mail follows:


On Wed, 06 Dec 2006 10:49:52 +0000, Colin Guthrie wrote:
> Al wrote:
>> Anyone having problems connecting the last few days? Or, is there
>> something wrong on my end. Al other sites are working just fine.
>
> Newsgroup? I presume you are using Gmane (as I am).

I can't determine by the OP's headers how he is reading the ng, but I am
reading gmane.comp.php.general from the news.gmane.org server using
slrn. (I'll have to double check _my_ headers after posting -- lots of
noise in those headers....)

It _may_ be a little less snappy' than in the past (but then, my
broadband service (sic) provider is on and off snafu here.)
I would _not_ call it slow.

Similar results with about 8 other Gmane ng's I read.

> Seems fine for me.

I'm happy. I don't see a problem.

Jonesy
--
  Marvin L Jones | jonz | W3DHJ | linux
   38.24N 104.55W | config.com | Jonesy | OS/2
    *** Killfiling google posts: <http//jonz.net/ng.htm>

attached mail follows:


I am trying to use includes on a free php server but I cannot set the
includes_path myself. Consequently when I try to include common elements or
library files I run into trouble as I am unable to store or gain acesss to a
central includes folder for the entire of my website to access. Is there
any way around this?

attached mail follows:


Use ini_set or an .htaccess file - try the first, and if that doesn't work
use an .htaccess file if you have them enabled in the server (and it's
Apache of course!).

On 12/6/06, Ashley Hales <ashley.halesntlworld.com> wrote:
>
> I am trying to use includes on a free php server but I cannot set the
> includes_path myself. Consequently when I try to include common elements
> or
> library files I run into trouble as I am unable to store or gain acesss to
> a
> central includes folder for the entire of my website to access. Is there
> any way around this?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
http://www.web-buddha.co.uk

attached mail follows:


Hi Richard,

I think I've identified the problem. It appears to be a problem with
PHPMyAdmin rather than PHP itself.

The directory permissions we have are the minimum we need, usually 710, file
permissions are 640. The group part of the permissions is how the apache
gets to the files in the directories. This time I did the installation of
PMA and changed all the directory and file permissions according to the
standards here. As it turns out, PMA demands read permission on the
directory in which it's distribution directory is installed. That is:

/usr/local/htdocs# ls -la pma/
total 16
drwxr-x--- 4 root webservd 512 Dec 6 10:48 .
drwxrwx--- 17 root webservd 2048 Dec 6 10:22 ..
drwxr-xr-x 9 root webservd 2048 Nov 30 14:06 phpMyAdmin-2.8.1
drwx--x--- 10 root webservd 2560 Dec 1 12:36
phpMyAdmin-2.9.1.1-all-languages

If the permission of this directory listed above has 710 instead of 750, PMA
falls over!

/usr/local/htdocs# ls -la pma/
total 16
drwx--x--- 4 root webservd 512 Dec 6 10:48 .
drwxrwx--- 17 root webservd 2048 Dec 6 10:22 ..
drwx--x--- 9 root webservd 2048 Nov 30 14:06 phpMyAdmin-2.8.1
drwx--x--- 10 root webservd 2560 Dec 1 12:36
phpMyAdmin-2.9.1.1-all-languages

It took quite a bit of scratching my head until I found this out. In
particular, PMA 2.9.1.1 really falls over with the 710 permissions that are
currently set. I think now I need to file a PMA bug report.

thanks for the suggestions you made, they did help me find this problem.

regards
Markus

On Friday 01 December 2006 22:27, Richard Lynch wrote:
> Try running it under some kind of debugger and see if you can figure
> out what directories it's even checking when it doesn't find the
> file...
>
> I dunno if Zend IDE (or whatever it's called now) or Komodo or XDebug
> or whatnot will do that, but it's definitely sounding very odd if your
> include_path has "." in it...
>
> Oooh...
> What does PHP think your cwd is?
> echo '<hr />cwd: ', cwd(), "<hr />\n";
> right before the include.
>
> On Fri, December 1, 2006 3:47 am, Markus Mayer wrote:
> > Hi Richard,
> > Hi all,
> >
> > The include path is correct. That was one of the first things I
> > played around
> > with. At the moment, it's include_path = ".". I also tried renaming
> > the
> > php.ini file to php.ini.off so that it wasn't found and took all the
> > defaults, but with no success.
> >
> > Last night I built PHP 5.1.6 and took the same php.ini file.
> > Everything
> > worked. The build environment was the same, the configure arguments
> > were the
> > same, only the php version was different.
> >
> > I'm guessing that I've done something wrong somewhere because I
> > haven't found
> > any references to this problem from any one else. I just have no idea
> > what
> > it could be. I don't know if it's any help in locating the problem,
> > my build
> > environment is Solaris 10, Sun Studio 10 with the Sun C and C++
> > compilers.
> > # cc-V
> > Sun C 5.7 2005/01/07
> > # CC -V
> > CC: Sun C++ 5.7 2005/01/07
> >
> > LDFLAGS=-L/opt/sfw/lib -L/usr/sfw/lib -L/usr/lib
> > -R/opt/sfw/lib:/usr/sfw/lib:/usr/lib:/opt/oracle/instantclient_10_2
> > CPPFLAGS=-I/opt/sfw/include -I/usr/sfw/include/openssl
> > -I/usr/local/BerkeleyDB/include -I/usr/include
> > -I/opt/oracle/instantclient_10_2/sdk/include
> > CFLAGS=-I/opt/sfw/include -I/usr/sfw/include/openssl
> > -I/usr/local/BerkeleyDB/include -I/usr/include
> > -I/opt/oracle/instantclient_10_2/sdk/include
> >
> > And to your "rant" about the code developers make - I totally agree
> > with you.
> > As the administrator of a server with close to 600 users who all put
> > their
> > own applications in their own accounts up, then ask me why it "doesn't
> > work",
> > I get annoyed at such things too.
> >
> > regards
> > Markus
> >
> > On Thursday 30 November 2006 19:04, Richard Lynch wrote:
> >> On Thu, November 30, 2006 6:49 am, Markus Mayer wrote:
> >> > I have a strange problem including files in PHP 5.2.0 running on
> >>
> >> Unix.
> >>
> >> > If I
> >> > try to include a file using include 'filename.inc';, everything is
> >> > fine. As
> >> > soon as I try to put a "." in front of the file name, for example
> >> > include './filename.inc';, I get a "failed to open stream: No such
> >> > file or
> >> > directory" error. Does anyone have any suggestions as to what is
> >> > going
> >> > wrong?` This all works with php 4.4.4 built with the same
> >>
> >> environment
> >>
> >> > and
> >> > compiler on the same system.
> >>
> >> What is your include path in PHP 5.2.0?
> >>
> >> I'm going to go out on a limb and bet a dollar that the PHP 4.4.4
> >> include_path has "." as one element within the list and that the PHP
> >> 5.2.0 include_path does NOT have "." within the list.
> >>
> >> I.e.:
> >> 4.4.4 include_path ".:include_test_dir"
> >> 5.2.0 include_path "include_test_dir"
> >>
> >> In the first case, 4.4.4, you've got . in there, so . combined with
> >> ./
> >> will "find" the file you want.
> >>
> >> In the second case, 5.2.0, you've got no . in there, so ./ is
> >> looking
> >> in a directory, not the directory you expect, and it ain't finding
> >> the
> >> file because it's not there.
> >>
> >> Rant #24, not directed at Markus, but the world at large :-)
> >> PHP developers should understand and use include_path instead of
> >> hacking up their source with hard-coded paths and weird
> >> sub-directory
> >> / parent-directory hacks in include/require statements.
> >>
> >> It drives me nuts when I install nice software packages, but I can't
> >> put their components where I want them.
> >>
> >> End result:
> >> rm -rf [insert your nifty project directory name here]
> >>
> >> --
> >> Some people have a "gift" link here.
> >> Know what I want?
> >> I want you to buy a CD from some starving artist.
> >> http://cdbaby.com/browse/from/lynch
> >> Yeah, I get a buck. So?
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


Hi Richard,

Thanks for the help, and I almost forgot to thank you for it. Reason for
the timeout to occur in the posts that I have mentioned before was a
simple End Of Transmission character (EOT, ASCII 4) that terminates
every message sent to and from the server.

And by the way, thank you. :)

O.J.

Richard Lynch wrote:
> http://php.net/fflush
>
>
> On Sun, June 4, 2006 9:51 pm, Oliver John V. Tibi wrote:
>> Hi Guys,
>>
>> I know this may sound fundamental to some of you, but do you know any
>> way of explicitly flushing out stream buffers off to the socket using
>> fsockopen()/fputs() combos? Hope to hear from you soon.
>>
>> Note: I'm not using http, and I'm connecting to some other arbitrary
>> port other than http, so I don't know if ob_flush() and its family of
>> functions will work.
>>
>> Thanks! :)
>>
>> --
>> Oliver John V. Tibi
>> Software Programmer/Web Application Developer
>> IAMD Software Solutions
>> ojiamd.com
>> "Live free() or die()."
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>

--
Oliver John V. Tibi
Software Programmer/Web Application Developer
IAMD Software Solutions
ojiamd.com
"Live free() or die()."

Support PayPal Now for Philippines! (http://paypalnow.com.ph/)

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GIT d- s: a-- C+++>$ UL++++$ P+ L++$ E W+++$ N++ o K w+$ O M V- PS !PE
Y+ PGP+ t+ 5 X+ R* tv-- b+ DI+++ D+ G++ e+ h r- y?
------END GEEK CODE BLOCK------

attached mail follows:


Hello

I am new to php and I would like some guidance from those who have a bit more expereince with PHP

I will be attempting to do a bit of tracking and web analytics. Basically, the user will login
and from there everything that he clicked will be recorded in a database and analyzed
i.e user behaviour, patterns with different user groups.

Is this possible with php and it is a major undertaking ? just trying not to get ahead of myself here..

are there any tutorials or scripts or books that you know of ?

Thanks
Regards
Rick

attached mail follows:


Storing the document that is being called and get paramaters on a DB
is very simple

You would have an include like

$doc = $_SERVER['PHP_SELF'];
$get_vars = serialize($_GET);
mysql_query('INSERT INTO logs (page, vars) VALUES ("' . $doc . '", "'
. addslashes($get_vars) . '")');

Of course you'd need extra info like user id and such, but the
principle is there.

On 12/6/06, Rick. <nrickigmail.com> wrote:
> Hello
>
>
>
> I am new to php and I would like some guidance from those who have a bit more expereince with PHP
>
>
> I will be attempting to do a bit of tracking and web analytics. Basically, the user will login
> and from there everything that he clicked will be recorded in a database and analyzed
> i.e user behaviour, patterns with different user groups.
>
> Is this possible with php and it is a major undertaking ? just trying not to get ahead of myself here..
>
> are there any tutorials or scripts or books that you know of ?
>
>
>
> Thanks
> Regards
> Rick
>
>
>
>
>

attached mail follows:


What you describe is certainly possible, and many sites have this
functionality.

If you're just starting out however, look into Google Analytics. It gives
you more info than you care to imagine and is free. It's also takes 2secs to
install (except I think there's a waiting list to get your account active).

Edward

> Hello
>
> I am new to php and I would like some guidance from those who
> have a bit more expereince with PHP
>
>
> I will be attempting to do a bit of tracking and web analytics.
> Basically, the user will login
> and from there everything that he clicked will be recorded in a
> database and analyzed
> i.e user behaviour, patterns with different user groups.
>
> Is this possible with php and it is a major undertaking ? just
> trying not to get ahead of myself here..
>
> are there any tutorials or scripts or books that you know of ?
>
>
>
> Thanks
> Regards
> Rick
>
>
>
>
>

attached mail follows:


Not really, it's instant now. You just have to have a google account.

On 12/6/06, Edward Kay <edwardlabhut.com> wrote:
> What you describe is certainly possible, and many sites have this
> functionality.
>
> If you're just starting out however, look into Google Analytics. It gives
> you more info than you care to imagine and is free. It's also takes 2secs to
> install (except I think there's a waiting list to get your account active).
>
> Edward
>
> > Hello
> >
> > I am new to php and I would like some guidance from those who
> > have a bit more expereince with PHP
> >
> >
> > I will be attempting to do a bit of tracking and web analytics.
> > Basically, the user will login
> > and from there everything that he clicked will be recorded in a
> > database and analyzed
> > i.e user behaviour, patterns with different user groups.
> >
> > Is this possible with php and it is a major undertaking ? just
> > trying not to get ahead of myself here..
> >
> > are there any tutorials or scripts or books that you know of ?
> >
> >
> >
> > Thanks
> > Regards
> > Rick
> >
> >
> >
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Rick. wrote:
> Hello
>
>
>
> I am new to php and I would like some guidance from those who have a bit more expereince with PHP
>
>
> I will be attempting to do a bit of tracking and web analytics. Basically, the user will login
> and from there everything that he clicked will be recorded in a database and analyzed
> i.e user behaviour, patterns with different user groups.
>
> Is this possible with php and it is a major undertaking ? just trying not to get ahead of myself here..

yes and probably (depending on what and how much you want to log and
analyse). may be there is something out there that does what you want already.

the logging part is easy enough - it's a question of
performing an INSER on some database table!

>
> are there any tutorials or scripts or books that you know of ?
>
>
>
> Thanks
> Regards
> Rick
>
>
>
>

attached mail follows:


You could look for Apache logs analysers, too

vincent

-----Original Message-----
From: Rick. [mailto:nrickigmail.com]
Sent: Wed 6/12/2006 12:48
To: php-generallists.php.net
Subject: [PHP] PHP analytics
 
Hello

I am new to php and I would like some guidance from those who have a bit more expereince with PHP

I will be attempting to do a bit of tracking and web analytics. Basically, the user will login
and from there everything that he clicked will be recorded in a database and analyzed
i.e user behaviour, patterns with different user groups.

Is this possible with php and it is a major undertaking ? just trying not to get ahead of myself here..

are there any tutorials or scripts or books that you know of ?

Thanks
Regards
Rick

attached mail follows:


Do those log GET params?

On 12/6/06, Vincent DUPONT <Vincent.dupontausy.be> wrote:
>
> You could look for Apache logs analysers, too
>
> vincent
>
> -----Original Message-----
> From: Rick. [mailto:nrickigmail.com]
> Sent: Wed 6/12/2006 12:48
> To: php-generallists.php.net
> Subject: [PHP] PHP analytics
>
> Hello
>
>
>
> I am new to php and I would like some guidance from those who have a bit more expereince with PHP
>
>
> I will be attempting to do a bit of tracking and web analytics. Basically, the user will login
> and from there everything that he clicked will be recorded in a database and analyzed
> i.e user behaviour, patterns with different user groups.
>
> Is this possible with php and it is a major undertaking ? just trying not to get ahead of myself here..
>
> are there any tutorials or scripts or books that you know of ?
>
>
>
> Thanks
> Regards
> Rick
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Rick. wrote:
> I am new to php and I would like some guidance from those who have a bit more expereince with PHP
>
>
> I will be attempting to do a bit of tracking and web analytics. Basically, the user will login
> and from there everything that he clicked will be recorded in a database and analyzed
> i.e user behaviour, patterns with different user groups.
>
> Is this possible with php and it is a major undertaking ? just trying not to get ahead of myself here..
>
> are there any tutorials or scripts or books that you know of ?

Yeah!

I just found out about this one the other day.

Not tried it yet, but would appear to be quite nice.

It basically requires you to insert a bit of Javascript code into the
site you want to analyse and then use the PHP application to interpret
these results.

Or you could just use Google Analytics.

Either way, the PHP Analytics I saw are at:
http://www.phpmyvisites.us/

GPL etc.

If someone uses it, could they post to the list as to how useful they
feel it is? That would be of benefit to everyone.

Col

attached mail follows:


Also, try to use a local email address first. Possibly it gets sent, but
the remote server blocks the email as spam. You can check that by having
the email sent to your local user, and check if it arrives there.

HTH

On Mon, 04 Dec 2006 16:53:19 +0100, Jochem Maas wrote:

> Janet Smith wrote:
>> I wasn't really sure where to start looking, but I think I have enough
>> information that I can go and look at how we have things set up. I will
>> try to provide more information as I find it.
>
> chances are that the following function is being used.
>
> http://php.net/mail
>
> you should really make sure sending email from the cmdline works before
> digging deeper into php - it maybe your sendmail (or alternative tool) itself
> is borked (in which case php won't be able to use it to send any email!).
>
> smtp and smtp_port are ini settings that are only valid for windows,
> I have no idea if setting them in a *nix php installation will cause problems or not.
>>
>> Thanks
>>
>>>>> Jochem Maas <jochemiamjochem.com> 12/4/2006 10:42 AM >>>
>> Janet Smith wrote:
>>> We have an application using PHP. If users have forgotten their
>>> password, they click on the link 'Forgot Password' and enter this
>> e-mail
>>> address. This is suppose to send their new password to the e-mail
>>> address provided. We can not get the e-mail to be sent. I have
>> changed
>>> the php.ini file to include the SMTP, the sendmail_from and the
>>> sendmail_path. Does anyone have any suggestions as to what else I
>> need
>>> to look at?
>>
>> what is the error?
>> what is the code that tries to send the email?
>> what are the relevant php.ini settings set to?
>> what is your OS, php version, etc?
>> do you have a net connection?
>> can you send email from the cmdline?
>>
>> give us this info and maybe we can provide a solution.
>>
>> other than that I can only suggest looking at the moon - it won't
>> solve
>> the problem, and I don't think the moon has a 'look at me'
>> requirement,
>> but it is nice to do.
>>
>>> Thanks
>>>
>>> Jan Smith
>>> Programmer Analyst
>>> Indiana State University
>>> Terre Haute, Indiana
>>> Phone: (812) 237-8593
>>> Email: jsmith7isugw.indstate.edu
>>>
>>>
>> *******************************************************************************************
>>> This email, and any attachments, thereto, is intended only for use
>> by
>>> the addressee(s) named herein and may contain privileged and/or
>>> confidential information. If you are not the intended recipient of
>> this
>>> email, you are hereby notified that any dissemination, distribution
>> or
>>> copying of this email, and any attachments thereto, is strictly
>>> prohibited.
>>>
>> *******************************************************************************************
>>

attached mail follows:


Hi Ross,

you might want to look at the way you define your CSS ids

#side, #main, #holder, {height: 1400px;}
should probably be
#side, #main, #holder {height: 1400px;}

Now that's just a question of removing that extra trailing comma.

You might also want to look into the way Firefox handles the height
attribute of a div. I remember some sort of issue with floating or
relative-positioned divs in firefox.

Good luck !

Jochem Maas wrote:
> Ross wrote:
>> This is the head of my doc. It is supposed to change the page height based
>> on the selection from the menu. It works in IE and validates ok but it is no
>> go in firefox. Any ideas??
>
> try a CSS list ; google for CSS-Discuss (Eric Meyers list)
>
>> You can see it in action here...
>>
>> http://suruchitoo.com/menu.php
>>
>>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>> <html xmlns="http://www.w3.org/1999/xhtml">
>> <head>
>> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
>> <title>SuruchiToo - Menu</title>
>> <link href="suruchi.css" rel="stylesheet" type="text/css" />
>>
>> <?php
>>
>>
>> $select = isset($_REQUEST['select']) ? $_REQUEST['select'] : '';
>>
>> switch ($select) {
>> case "starters":
>> $selection = "starters.php";
>>
>> break;
>> case "mains":
>> $selection = "mains.php";
>> ?><style type="text/css">#side, #main, #holder, {height: 1400px;}
>> #menu_insert {height:950px;}</style><?
>> break;
>>
>>
>> case "veg":
>> $selection = "veg.php";
>> ?><?
>> break;
>>
>> case "rice":
>> $selection = "rice.php";
>> ?><style type="text/css">#side, #main, #holder, {height: 1000px;}
>> #menu_insert {height:950px;}</style><?
>> break;
>> case "drinks":
>> $selection = "drinks.php";
>> ?><style type="text/css">#side, #main, #holder, {height: 1600px;}
>> #menu_insert {height:950px;}</style><?
>>
>> break;
>> default:
>> $selection = "starters.php";
>> ?><style type="text/css">#side, #main, #holder, {height: 1400px;}
>> #menu_insert {height:950px;}</style><?
>> break;
>>
>> }
>>
>> ?>
>>
>

attached mail follows:


First thing to do is to make your code W3C compliant. Both the html and css
validators identify errors.

Ross wrote:
> This is the head of my doc. It is supposed to change the page height based
> on the selection from the menu. It works in IE and validates ok but it is no
> go in firefox. Any ideas?? You can see it in action here...
>
> http://suruchitoo.com/menu.php
>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
> <title>SuruchiToo - Menu</title>
> <link href="suruchi.css" rel="stylesheet" type="text/css" />
>
> <?php
>
>
> $select = isset($_REQUEST['select']) ? $_REQUEST['select'] : '';
>
> switch ($select) {
> case "starters":
> $selection = "starters.php";
>
> break;
> case "mains":
> $selection = "mains.php";
> ?><style type="text/css">#side, #main, #holder, {height: 1400px;}
> #menu_insert {height:950px;}</style><?
> break;
>
>
> case "veg":
> $selection = "veg.php";
> ?><?
> break;
>
> case "rice":
> $selection = "rice.php";
> ?><style type="text/css">#side, #main, #holder, {height: 1000px;}
> #menu_insert {height:950px;}</style><?
> break;
> case "drinks":
> $selection = "drinks.php";
> ?><style type="text/css">#side, #main, #holder, {height: 1600px;}
> #menu_insert {height:950px;}</style><?
>
> break;
> default:
> $selection = "starters.php";
> ?><style type="text/css">#side, #main, #holder, {height: 1400px;}
> #menu_insert {height:950px;}</style><?
> break;
>
> }
>
> ?>

attached mail follows:


First thing to do is to make your code W3C compliant. Both the html and css
validators identify errors.

Ross wrote:
> This is the head of my doc. It is supposed to change the page height based
> on the selection from the menu. It works in IE and validates ok but it is no
> go in firefox. Any ideas?? You can see it in action here...
>
> http://suruchitoo.com/menu.php
>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
> <title>SuruchiToo - Menu</title>
> <link href="suruchi.css" rel="stylesheet" type="text/css" />
>
> <?php
>
>
> $select = isset($_REQUEST['select']) ? $_REQUEST['select'] : '';
>
> switch ($select) {
> case "starters":
> $selection = "starters.php";
>
> break;
> case "mains":
> $selection = "mains.php";
> ?><style type="text/css">#side, #main, #holder, {height: 1400px;}
> #menu_insert {height:950px;}</style><?
> break;
>
>
> case "veg":
> $selection = "veg.php";
> ?><?
> break;
>
> case "rice":
> $selection = "rice.php";
> ?><style type="text/css">#side, #main, #holder, {height: 1000px;}
> #menu_insert {height:950px;}</style><?
> break;
> case "drinks":
> $selection = "drinks.php";
> ?><style type="text/css">#side, #main, #holder, {height: 1600px;}
> #menu_insert {height:950px;}</style><?
>
> break;
> default:
> $selection = "starters.php";
> ?><style type="text/css">#side, #main, #holder, {height: 1400px;}
> #menu_insert {height:950px;}</style><?
> break;
>
> }
>
> ?>

attached mail follows:


Hi,

I came across this problem and I was wondering if someone might be able
to explain to my why it is happening. I put together a short example to
  illustrate the problem that I am having.

Basically I have one class that performs a certain task. I then have a
second class which extends the first class and performs some tasks in
addition to the first class. Even though ClassA should know nothing
about ClassB since ClassA is the parent, ClassA actually calls ClassB's
exist method when it should be calling it's own.

I know that description is really wordy and probably confusing which is
why I provided below the example code that illustrates the problem.

Doesn't this break the idea of inheritance? I can get it to work if I
change ClassB::exists to some other name such as ClassB::exists2.

If anyone can enlighten me as to why this problem is occurring or
suggest a fix I would really appreciate it. Thank you.

expected output
---------------
ClassB - save
ClassA - save
ClassA - exists
ClassA - update

actual output
-------------
ClassB - save
ClassA - save

Warning: Missing argument 2 for ClassB::exists(), called in
/website/overridetest.php on line 6 and defined in
/website/overridetest.php on line 33

ClassB - exists
ClassA - update

overridetest.php
----------------
<?php
   class ClassA {
     public function save($value) {
       echo "ClassA - save\n";

       if ($this->exists($value))
         $this->update($value);
       else
         $this->insert($value);
     }

     protected function insert($value) {
       echo "ClassA - insert\n";
     }

     protected function update($value) {
       echo "ClassA - update\n";
     }

     public function exists($value) {
       echo "ClassA - exists\n";
       return true;
     }
   }

   class ClassB extends ClassA {
     public function save($value, $classAValue) {
       echo "ClassB - save\n";
         parent::save($classAValue);
         // do some additional work...
     }

     public function exists($value, $classAValue) {
         // does a different search than ClassA
       echo "ClassB - exists\n";
         return true;
     }
   }

   $c = new ClassB();
   $c->save('test', 'test2');
?>

--
Richard Morris
HDD Broker, Inc.

     Toll-Free: +1 866 960-3331
International: +1 250 474-6022
           Fax: +1 250 474-6099
        E-Mail: richardhddbroker.com
      Web Site: www.hddbroker.com

attached mail follows:


# richardhddbroker.com / 2006-12-06 07:22:22 -0800:
> Basically I have one class that performs a certain task. I then have a
> second class which extends the first class and performs some tasks in
> addition to the first class. Even though ClassA should know nothing
> about ClassB since ClassA is the parent, ClassA actually calls ClassB's
> exist method when it should be calling it's own.

All non-private methods are "virtual" in PHP. Besides, this will work as well:

class A
{
    function f()
    {
        $this->g();
    }
}
class B extends A
{
    function g() {}
}
$b = new B; $b->f();

As well as this:

class C extends A
{
    function extension() {}
}
function f(A $a)
{
    $a->extension();
}
 
> I know that description is really wordy and probably confusing which is
> why I provided below the example code that illustrates the problem.
>
> Doesn't this break the idea of inheritance? I can get it to work if I
> change ClassB::exists to some other name such as ClassB::exists2.
>
> If anyone can enlighten me as to why this problem is occurring or
> suggest a fix I would really appreciate it. Thank you.
>
> expected output
> ---------------
> ClassB - save
> ClassA - save
> ClassA - exists
> ClassA - update
>
> actual output
> -------------
> ClassB - save
> ClassA - save

If I change the update() methods' accesses to "private", I get the
output you expect:

romandagan ~ 1001:0 > php tmp/scratch04
ClassB - save
ClassA - save
ClassA - exists
ClassA - update

That might or might not help you in this case.

--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

attached mail follows:


Hi Richard,

This is very strange. I can certainly reproduce the problem. Putting a
var_dump($this) in ClassA's save method shows that PHP sees $this as an
instance of ClassB - when it should be of ClassA.

I'm afraid it's stumped me too! Does anyone else have any thoughts?

Edward

> Hi,
>
> I came across this problem and I was wondering if someone might be able
> to explain to my why it is happening. I put together a short example to
> illustrate the problem that I am having.
>
> Basically I have one class that performs a certain task. I then have a
> second class which extends the first class and performs some tasks in
> addition to the first class. Even though ClassA should know nothing
> about ClassB since ClassA is the parent, ClassA actually calls ClassB's
> exist method when it should be calling it's own.
>
> I know that description is really wordy and probably confusing which is
> why I provided below the example code that illustrates the problem.
>
> Doesn't this break the idea of inheritance? I can get it to work if I
> change ClassB::exists to some other name such as ClassB::exists2.
>
> If anyone can enlighten me as to why this problem is occurring or
> suggest a fix I would really appreciate it. Thank you.
>
>
>
> expected output
> ---------------
> ClassB - save
> ClassA - save
> ClassA - exists
> ClassA - update
>
>
>
> actual output
> -------------
> ClassB - save
> ClassA - save
>
>
> Warning: Missing argument 2 for ClassB::exists(), called in
> /website/overridetest.php on line 6 and defined in
> /website/overridetest.php on line 33
>
> ClassB - exists
> ClassA - update
>
>
>
> overridetest.php
> ----------------
> <?php
> class ClassA {
> public function save($value) {
> echo "ClassA - save\n";
>
> if ($this->exists($value))
> $this->update($value);
> else
> $this->insert($value);
> }
>
> protected function insert($value) {
> echo "ClassA - insert\n";
> }
>
> protected function update($value) {
> echo "ClassA - update\n";
> }
>
> public function exists($value) {
> echo "ClassA - exists\n";
> return true;
> }
> }
>
> class ClassB extends ClassA {
> public function save($value, $classAValue) {
> echo "ClassB - save\n";
> parent::save($classAValue);
> // do some additional work...
> }
>
> public function exists($value, $classAValue) {
> // does a different search than ClassA
> echo "ClassB - exists\n";
> return true;
> }
> }
>
> $c = new ClassB();
> $c->save('test', 'test2');
> ?>
>
> --
> Richard Morris
> HDD Broker, Inc.
>
> Toll-Free: +1 866 960-3331
> International: +1 250 474-6022
> Fax: +1 250 474-6099
> E-Mail: richardhddbroker.com
> Web Site: www.hddbroker.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

attached mail follows:


Edward Kay wrote:
> Hi Richard,
>
> This is very strange. I can certainly reproduce the problem. Putting a
> var_dump($this) in ClassA's save method shows that PHP sees $this as an
> instance of ClassB - when it should be of ClassA.

what *you* think it should be and what php's developers decided it should be
about 3+ years ago obviously differ.

if you have an instance of ClassB it is exactly that - refering to $this
in the parent class definition won't magically make the class of the instance change.

$this is plain this and not something else.

here is a code snippet to chew on - hope it gives you a lightbulb moment:

class A {
        function test() { self::test2(); }
        function test2() { echo "TEST: ",__CLASS__,"\n"; }
}
class B extends A {
        function test2() { echo "TEST: ",__CLASS__,"\n"; }
}

$b = new B; $b->test(); $b->test2();

>
> I'm afraid it's stumped me too! Does anyone else have any thoughts?

RTM - especially the php5 OO section(s)

>
> Edward
>
>
>> Hi,
>>
>> I came across this problem and I was wondering if someone might be able
>> to explain to my why it is happening. I put together a short example to
>> illustrate the problem that I am having.
>>
>> Basically I have one class that performs a certain task. I then have a
>> second class which extends the first class and performs some tasks in
>> addition to the first class. Even though ClassA should know nothing
>> about ClassB since ClassA is the parent, ClassA actually calls ClassB's
>> exist method when it should be calling it's own.
>>
>> I know that description is really wordy and probably confusing which is
>> why I provided below the example code that illustrates the problem.
>>
>> Doesn't this break the idea of inheritance? I can get it to work if I
>> change ClassB::exists to some other name such as ClassB::exists2.
>>
>> If anyone can enlighten me as to why this problem is occurring or
>> suggest a fix I would really appreciate it. Thank you.
>>
>>
>>
>> expected output
>> ---------------
>> ClassB - save
>> ClassA - save
>> ClassA - exists
>> ClassA - update
>>
>>
>>
>> actual output
>> -------------
>> ClassB - save
>> ClassA - save
>>
>>
>> Warning: Missing argument 2 for ClassB::exists(), called in
>> /website/overridetest.php on line 6 and defined in
>> /website/overridetest.php on line 33
>>
>> ClassB - exists
>> ClassA - update
>>
>>
>>
>> overridetest.php
>> ----------------
>> <?php
>> class ClassA {
>> public function save($value) {
>> echo "ClassA - save\n";
>>
>> if ($this->exists($value))
>> $this->update($value);
>> else
>> $this->insert($value);
>> }
>>
>> protected function insert($value) {
>> echo "ClassA - insert\n";
>> }
>>
>> protected function update($value) {
>> echo "ClassA - update\n";
>> }
>>
>> public function exists($value) {
>> echo "ClassA - exists\n";
>> return true;
>> }
>> }
>>
>> class ClassB extends ClassA {
>> public function save($value, $classAValue) {
>> echo "ClassB - save\n";
>> parent::save($classAValue);
>> // do some additional work...
>> }
>>
>> public function exists($value, $classAValue) {
>> // does a different search than ClassA
>> echo "ClassB - exists\n";
>> return true;
>> }
>> }
>>
>> $c = new ClassB();
>> $c->save('test', 'test2');
>> ?>
>>
>> --
>> Richard Morris
>> HDD Broker, Inc.
>>
>> Toll-Free: +1 866 960-3331
>> International: +1 250 474-6022
>> Fax: +1 250 474-6099
>> E-Mail: richardhddbroker.com
>> Web Site: www.hddbroker.com
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>

attached mail follows:


> -----Original Message-----
> From: Richard Morris [mailto:richardhddbroker.com]
> Sent: Wednesday, December 06, 2006 10:22 AM
> To: php-generallists.php.net
> Subject: [PHP] PHP5 Inheritance/method override problem
>
> Hi,
>
> I came across this problem and I was wondering if someone might be able
> to explain to my why it is happening. I put together a short example to
> illustrate the problem that I am having.
>
> Basically I have one class that performs a certain task. I then have a
> second class which extends the first class and performs some tasks in
> addition to the first class. Even though ClassA should know nothing
> about ClassB since ClassA is the parent, ClassA actually calls ClassB's
> exist method when it should be calling it's own.
>
> I know that description is really wordy and probably confusing which is
> why I provided below the example code that illustrates the problem.
>
> Doesn't this break the idea of inheritance? I can get it to work if I
> change ClassB::exists to some other name such as ClassB::exists2.
>
> If anyone can enlighten me as to why this problem is occurring or
> suggest a fix I would really appreciate it. Thank you.
>
>
>
> expected output
> ---------------
> ClassB - save
> ClassA - save
> ClassA - exists
> ClassA - update
>
>
>
> actual output
> -------------
> ClassB - save
> ClassA - save
>
>
> Warning: Missing argument 2 for ClassB::exists(), called in
> /website/overridetest.php on line 6 and defined in
> /website/overridetest.php on line 33
>
> ClassB - exists
> ClassA - update
>
>
>
> overridetest.php
> ----------------
> <?php
> class ClassA {
> public function save($value) {
> echo "ClassA - save\n";
>
> if ($this->exists($value))
> $this->update($value);
> else
> $this->insert($value);
> }
>
> protected function insert($value) {
> echo "ClassA - insert\n";
> }
>
> protected function update($value) {
> echo "ClassA - update\n";
> }
>
> public function exists($value) {
> echo "ClassA - exists\n";
> return true;
> }
> }
>
> class ClassB extends ClassA {
> public function save($value, $classAValue) {
> echo "ClassB - save\n";
> parent::save($classAValue);
> // do some additional work...
> }
>
> public function exists($value, $classAValue) {
> // does a different search than ClassA
> echo "ClassB - exists\n";
> return true;
> }
> }
>
> $c = new ClassB();
> $c->save('test', 'test2');
> ?>
>
> --
> Richard Morris
> HDD Broker, Inc.
>
> Toll-Free: +1 866 960-3331
> International: +1 250 474-6022
> Fax: +1 250 474-6099
> E-Mail: richardhddbroker.com
> Web Site: www.hddbroker.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

Here you have defined $c as a ClassB object.
ClassB has all the functions and variables of ClassA, plus those of ClassB.
If you define a function in ClassB which has the same name as a function in
ClassA, it will override it.

"$this" refers to the ClassB object (even inside the ClassA function), since
you defined $c as a ClassB object. Therefore, the function exists() will be
the ClassB function.

I would suggest you rename the ClassB exists() function in order to do what
you want to do.

Here is a good example to play with that will help you understand
inheritance a bit better.

<?php
class a
{
   function showInfo()
   {
     print "I am class " . get_class($this) . ", my parent is "
.get_parent_class($this);
   }
}

class b extends a {}

class c extends b {}

$myInstanceB = new b();
$myInstanceB->showInfo();
print "<br />";
$myInstanceC = new c();
$myInstanceC->showInfo();

/*
output:
I am class b, my parent is a
I am class c, my parent is b
*/
?>

Good luck and I hope that helps :)

-B

attached mail follows:


> > Hi Richard,
> >
> > This is very strange. I can certainly reproduce the problem. Putting a
> > var_dump($this) in ClassA's save method shows that PHP sees $this as an
> > instance of ClassB - when it should be of ClassA.
>
> what *you* think it should be and what php's developers decided
> it should be
> about 3+ years ago obviously differ.
>
> if you have an instance of ClassB it is exactly that - refering to $this
> in the parent class definition won't magically make the class of
> the instance change.
>
> $this is plain this and not something else.

Yes, you are indeed correct.

I was thinking that as B extends A, A wouldn't know anything about B thus
$this in A would refer to A. I can now see that my logic was flawed here.
Thanks for pointing it out Jochem!

Richard, replacing your

  if ($this->exists($value))

with

  if (self::exists($value))

will call A's exists method, as you require. As Brad pointed out however,
your defintion of B overrides A's exists method. If you need both, then you
should rename the method in class B.

Edward

attached mail follows:


Edward Kay wrote:
>>> Hi Richard,
>>>
>>> This is very strange. I can certainly reproduce the problem. Putting a
>>> var_dump($this) in ClassA's save method shows that PHP sees $this as an
>>> instance of ClassB - when it should be of ClassA.
>> what *you* think it should be and what php's developers decided
>> it should be
>> about 3+ years ago obviously differ.
>>
>> if you have an instance of ClassB it is exactly that - refering to $this
>> in the parent class definition won't magically make the class of
>> the instance change.
>>
>> $this is plain this and not something else.
>
> Yes, you are indeed correct.
>
> I was thinking that as B extends A, A wouldn't know anything about B thus
> $this in A would refer to A. I can now see that my logic was flawed here.
> Thanks for pointing it out Jochem!
>
> Richard, replacing your
>
> if ($this->exists($value))
>
> with
>
> if (self::exists($value))
>
> will call A's exists method, as you require. As Brad pointed out however,
> your defintion of B overrides A's exists method. If you need both, then you
> should rename the method in class B.
>
> Edward
>

Using the self::exists(...) call instead of $this->exists(...) worked
perfectly. It threw me for a loop to see ClassA call a method in ClassB
even though ClassA has no reference to ClassB at design time. It is
probably why in other languages like C++ they use the virtual keyword to
identify this behaviour.

Can self::method(...)/self::$variable replace
$this->method(...)/$this->variable in all uses or are there cases where
you would need to use $this instead of self?

In another post Roman said that all non-private method are virtual in
PHP. If this is the case, I am assuming that the PHP architects would
want developers to use self:: in classes that could be subclassed with
method names that are the same as the parent(s)?

Thanks all for the help.

--
Richard Morris
HDD Broker, Inc.

     Toll-Free: +1 866 960-3331
International: +1 250 474-6022
           Fax: +1 250 474-6099
        E-Mail: richardhddbroker.com
      Web Site: www.hddbroker.com

attached mail follows:


Hello

I have been asked to do a compiler from PHP5 to C code using Lex and Yacc

I don't think i can find it already done and open source, but if i could get
the PHP grammar (in Lex/Yacc would be awesome) it would be a great help for
me, as the one i begin to write is full of conflicts.

Does anyone have a clue or hint ?

Thanks a lot folks !
Fred

attached mail follows:


http://phpcompiler.org/

----- Original Message -----
From: "yo plop" <spamamoigmail.com>
To: <php-generallists.php.net>
Sent: Wednesday, December 06, 2006 5:59 PM
Subject: [PHP] PHP Grammar

> Hello
>
> I have been asked to do a compiler from PHP5 to C code using Lex and Yacc
>
> I don't think i can find it already done and open source, but if i could
> get
> the PHP grammar (in Lex/Yacc would be awesome) it would be a great help
> for
> me, as the one i begin to write is full of conflicts.
>
> Does anyone have a clue or hint ?
>
> Thanks a lot folks !
> Fred
>

attached mail follows:


The Problem:

If I edit a php file with Microsoft Notepad and save with UTF-8 encoding
there is a problem with headers.

example:
<?php
header("Content-type: text/xml");
echo "<somexml/>";
?>

PHP tells me, that the header is already set, because of the (invisible)
BOM http://de.wikipedia.org/wiki/Byte_Order_Mark

I teach php and 50% of my students have this problems if they use UTF-8
encoding (depends on editor).

My Question:
------------
Is PHP UTF-8 ready?
Is there an other reason to stick on iso-8859-1 or ascii beside the BOM?
Is it a PHP bug, or is it a bug of the editor software?
 
thanks

Bernhard

attached mail follows:


Bernhard Zwischenbrugger wrote:.
> My Question:
> ------------
> Is PHP UTF-8 ready?
> Is there an other reason to stick on iso-8859-1 or ascii beside the BOM?
> Is it a PHP bug, or is it a bug of the editor software?
My opinion is that it is basically a code problem. You have data before
the "<?php" (the BOM), and PHP is outputting it as such. How is PHP
supposed to know that you didn't intend to ouput a BOM? It could be an
intentional thing, e.g. output of a UTF-8 text file:

<?php
header('Content-type: text/plain; charset=utf-8');
include('file-with-BOM.php');

In your case, it is an unwanted side-effect. The answer, I believe,
should be to educate your student about the BOM and recommend the use of
an editor that is a little smarter about UTF-8 output. When I use
Windows (which is rarely), I use Notepad++, which gives you the option
to save files as UTF-8 with or without the BOM.

jon

attached mail follows:


Hi,

I've been happily using the Free PHP Accelerator for years now, and I
recently updated to php 4.4, and I get the following error :

the ionCube PHP Accelerator requires Zend Engine API version 20021010.
The Zend Engine API version 20050606 which is installed, is newer.
Contact Nick Lindridge at http://www.php-accelerator.co.uk for a later
version of the ionCube PHP Accelerator.

but when I go to that site, nothing has been updated for several years now.

Is this product still available in the same form??? or has it been
replaced ???

Thanks,

Tim.

attached mail follows:


On Wed, 2006-12-06 at 11:30 -0800, Tim Traver wrote:
> Hi,
>
> I've been happily using the Free PHP Accelerator for years now, and I
> recently updated to php 4.4, and I get the following error :
>
> the ionCube PHP Accelerator requires Zend Engine API version 20021010.
> The Zend Engine API version 20050606 which is installed, is newer.
> Contact Nick Lindridge at http://www.php-accelerator.co.uk for a later
> version of the ionCube PHP Accelerator.
>
> but when I go to that site, nothing has been updated for several years now.
>
> Is this product still available in the same form??? or has it been
> replaced ???

It's dead. Alternatives such as Eaccelerator and APC exist.

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. |
`------------------------------------------------------------'

attached mail follows:


How can I ensure that a variable contains a postive integer number?
I'm currently using this code:

$number=(10000-$number);
$number=(10000-$number);
if ( $number<1 ) { $number=1; }

But I'm sure that there is a better way. What would that be?

Dotan Cohen

http://what-is-what.com/what_is/internet.html
http://song-lirics.com/

attached mail follows:


On 06/12/06, Melanie Maddix <melanie.maddixenermajica.com> wrote:
> [snip]
> How can I ensure that a variable contains a postive integer number?
> [/snip]
>
> Hi Dotan,
>
> Check the php manual for is_int() and is_numeric().
>

Thanks, Melanie. I completely forget- I already knew about those
functions! That's what happens when one scripts in a language
with 3000+ built-in functions... :)

Dotan Cohen

http://lyricslist.com/
http://what-is-what.com/what_is/bios.html

attached mail follows:


> How can I ensure that a variable contains a postive integer number?
> I'm currently using this code:
>
> $number=(10000-$number);
> $number=(10000-$number);
> if ( $number<1 ) { $number=1; }
>
> But I'm sure that there is a better way. What would that be?

this will check that $input is a positive integer.

if(preg_match("/^\d+$/", $input)) {
        // OK
} else {
        // NOT OK
}

attached mail follows:


I think that will only check for a digit value of some kind. It's not
going to check that $input is positive or if it is an integer. For
instance, it could be a negative float value as long as $input is
interpreted as a float and not a string. The period would throw it off
it it's a string. I'd have to test, but anyway you could do something
like this:

<?php
function isPositiveInteger($input) {
$integer = floor($input);
$decimal = $input - $integer;
$returnVal = true;

if ($input < 0) {
        $returnVal = false;
}

if ($decimal != 0) {
        $returnVal = false;
}

return $returnVal;

}

?>

That should work. There might be a bug in there, but I'll leave that up
to people to test it ;)

--
Ray Hauge
Application Development Lead
American Student Loan Services
www.americanstudentloan.com

-----Original Message-----
From: Brad Fuller [mailto:bfullercpacampaigns.com]
Sent: Wednesday, December 06, 2006 2:20 PM
To: 'php php'
Subject: RE: [PHP] Ensuring that variable contains a number

> How can I ensure that a variable contains a postive integer number?
> I'm currently using this code:
>
> $number=(10000-$number);
> $number=(10000-$number);
> if ( $number<1 ) { $number=1; }
>
> But I'm sure that there is a better way. What would that be?

this will check that $input is a positive integer.

if(preg_match("/^\d+$/", $input)) {
        // OK
} else {
        // NOT OK
}

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

attached mail follows:


On 06/12/06, Ray Hauge <ray.haugeamericanstudentloan.com> wrote:
> I think that will only check for a digit value of some kind. It's not
> going to check that $input is positive or if it is an integer. For
> instance, it could be a negative float value as long as $input is
> interpreted as a float and not a string. The period would throw it off
> it it's a string. I'd have to test, but anyway you could do something
> like this:
>
> <?php
> function isPositiveInteger($input) {
> $integer = floor($input);
> $decimal = $input - $integer;
> $returnVal = true;
>
> if ($input < 0) {
> $returnVal = false;
> }
>
> if ($decimal != 0) {
> $returnVal = false;
> }
>
> return $returnVal;
>
> }
>
> ?>
>
> That should work. There might be a bug in there, but I'll leave that up
> to people to test it ;)
>
> --
> Ray Hauge
> Application Development Lead
> American Student Loan Services
> www.americanstudentloan.com
>
> -----Original Message-----
> From: Brad Fuller [mailto:bfullercpacampaigns.com]
> Sent: Wednesday, December 06, 2006 2:20 PM
> To: 'php php'
> Subject: RE: [PHP] Ensuring that variable contains a number
>
> > How can I ensure that a variable contains a postive integer number?
> > I'm currently using this code:
> >
> > $number=(10000-$number);
> > $number=(10000-$number);
> > if ( $number<1 ) { $number=1; }
> >
> > But I'm sure that there is a better way. What would that be?
>
>
> this will check that $input is a positive integer.
>
> if(preg_match("/^\d+$/", $input)) {
> // OK
> } else {
> // NOT OK
> }

Thanks. As the 'number' is used in a for loop, it actually is alright
if it is a float. I just added a check that the number is indeed >=1,
otherwise I set it to 1. Good enough for this project, anyway... :)

Dotan Cohen

http://what-is-what.com/what_is/ajax.html
http://english-lyrics.com/

attached mail follows:


Hi,

 

Are there any general protection methods to minimize the risk of robots
using your mailing forms as spam senders?

 

/Peter

 

 

 

attached mail follows:


Except the check for \n and \r? I mean any class that you think is good
doing this? Is PHP Mailer doing any check of its variables?

/Peter

-----Original Message-----
From: Peter Lauri [mailto:listsdwsasia.com]
Sent: Wednesday, December 06, 2006 11:10 PM
To: php-generallists.php.net
Subject: [PHP] How to not be abused by mail form injectors?

Hi,

 

Are there any general protection methods to minimize the risk of robots
using your mailing forms as spam senders?

 

/Peter