PHP Easter Eggs!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
SystemWisdom
Forum Commoner
Posts: 69
Joined: Sat Mar 26, 2005 5:54 pm
Location: A Canadian South of the 49th Parallel

PHP Easter Eggs!

Post 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)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

$_SERVER['QUERY_STRING'] would be a starting point to look at.
User avatar
SystemWisdom
Forum Commoner
Posts: 69
Joined: Sat Mar 26, 2005 5:54 pm
Location: A Canadian South of the 49th Parallel

Post 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.. :(
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
User avatar
SystemWisdom
Forum Commoner
Posts: 69
Joined: Sat Mar 26, 2005 5:54 pm
Location: A Canadian South of the 49th Parallel

Post 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!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

use mod_rewrite.. those are parsed before php even hears the query.
User avatar
SystemWisdom
Forum Commoner
Posts: 69
Joined: Sat Mar 26, 2005 5:54 pm
Location: A Canadian South of the 49th Parallel

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it would need to be attached to your instance of Apache, but all you need after that is an .htaccess file.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

might want to make sure your host has the mod rewrite module installed and enabled
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

isn't that what I just said? :?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

oopsie :oops:
User avatar
SystemWisdom
Forum Commoner
Posts: 69
Joined: Sat Mar 26, 2005 5:54 pm
Location: A Canadian South of the 49th Parallel

Post 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!
Post Reply