Tuesday, June 24, 2008

FirePHP

FirePHP enables you to print to your Firebug Console using a simple PHP function call.



What makes FirePHP different?



All data is sent via a set of X-FirePHP-Data response
headers. This means that the debugging data will not interfere with the
content on your page. Thus FirePHP is ideally suited for AJAX
development where clean JSON or XML responses are required.



Requirements










PHP: 5 Firefox: 2, 3 Firebug: 1.05, 1.1, 1.2

http://firephp.org/

PHPIDS

PHPIDS (PHP-Intrusion Detection System) is a simple to use, well
structured, fast and state-of-the-art security layer for your PHP based
web application. The IDS neither strips, sanitizes nor filters any
malicious input, it simply recognizes when an attacker tries to break
your site and reacts in exactly the way you want it to. Based on a set
of approved and heavily tested filter rules any attack is given a
numerical impact rating which makes it easy to decide what kind of
action should follow the hacking attempt. This could range from simple
logging to sending out an emergency mail to the development team,
displaying a warning message for the attacker or even ending the user's
session.


PHPIDS enables you to see who's attacking your site and how and all
without the tedious trawling of logfiles or searching hacker forums for
your domain. Last but not least it's licensed under the LGPL!

http://php-ids.org/

The five levels of leadership

(ORDER BY levels DESC)

5 - Position (Title) "Rights"
People follow because they have to.
Your influence will not extend beyond the lines of your job
description. The longer you stay here, the higher the turnover and
lower the morale. People begin to limit you, to put fences around you.
You can't stay here more than two years.


4 - Permission "Relationship"
People follow because they want to. People will follow you beyond your stated authority. This level allows work to be fun.
Caution: Staying too long on this level without rising will cause highly motivated people to become restless.


3 - Production "Results"
People follow because of what you have done for the organization.
This is where success is sensed by most people. They like you and what
you are doing. Problems are fixed with very little effort because of
momentum. (Don't ; let the momentum stop!).


2 - People Development "Reproduction"
People follow because of what you have done for them personally.
This is where long-range growth occurs. Your commitment to developing
leaders will ensure ongoing growth to the organization and to people.
Do whatever you can archive and stay on this level.


1 - Personhood "Respect"
People follow you because of who you are and what you represent.
This step is reserved for leaders who have spent years growing people
and organizations. Few make it. Those who do are bigger than life!


-- Dr John Maxwell, Developing the leader within you

Thursday, June 05, 2008

PHP HTTP Headers / content-type

// See related links for more status codes

// Use this header instruction to fix 404 headers
// produced by url rewriting...
header('HTTP/1.1 200 OK');

// Page was not found:
header('HTTP/1.1 404 Not Found');

// Access forbidden:
header('HTTP/1.1 403 Forbidden');

// The page moved permanently should be used for
// all redrictions, because search engines know
// what's going on and can easily update their urls.
header('HTTP/1.1 301 Moved Permanently');

// Server error
header('HTTP/1.1 500 Internal Server Error');

// Redirect to a new location:
header('Location: http://www.example.org/');

// Redriect with a delay:
header('Refresh: 10; url=http://www.example.org/');
print 'You will be redirected in 10 seconds';

// you can also use the HTML syntax:
// <meta http-equiv="refresh" content="10;http://www.example.org/ />

// override X-Powered-By value
header('X-Powered-By: PHP/4.4.0');
header('X-Powered-By: Brain/0.6b');

// content language (en = English)
header('Content-language: en');

// last modified (good for caching)
$time = time() - 60; // or filemtime($fn), etc
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT');

// header for telling the browser that the content
// did not get changed
header('HTTP/1.1 304 Not Modified');

// set content length (good for caching):
header('Content-Length: 1234');

// Headers for an download:
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="example.zip"');
header('Content-Transfer-Encoding: binary');
// load the file to send:
readfile('example.zip');

// Disable caching of the current document:
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Pragma: no-cache');

// set content type:
header('Content-Type: text/html; charset=iso-8859-1');
header('Content-Type: text/html; charset=utf-8');
header('Content-Type: text/plain'); // plain text file
header('Content-Type: image/jpeg'); // JPG picture
header('Content-Type: application/zip'); // ZIP file
header('Content-Type: application/pdf'); // PDF file
header('Content-Type: audio/mpeg'); // Audio MPEG (MP3,...) file
header('Content-Type: application/x-shockwave-flash'); // Flash animation

// show sign in box
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm="Top Secret"');
print 'Text that will be displayed if the user hits cancel or ';
print 'enters wrong login data';