I can only agree with dbwiz ,
It's true that you can write bad code in every language, but PHP makes things really easy for bad coders.
Update:Fixed wrong order blockquote,italic tags. Thanks Fletch.
I submit the following example I was confronted with recently after migrating an 'acquired' companies site from a Cobalt. Names have been changed to protect the guilty. I'm trying to discover why and how much they paid for this abortion.
I discussed with the developer the register_globals-ness of this code and it's reliance on php4.2.x session side effects and other things. His suggestion to
Best thing is look at the php.ini file on the old server.
Also make sure the versions of php and mysql are the same.
Yeah - php and mysql circa 2002. This message broke the light barrier on it's way my supervisor.
<?
//////////////////////////////////////////////////////////////////////
+//////////
//
// Filename: session.php
// Author: Smee Again (ANONYMIZED@MERCHANT.COM)
// Created: 01.Mar.2003
// Purpose:
//
// Notes:
//
//
//
// Changes:
//
//////////////// Lasciate ogni speranza voi ch'entrate /////////////
+//////////
include_once("../class/engine/page.class");
include_once("../class/engine/security.class");
class Session {
var $security;
var $url;
var $test;
var $acid;
var $language;
function Session() {
$this->security = new Security;
$acid = "";
$language = "english";
}
function is_admin() {
return true;
}
function page_open() {
// check for any routing
echo "page open: route: " .$this->url;// die();
if ($this->url != "") {
header("Location: $this->url");
}
}
function page_close() {
// kill any routing
//$this->url = "";
}
function route($url) {
$this->url = $url;
}
};
?>
I particularly like
- the boilerplate cargo cult'd from ???
- the purpose definition in the boilerplate
- function is_admin
- function page_close
I can't believe it's not psellchecked