Linkify all urls in text with php

It is a good idea to convert all urls into links in your web application like contact form, comment forms, chat application etc. To find and replace all urls with their links we will use php preg_replace function. See below example

$text = "Hello Friends my website url is";
$text = preg_replace("~[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]~",'<a href="$0">$0</a>',$text);
echo $text;

Hello Friends my website url is

Disable content selection on web page using jquery

In previous article we learned how to prevent our blog content from copying by disabling right click on web page. Now in this article i will show you how to disable content selection on web page using jQuery.

To  disable content selection on web page follow these steps Continue reading “Disable content selection on web page using jquery”

Disable right click on web page using jquery

Most webmasters want to protect their blog content from plagiarism. To protect blog content from copying we can do following to things.

  1. Disable right click on web page
  2. Disable content selection

as this is not 100% full proof way to protect your content from copying, Because  these methods require JavaScript and user can disable JavaScript to copy the content. Continue reading “Disable right click on web page using jquery”

Add extra contact method in wordpress user profiles

WordPress has only two contact fields in users profile that is email and website. That may not be sufficient as there are many social networking sites (like Google+,facebook, twitter etc) are available to connect with users. We can add more contact methods in contact info section. To add more fields edit functions.php file in your WordPress theme folder and add below code.

function new_contactmethods( $contactmethods ) {
    $contactmethods['twitter'] = 'Twitter'; // Add Twitter
    $contactmethods['facebook'] = 'Facebook'; // Add Facebook
    $contactmethods['google'] = 'Google+'; // Add Google+
    return $contactmethods;

Above code will add Twitter, Facebook and Google+ fields in contact info section

Trick to get indexed by Google fast

Are you a webmaster and want to index your website by Google in few hours? Then you are at right place.

Most of the new webmasters have one question: “Why does Google not find my website”. In most of the cases it is due to the fact that your website is not yet indexed by the Google. The Google bot will take some time to find this new website and then only it can index it.  However, you don’t have to wait until Google finds it… You can tell Google about your new website if Google can’t find it. Continue reading “Trick to get indexed by Google fast”

Bulk domain availability checker script

Pure php based domain availability checker script. This script can check domain availability without whois lookup. And supports all TLDs over internet

How it works?

Each registered domain has its own ns (name server) entry. Which can be checked using dns_get_record() function. In this script we check whether queried domain has it ns entry or not if we found it then it is not available. Continue reading “Bulk domain availability checker script”

Get rid of mysql sleep process

Some times there are many many sleep processes in your SQL connection. These sleep connections consume a lot of resources (RAM, cache and processor). This can cause your MySQL server slow down. If your MySQL server is not responding then the query to the database will take a lot of time. In such situations, your website will open very slowly. Continue reading “Get rid of mysql sleep process”