How to detect browser no flash give alternate with gif

Let see, we have one file .swf and one file .gif and we want display the flash file first, and if the browser doesn't support, it will display the .gif version.
Here is the code.

JAVASCRIPT CODE:

How to pick a complex string from MySQL

We can pick a string from MySQL database with various style.
Example, the value from database is NCABZ-2007
And we want only view ABZ
Here is the CODE.
PHP CODE:

$data = "NCABZ-2007";
$new_data = substr($data, 2 , 3);

Explain:
2 = number of data from the left (N=0, C=1, A=2, B=3, etc.)
3 = how much char we want to display

PHP Cut string from MySQL

Shorting or cutting the text string from long char into new max lenght.
Here is the code.
PHP CODE

function short_string ($var, $len){    
if (strlen ($var) < $len) {
return $var;
}
if (preg_match ("/(.{1,$len})\s/", $var, $match)) {
return $match [1] . "..";
} else {
return substr ($var, 0, $len) . "..";
}
}


How to use?
PHPCODE
short_string ("Very very long text is here blablabla", 14);


The Result is:
Very very long..

Insert and Select doing in MySQL from SQL Injection

Here is the save way from RSS Attack SQL Injection.
Get all variable $_POST or $_GET or $_REQUEST or $_SESSION convert into mysql_real_escape string filter, you do not need one by one for all type variable.
here is code.
PHP CODE

$_POST  = array_map('mysql_real_escape_string', $_POST);
$_SESSION = array_map('mysql_real_escape_string', $_SESSION);
$_COOKIE = array_map('mysql_real_escape_string', $_COOKIE);


And here is to view back or mysql_unescape_string or mysql_real_unescpae_string or whatever you want to.
PHP CODE
function mysql_real_unescape_string($string){
$string=trim($string);
$string=str_replace("\\","",str_replace("\$","",$string));
return $string;
}

Convert TEXT2HEX

Here is a php script snippet to convert string text to hex decimal code.
PHP CODE

function text2hex($string) {
$hex = '';
$len =
strlen($string) ;
for ($i = 0; $i < $len; $i++) {
$hex .=
str_pad(dechex(ord($string[$i])), 2, 0, STR_PAD_LEFT);
}
return $hex;
}

QuiXplorer - web-based file-management

The best Filemanagement system PHP what i choose is QuiXplorer.
Here is the detail from contributor:

QuiXplorer is a multi-user, web-based file-manager.
It allows you to manage and/or share files over the internet, or an intranet.

The latest version provides the following functionality:

  • Browsing directories; showing names, file sizes,
    file types, modification times and permissions
  • Copying, moving and deleting files
  • Searching for files and directories
  • Uploading and downloading files
  • Editing text files
  • Creating new files and directories
  • Changing file permissions
In multi-user mode:
  • Users are authenticated.
  • Administrators can manage users.
  • Each user has his/her own settings.
QuiXplorer is currently available in English, Dutch, German, French, Spanish and Russian.

Screenshoot:
Source: http://quixplorer.sourceforge.net

TinyMCPUK - TinyMCE with file/image manager

The Best WYSIWYG now for me is TinyMCPUK.
Reason:
1. Small file size
2. Complete Editor
3. Image Manager and Image Editor

Here is the detail information from the contributor:

TinyMCPUK brings you the powerful TinyMCE plus the MCPUK file manager and ImageManager strictly integrated together.

Details

TinyFCK package contains:

  • a TinyMCE release (absolutely not patched, this is the original TinyMCE)
  • a patched version of Martin Kronstad’s MCPUK/ImageManager integration
  • an example documenting configuration

TinyKCPUK is only available for PHP.

Screenshots

Download

TinyMCPUK 0.1 is updated with TinyMCE 2.0.6.1.

Source: http://p4a.crealabsfoundation.org/tinymcpuk