Easy solutions and ideas found after long googling or hard coding

Ban IP from logging in for 5 minutes after 10 failed logins

if( login_limit() )
   die( 'Your IP has been banned from logging in for the next 5 minutes' );

 * Counts login times by same IP 
 * returns true if limit reached or false if not 
function login_limit(){
    //get real IP if user behind proxy noted by Sebastian Enger
    //user still banned from login
    if( _cache( $ip . 'banned' ) )
        return true;

    //number of seconds 
    $sec = 30;
    //find ip info array in cache saved less than $sec ago
    if( ($ip_info=_cache( $ip ))  && $ip_info[0] > time()-$sec ){
        //user login 10 times during last $sec 
        if(  $ip_info[1] > 10 ){
            //ban user ip for the next 5 minutes
            _cache( $ip . 'banned', 1, 0, 60*5 );
            _cache( $ip, -1 );
            return true;
        //increase login retries +1 
        _cache( $ip, array(  $ip_info[0],   ++$ip_info[1] ), 0, $sec );
        return false;
    //add ip info to cache
    _cache( $ip, array( time(), 1 ), 0, $sec );
    return false;

function _cache( $name, $val=NULL, $ttl=false ){
	global $mcdb;
	if(empty($mcdb) ) 
		$mcdb = memcache_connect('unix:///etc/sockets/memcached.sock', 0);
	if($val === -1){
		return memcache_delete($mcdb,$name);
	}elseif( $val !== NULL ){
		return memcache_set($mcdb,$name,$val, false, $ttl);
		$retval = memcache_get($mcdb,$name);
		return  $retval ? $retval : NULL;


Convert vBulletin DB encoding to UTF-8

great help @

these are the exact commands that worked for me

jQuery plugin : monnaTip 0.1

This the simplest tooltip jQuery plugin you can find around.

  • takes advantage of live(), mouseenter and mouseleave methods
  • tracks mouse movement
  • right and bottom viewport border tracking
  • can be applied on any element

DemodownloadGoogle codeGitHub

Configure sendmail to accept emails only if “from”, “to” or specific field matches

you can exclude an email address or even a host that is spamming you using the access file located in your etc directory, the bad news is that it does not support regex or even wildcards.

Remotley start programs on your Linux Desktop

It is very easy to start programs remotely on your windows desktop from another computer but running X11 application on Linux from another ssh session would start a new X11 session on your remote machine, that was a problem for me and here is how I solved that…..