Page 1 of 1

PHP Easter Eggs!

Posted: Sat Apr 02, 2005 11:02 am
by SystemWisdom
It was Easter, so of course I went on a PHP Easter Egg Hunt, and found 4 whole eggs!! Yay! :P

Anyway, I just wanted to share my findings here with all of you!

I found this posted somewhere (forget where):
If anyone is wondering where the eggs are at in the source code, they are in: ext/standard/info.h

#define PHP_LOGO_GUID "PHPE9568F34-D428-11d2-A769-00AA001ACF42"
#define PHP_EGG_LOGO_GUID "PHPE9568F36-D428-11d2-A769-00AA001ACF42"
#define ZEND_LOGO_GUID "PHPE9568F35-D428-11d2-A769-00AA001ACF42"
#define PHP_CREDITS_GUID "PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000"
So as far as I know, there are only 4 eggs in PHP and they can be viewed on any PHP site that has 'expose_php' enabled.

Example (from my site):
http://xero.mercury-admin.com/index.php?=PHPE9568F36-D428-11d2-A769-00AA001ACF42
(I read somewhere that the picture is Version Dependent)

Now, what I want to do, is hook all 4 and display my own egg, the problem is that it seems PHP itself parses it first before my script can hook it :( very sad..

The other problem with hooking them is that they have no GET variable name, only a value (notice ?=PHP..) and my attempts at the following only fail:

Code: Select all

if( in_array( 'PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000', $_REQUEST ) )
{
    // blah blah blah..
}
So now I am wondering; does anyone have any idea how to hook those eggs in your own PHP scripts (without writing a module) that they would like to share?? :D

I am still trying, and if I find a way I will post it!

(seems like the right forum, I appologize if this post should be elsewhere)

Posted: Sat Apr 02, 2005 11:11 am
by feyd
$_SERVER['QUERY_STRING'] would be a starting point to look at.

Posted: Sat Apr 02, 2005 11:30 am
by SystemWisdom
Thanks, was a good idea, but failed none the less..

I tried:

Code: Select all

if( strpos( $_SERVER['QUERY_STRING'], 'PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000' ) !== false )
{
    die( 'It worked!!' );
}
And it didn't work.. I got the credits page.. :(
PHP is still parsing it before my script can..
I probably need to write a small module, but my host won't allow me to use it.. :(

Posted: Sat Apr 02, 2005 11:32 am
by feyd
why not just create your own easter egg?

I don't even think writing a module will do anything, as you shouldn't be able to overload the GUID's.. they are built into PHP's core itself.

Posted: Sat Apr 02, 2005 11:38 am
by SystemWisdom
:cry: Bummer..

I don't want to create my own, because I want to cover up the eggs that already exist.. for example, I am building a Site Engine and I wanted to have it display my Engine's credits instead of PHPs credits when queried.. and basically the same for the other eggs too, just as a way to expose less of PHP.. (my host wont turn expose_php off)

But I guess the makers of PHP already thought of that too, and decided not to allow scripts/modules to alter them.. makes sense!!

Ths for the help!

Posted: Sat Apr 02, 2005 11:48 am
by feyd
use mod_rewrite.. those are parsed before php even hears the query.

Posted: Sat Apr 02, 2005 3:59 pm
by SystemWisdom
I would need access to httpd.conf then wouldn't I? and unfortunately I don't have that.. or can I just create that file in my root web-folder?

Posted: Sat Apr 02, 2005 4:23 pm
by feyd
it would need to be attached to your instance of Apache, but all you need after that is an .htaccess file.

Posted: Sat Apr 02, 2005 4:40 pm
by John Cartwright
might want to make sure your host has the mod rewrite module installed and enabled

Posted: Sat Apr 02, 2005 4:48 pm
by feyd
isn't that what I just said? :?

Posted: Sat Apr 02, 2005 4:50 pm
by John Cartwright
oopsie :oops:

Posted: Sat Apr 02, 2005 8:07 pm
by SystemWisdom
:cry: Thx anyways guys.. My host doesn't have mod_rewrite I just found out.. I guess I shouldn't worry about it anyway.. But I did add my own simple easter egg to my engine for the credits.. it was a good idea in the end feyd, thx!