I’ve worked on a LOT of crap code in my day and honestly I’ve probably learned as much from the crap as from the best practices and coding style guides.
HOWEVER…
Finding these two functions in the same file of the open source application osDate really has me wondering WTF?
function getOnlineStats($userid) {
global $osDB;
$onl = $osDB->getOne(‘SELECT count(*) FROM ! WHERE userid = ?’, array(ONLINE_USERS_TABLE, $userid));
if ($onl > 0) {return true;}
return false;
}
function checkOnlineStats( $userid ) {
global $osDB;if ( $osDB->getOne( ‘SELECT count(*) as num FROM ! WHERE userid = ?’, array( ONLINE_USERS_TABLE, $userid ) ) ) {
return ‘online’;
}
else {
return ‘offline’;
}
}
Oh, and apologies that the code formatting plugin I spent so much time installing some time ago isn’t working now.