Bookmark Site script

This is a cross browser (Firefox 1.x+, IE4+ and Opera7+) script for allowing the user to easily bookmark your site, by clicking on a link on the page.


<script type=”text/javascript”>
function bookmarksite(title,url){
if (window.sidebar) // firefox
window.sidebar.addPanel(title, url, “”);
else if(window.opera && window.print){ // opera
var elem = document.createElement(‘a’);
else if(document.all){// ie
window.external.AddFavorite(url, title);
else if (navigator.appName==”Netscape”) {
alert(“Please click OK, then press <Ctrl-D> to bookmark this page.”);


Step 2: Create either an image or text link that will be used as the Bookmark Site link. For the href attribute, use the following code:

javascript:bookmarksite('title_of_site', 'url_of_site')

Here’s an example:

<a href=”javascript:bookmarksite(‘Karuppasamy\’s site’, ‘;)”>Bookmark this site!</a>

Remember, if your site’s title contains apostrophes, they need to be backslashed when entered:

<a href=”javascript:bookmarksite(‘karuppasamy\’s Place’, ‘;)”>Bookmark this site!</a>

How to create WordPress Plugin from a scratch

WordPress blogs are getting more popular then ever, there are literally hundreds of new weblogs popping up everyday. However WordPress is not a new software, so I think it is about time to learn how to create decent plugins for it, and once you learn how to write plugins you will discover that this is not only fun but can be very profitable as well.

I want to show you how to write very simple WordPress (WP) plugin. General purpose behind every plugin is to enhance WP possibilities in some way or another, so I started to think: what kind of plugin will contain no more then 100 lines of code, (so someone who is new to WordPress API won’t get lost in tons of code) and will be somewhat useful at the same time.

I decided that together we will write plugin which will count search engine bots visits.

Let me explain shortly what I mean by “search engine bots”, every search engine has some kind of bot that is responsible for indexing pages on the Internet, and as you probably already know there is no other way of indexing pages, then visiting them via HTTP protocol. Basically that makes all bots virtual Internet users, the one thing that makes them different from real Web users is the fact that bots use other browsers then us.

For example Googlebot uses Web browser that is compatible with Firefox, but it’s name is actually “googlebot” and we can check that with $_SERVER[‘HTTP_USER_AGENT’] variable.

Knowing this info we will want to design our plugin in a way that, every time WordPress page is loaded our plugin will check this variable to find out if person which is currently viewing our site is bot or real person. If bot then script will increase bot visits count variable (which we will store in database).

That’s it. Nice little plugin. I know it maybe very easy for you to write such script, but our goal is actually not the script itself. Our goal is to understand how WordPress plugin API works, this is what is important not the code.

If I convinced you to reading further this article then great, I am confident you will enjoy it.

Let’s get started.

If you didn’t installed WP on your localhost or yet, then go get it at do not make a common mistake of thinking that you can understand everything by just reading this text, you will actually need to do the work.

First thing we need to know is where to put our plugin, WordPress programmers selected specific folder for all plugins, if you start browsing directory with your WP files you will find out by yourself that all plugins located here:


Note that it is not necessary to create new folder for your plugin, you can put your files straight into plugin directory, but I think it is good to do so only, if your plugin consists from one file.

We will use two files so let’s create directory and name it “bot”.

You maybe thinking if there will be more then one file in a directory how will WordPress know which file to use, which file should be started first?

This is a great question, with very simple answer: files which are treated by WP as main plugin files are those with specific info called: standard plugin information header. You won’t make your plugin work without this information, mainly because, WordPress will have no idea that your plugin exists, and it will not be listed at Plugin Management page, so you won’t be able to activate it.

My information header looks like this:

Plugin Name: Bot Counter
Plugin URI:
Description: Plugin is counting bots visits
Author: Karuppasamy
Version: 1.0
Author URI:

You are of course free to edit these information, but do not remove any line, they all need to stay within our file it is very important. If you wish to you can copy and paste these info to your file and save it as “bots.php” in our “bot” directory, it should look like this:


Now you can go to admin area, select plugins page, browse available plugins and you will find out that list of plugins already contains your plugin, more over it looks like it is ready to be activated.

However we know it actually do nothing, so we need to “teach” our plugin what to do and when. These is very simple thanks to “Plugin Hooks”.

Let me explain it. You can think of every Plugin Hook as an action, and in WP action can almost anything: publishing post, editing comment, loading header and so on. However all actions are predefined by WordPress programmers, so you can’t write whatever you want. For more info on this checkout for complete list of actions.

When we finally choose an action that suits as best, we need to assign function to it, we do this by using add_action($predefined_plugin_hook, $our_function_name); command. Predefined plugin hook is one of the actions, while “function name” is function which we wrote, or which we will wrote in our case.

Enough talking it is time to write some code, let’s start with function, which will be responsible for creating additional table in our database and populating it with two records. In this table we will keep information about different bots and their visits number.

function bot_install()
    global $wpdb;
    $table = $wpdb->prefix."bot_counter";
    $structure = "CREATE TABLE $table (
        bot_name VARCHAR(80) NOT NULL,
        bot_mark VARCHAR(20) NOT NULL,
        bot_visits INT(9) DEFAULT 0,
	UNIQUE KEY id (id)
    // Populate table
    $wpdb->query("INSERT INTO $table(bot_name, bot_mark)
        VALUES('Google Bot', 'googlebot')");
    $wpdb->query("INSERT INTO $table(bot_name, bot_mark)
        VALUES('Yahoo Slurp', 'yahoo')");

I admit, whole script can be written without using MySQL and it would be much better solution then creating additional table like we did, but again it is not about the script it is about learning WordPress API, and I thought: if you will want to write plugin by yourself later then you will be probably using MySQL, so I decided to show you how WP want us to do it.

About our function, it’s name can be whatever you want I choose bot_install, because this is what this function really do (installs our plugin), but you can name func1 as well, it is not how you name it, but rather how you assign it to certain Plugin Hook, however it is good practice to avoid function names that were already used by WordPress programmers, then try keeping your function names unique.

Earlier i talked about assigning function to certain action, so how to do it and which action choose?

Obviously we want action that will run once, possibly right after activating our plugin, we do not want to create new tables over and over again, so our best shot will be “activate” Plugin Hook, but be careful these one is a bit tricky.

All of WordPress actions are predefined, all except these one. Look at the code:

add_action('activate_bot/bots.php', 'bot_install');

Like was said before first argument is Plugin Hook, it is let’s call it half predefined, what I mean by this is simply that first part ‘activate_’ is constant, but second part of argument is a path to script which contains activate function. We keep our install function in the same file as the rest of functions so we need to point to file we are editing right now.

Also note that you need to use relative path, WordPress knows that install file must be located somewhere in wp-content/plugins/ directory, so we only need to show him which file in these directory it really is.

Second argument is our function name, nothing more nothing less.

Inside our bot_insall function we use global variable $wpdb, it is object responsible for communication with database, of course we still can use old fashioned mysql_query() instead of $wpdb->query(), but let’s make these script like WordPress team wanted us to make it look.

I believe I do not have to comment on the rest of the code there are only three MySQL queries so I am confident you easily understand what these script do.

If we activate our plugin now, bot_install function will start, additional table will be created and some data will be added, finally our plugin can actually do something, besides being visible in admin area.

Now we will create function which will be responsible for counting bots visits:

function bot()
    global $wpdb;
    $browser_name = $_SERVER['HTTP_USER_AGENT'];
    $bots = $wpdb-&gt;get_results("SELECT * FROM ".
    foreach($bots as $bot)
        if(eregi($bot-&gt;bot_mark, $browser_name))
            $wpdb-&gt;query("UPDATE ".$wp->prefix."bot_counter 
                SET bot_visits = bot_visits+1 WHERE id = ".$bot->id);

This is very simple as well, first we make $wpdb variable “visible” for our function by making it global. Then we select all data from table we created earlier and we loop thru results by using foreach. When it turns out that $browser_name, contains $bot->bot_mark value, then script makes query which increases bot_visits field value by one, then we brake foreach because it is impossible to have two bots using one browser.

When I first wrote these function I assigned it to wp-head Plugin Hook, it means that WordPress will start this function when header is loading, but then I decided to reassign it to wp-footer action because this function will only make simple operations in our database without even showing results to visitor, so I think you will agree with me on this one, that it is good idea to send page to client first and then call these function. It will actually save some time to our visitor which is always great

add_action('wp_footer', 'bot');

Almost everything is ready, new table can be created by our plugin, bots visits are counted now we want to see how many bots visited our blog, but we want these data to be visible only to blog admin and displayed in administration area.

Sounds like a lot of work? Actually it is NOT. WordPress programmers created set of Plugin Hooks that will allow us to add pages to admin area, this new pages will be automatically shown in admin panel in appropriate category which is selected by us .

First we need to write a function which will create whole layout for our new page at admin site, then we need to use add_option_page(…) function, but we have to add it within some kind of let’s call it “container”. What is ths container? Basically container is another function which has got set of add_option_page(…) commands within it.

Note that we are not limited to creating only one additional admin page, by using container we are able to create many pages in different categories, for example one in “users” category and another in “options” category. However we are writing quite small plugin so we will create only one additional page.

function bot_menu()
    global $wpdb;
    include 'bot-admin.php';
function bot_admin_actions()
    add_options_page("Bot Counter", "Bot Counter", 1,
"Bot-Counter", "bot_menu");
add_action('admin_menu', 'bot_admin_actions');

Look at bot_menu function it includes bot-admin.php file which currently does not exists, but this is not important for now, we will create it a bit later.

More interesting then bot_menu is bot_admin_actions function – this is our container.

Whole code works like that: first add_action function is run with Plugin Hook admin_menu, so WordPress knows that something will be added to admin menu. What will be added? He have to check it by executing bot_admin_actions function, second parameter of add_action, bot_admin_function tells WordPress that he have to add to options page (add_option_page) new menu item named “Bot Counter” and when user will click these menu item then WordPress will have to get code for it from bot_menu function, simple isn’t it?

But in order to make it work we have to create bot-admin.php file, because bot_menu uses it, so let’s create this file and put some code into it:

<?php query("UPDATE ".$wpdb->prefix."bot_counter SET bot_visits = 0");?>
<div id="message">
Bot Counter Stats <strong>Reseted</strong>.</div>
<h2>Bot Counter Admin</h2>
get_results("SELECT * FROM ".$wpdb->prefix."bot_counter");
foreach($results as $result)
    echo $result->bot_name." : ";
    echo $result->bot_visits."";
<a href="?page=<?php echo $_GET['page']; ?>&bot-counter=reset">
    Reset Stats

Not much to talk about here, these script shows us how many times particular bot visited our website and at the end is link which allows us to reset stats. Notice that we are using <div id=”message” class=”updated fade”>…</div> and <div class=”wrap”>…</div> These makes our admin page look similar to other admin pages.

Also take a look at our <a> tag, we can submit forms and click URLs within our admin page, but we need to remember to always send ‘page’ parameter via GET (page=<?php echo $_GET[‘page’]; ?>), otherwise WordPress won’t display our admin page.

For more information on adding administration menu visit

That is pretty much it. Last thing we can do is to display bots visits count to people who are visiting our site, but it requires to edit templates, if we want to display bots stats in certain position like sidebar for example.

The best way to embed our stats into template is to write (in bots.php file) function which will display these stats, then all you need to add in WordPress template is or whatever you named your function..


Run PHP Web Applications on the Java Platform

There has been a lot of commotion and even a book with having Ruby on Rails run on the Java VM. But looking past the JRuby hype it is clear that PHP has a several orders of magnitude more open source code, projects, and corporate backing than Ruby on Rails. The folks behind the Resin application server have the ubiquitous of PHP and have developed Quercus, a PHP 5 implementation written in Java.

Quercus is available with the latest Resin but it is also available for download as a WAR file which can be deployed on Resin or other application Servers such as GlassFish.
Getting Started

Get the latest version of Resin server, as of this writing the latest version is Resin 3.1.3. To start the server just run the \bin\httpd script from the command prompt. If you look around the Resin install directory you will find a php folder where the Quercus WAR file is already configured to handle any PHP file. To give the Quercus PHP engine a try, lets create a simple test. First lets create phptest directory in \webapps. In the phptest directory create a new file, index.php, and add the following text to it.

The phpinfo method outputs a large amount of PHP configuration information. I usually print this information out to ensure that PHP is setup correctly. If you have already started the Resin server you can direct your browser to the following URL: http://localhost:8080/phptest/

You should be looking at a screen that looks like the following screen shot.

Mixing PHP with Java

Since Quercus is written in Java there are hooks to import and mix Java classes in your PHP files. Lets import a Java class and manipulate it in PHP. In the next sample piece of code I will import a Java HashMap class and manipulated it PHP. The import functionality is obviously not part of PHP but an extension made possible by Quercus. .

put(‘california’, 1000);
$map->put(‘oregon’, 1200);

$total = 0;
// Iterate over keys and sum values
for($itr = $map->keySet()->iterator(); $itr->hasNext(); ) {
$key = $itr->next();
$total += $map->get($key);
print “Total $total”;


Once a Java class has been loaded it can be handled just like any other object in PHP. In addition having access to JDK classes, you can import your own Java code. You can import any class that is available in your web applications class loader.
Run PHP Applications

Using Quercus and Resin you can deploy full fledge PHP web applications such as WordPress or Joomla! To get a PHP application running on Resin with Quercus you just need to unzip the application into the \webapps directory. Since your PHP application would be running on top of Java you need to have the right JDBC dirver installed in the \lib directory. This is usually all you have to do to have a PHP application to run on JSP/Servlet container like Resin.

There is a list of PHP applications that are known to be running on Java via Quercus.

Quercus opens a lot of opportunities for PHP web development. Now you don’t really have to choose between languages or frameworks, develop in what you know is best for the task and resources at hand and interoperate between PHP, Java, Ruby, Groovy whatever not at the XML level but at the bytecode.




How to hack websites using Joomla


Joomla! is an open source content management system platform for publishing content on the World Wide Web and intranets as well as a Model–view–controller (MVC) Web application framework. It is written in PHP, stores data in MySQL and includes features such as page caching, RSS feeds, printable versions of pages, news flashes, blogs, polls, search, and support for language internationalization. Joomla is used at 24, or 0.24%, of the 10,000 most popular websites (as ranked by Alexa).

  • In keeping with the stated vision of “Software that is free, secure and of high-quality,” any third-party extensions submitted to the official Joomla! Extension Directory (JED) web page, which was already packed with over 3800+ extensions listed as of December 15, 2009, must now also conform to the GPLv2 license for free distribution. This has allegedly caused some predictable objections from some for-profit plugin vendors.
  • Joomla! 1.5.x will work with any number of domain names in one installation, but showing different content for each one requires the use of third party extensions or modifications to the core or server configuration. However, each page can be configured to use a different template and/or can be made accessible via different domains using the “external link” menu option in Joomla! which appears as a different site to the user.
  • Bi-directional language templates that make use of Joomla!’s comprehensive bi-directional language support, other than those included with the standard install, are less common, and many don’t allow for easy switching between LTR and RTL language formats. Most other templates can be easily modified via Joomla!’s built-in template editor.
  • Access control granularity beyond Joomla! 1.5.x’s nine built-in user groups currently requires the use of third-party extensions, although this is planned for Joomla! 1.6.
  • Article organization beyond Joomla! 1.5.x’s current Section/Category hierarchy requires the use of third party extensions, however flexible category structure support is planned for Joomla 1.6
  • All “pages” (views) in Joomla! are referenced in the system by a unique ID number assigned by way of its “menu item” (link). So, for any page to function properly as part of the framework, it must have at least one menu item associated with it, whether that menu item is visible or not. This may be initially confusing to some newcomers.

By October, 2009, the 2009 Open Source CMS Market Share Report reached the conclusion that Joomla! is the web’s most popular open source content management system. That conclusion was based on an extensive analysis of rate of adoption patterns and brand strength and was backed by a survey of users.

How to refresh DIV using jquery

There are very simple steps to achieve this:
Step 1:
Copy the following code and paste it in the head section of your webpage.

<script src="
var auto_refresh = setInterval(
}, 20000);

Here , above the file “reload.php” will be reloaded in every 20000ms ie 20 second . You can change the file which you have to reload and you can also change the reload time as per your requirement.
and secondly , the #loaddiv is the name of DIV which is going to be refreshed.

Step 2:
and now you need to put the div in the body section of your page

<div id="loaddiv"> 

Step 3:
Now finally you need to write the code for the file “reload.php” which will extract the contends from the other page or it also may contain the code to read the data from the database depending upon requirement.
here i am going to read a small content from another site. you can copy , paste the code and save it as the filename “reload.php”. in the same folder that contains the source code.

echo"this auto loaded content ";

Now your page is ready .

உலகின் தலை சிறந்த ஹீரோ ஒரு தமிழன்

திரைப்படங்களை ரசியுங்கள் ரசிகர்களே. அதில் உங்கள் ஹீரோ செய்வதெல்லாம் நிஜம் என்று மட்டும் நம்பி விடவேண்டாம். உண்மையான ஹீரோ உங்கள் பகுதியில் நேர்மையாகவும், தியாக உணர்வோடும், சேவை மனப்பான்யுடனும், துணிவுடனும் உழைத்துக் கொண்டிருப்பார்கள் ஒரு ராணுவ வீரராக, தீயணைப்பு வீரராக, காவல் துறை அதிகாரியாக, ஆசிரியாராக, சமுக சேவகராக, துப்புரவு தொழிலாளியாக மற்றும் நேர்மையாக உழைத்து சம்பாதிக்கும் எவருமாக இருக்கலாம். அவர்களை சந்திக்கும் சமயத்தில் ஒரு நன்றி சொல்வோம் , பாராட்டுவோம். அவர்களில் யாரேனும் கவுன்சிலர் தேர்தலில் நிற்கக்கூடும். நின்றால் காசுக்கு ஆசைபடாமல் ஒட்டு போடுவோம்.

இப்போது அப்படி ஒரு நிஜமான ஹீரோவை உங்களுக்கு இந்த பதிவின் வாயிலாக அறிமுகபடுத்துகிறேன். இவர் உலகப்புகழ் பெற்ற CNN இணையதளத்தில் உலகின் தலை சிறந்த ரியல் ஹீரோக்களில் முதல் பத்தில் ஒருவராக தேர்ந்தெடுக்கப்பட்டு உள்ளார்.

CNN Hero of the Year: Vote Now
These remarkable individuals have been selected by our Blue Ribbon Panel as our Top 10 CNN Heroes. Now, you can help choose the 2010 CNN Hero of the Year. Select the individual whose accomplishment, impact and personal story inspires you the most.

ஒரு தமிழனாக, மதுரைகாரனாக ரெம்பவும் பெருமை படுகிறேன். இன்னும் வாக்கு பதிவு நடந்து கொண்டிருகிறது. இதில் தேர்ந்தெடுக்கப்படும் ஹீரோக்கள் அமெரிக்காவில் நவம்பர் மாதம் 25 ஆம் தேதியில் Shrine ஆடிடோரியம், Los Angeles இல் நடக்கும் ஒரு பெரும் விழாவில் கௌரவிக்க பட இருக்கிறார்கள். இது CNN தொலைகாட்சியில் இந்திய நேரம் காலை எட்டு மணி ( நமக்கு நவம்பர் 26 ஆம் தேதி ) உலகம் முழுக்க நேரலை ஒளிபரப்பில் காட்டப்பட இருக்கிறது. இதற்காக நாம் ஒவ்வொரு இந்தியனும், தமிழனும் பெருமை பட வேண்டும். ஆஸ்கார் சாதனையை விட இது தான் மகத்தான சாதனை.
பெயர் : நாராயணன் கிருஷ்ணன்
வயது : 29
இருப்பு : மதுரை
அப்படி என்ன செய்து விட்டார்?
அது நினைத்துபார்கவும் முடியாத கருணை செயல்.
தான் யார் என்றே அறியாத சித்த சுவாதீனம் கொண்ட மனிதர்களை நாம் சிறு கருணையுடனும் அல்லது கொஞ்சம் அருவருப்புடனும் கடந்து செல்வோம். சில சமயம் காசு போடுவோம். அதற்கும் மேல் என்ன செய்வோம்? அதை மறக்க முயற்சிப்போம். ஆனால் இவர் அவர்களை தேடி சென்று தினமும் மூன்று வேளை உணவு தருகிறார். அருவருப்பில்லாமல் ஊட்டி விடுகிறார்.கடந்த எட்டு வருடங்களாக ஒரு நாள் தவறாமல் இந்த சேவையை இவர் தொடர்ந்து செய்து வருகிறார். மழை, புயல்,தேர்தல்,கலவரம், பந்த் என்று எதுவும் பாராமல் வருடம் முழுக்க இந்த சேவையை செய்து வருகிறார். தினமும் 400 பேருக்கு மூன்று வேளை உணவு என்பது சாதாரணம் இல்லை. இது வரை ஒரு கோடியே இருபது லட்சம் உணவு பொட்டலங்கள் விநியோகிக்கபட்டுள்ளது.
ஒரு ஐந்து நட்சத்திர ஹோட்டலில் வேலை பார்த்த, விருதுகள் வென்ற செப் சமையல் கலை வல்லுநர் இவர். சுவிட்சர்லாந்தில் ஒரு பெரிய ஹோட்டல் நிறுவனத்தில் வேலை கிடைத்தவுடன் அதை பெற்றோர்களிடம் சொல்லிவிட்டு போவதற்காக மதுரைக்கு வந்தவர் அங்கே ஒரு வயது முதிர்ந்த ஒரு கிழவர், கீழேகிடக்கும் மலத்தை உணவாக உண்ணும் அவலத்தை கண்டு பெரும் அதிர்ச்சிக்குள்ளாகி தனது வெளிநாட்டு வேலையை துறந்து மதுரையிலேயே தங்கி வீட்டில் சமைத்து அதை இது போன்ற மனிதர்களை தேடி சென்று உணவு கொடுக்க ஆரம்பிக்கிறார். இது நடந்தது 2002 . இன்றும் இவரது சேவை தொடர்கிறது மதுரையை சுற்றி நூறு கிலோமீட்டர் பரப்பளவில் கண்ணில் படும் இதுபோன்ற மனிதர்களை தேடிபிடித்து உணவு தருகிறார். இதற்காக இவர் தன்னுடைய வாழ்கையை முழுமையாக அர்பணித்துள்ளார். இவரது அன்னை இவர் குறித்து கவலை பட்டு அழுதபோது, “அம்மா ஒரு நாள் என்னோடு வாங்க. நான் என்ன செய்கிறேன் என்று பாருங்கள் அப்புறம் நீங்கள் சொல்வதை கேட்கிறேன்” என்று சொல்லி அழைத்து போயிருக்கிறார். இவரது சேவையை கண்டு மனம் உருகிய அந்த தாய் ” நீ இவர்களை பார்த்துக்கொள், நான் உள்ளவரை உன்னை பார்த்துகொள்கிறேன்” என்று சொல்லிருக்கிறார். இதை படித்த போது என் கண்களில் நீர் முட்டிக்கொண்டு வந்ததை அடக்க முடியாமல் தவித்தேன். எழுதும் இந்த கணமும் கூட.

நாம் இங்கே நம்மை ஏமாற்றும் திரை நட்சத்திரங்களை ஹீரோ என்று சொல்லி தலையில் வைத்து கொண்டாடுகிறோம். பாலபிசேகம் முதல் முளைப்பாரி வரை எண்ணற்ற பைத்தியகாரத்தனத்தை அந்த ஹீரோக்களுக்காக செய்கிறோம். முதல் நாள் அவர்கள் படங்களை பார்க்க ஆயிரம், இரண்டாயிரம் செலவழிக்க தயங்குவதில்லை. சரி கொடுகிரீர்கள் அந்த அளவுக்கு உரித்தான கலைபடைப்பையாவது அவர்கள் தருகிறார்களா? அவர்கள் என்ன செய்தார்கள். நானும் கொடை செய்கிறேன் என்று சொல்லி சிலவற்றை செய்து பத்திரிகைகளில் மறக்காமல் செய்தி கொடுக்கிறார்கள். அவர்கள் இவரின் கால் தூசுக்கு கூட பொருந்த மாட்டார்கள். இவர் தான் உண்மையான ஹீரோ. சாகசம் செய்வது சாதனை அல்ல. இல்லாதவர்க்கு தேடிசென்று ஈவதே சாதனை. எனக்கு இவர் தான் என்றென்றும் ஹீரோ. இவரை பார்க்கவும், இவருடன் புகைப்படம் எடுத்துகொள்ளவும், இவருடன் ஒரு நாள் இருந்து சிறு உதவியேனும் செய்யவும், பொருள் உதவி செய்யவும், இவரை பற்றி எழுதவும் பேசவும் பெரும் ஆவல் கொள்கிறேன், பெரும் பெருமை கொள்கிறேன் எனது ஹீரோ ஒரு மகத்தானவன் என்பதில்.

“அற்றார் அழிபசி தீர்த்தல் அஃதொருவன்
பெற்றான் பொருள்வைப் புழி.”
ஏதும் இல்லாதவரின் கடும்பசியைத் தீர்த்து வையுங்கள். பொருளைப் பெற்றவன் சேமித்து வைக்கும் இடம் அதுவே.
ஆதலால் நீங்கள் சேர்த்துவைக்க இடம்
Akshaya’s Helping in H.E.L.P. Trust
9, West 1st Main Street,
Doak Nagar Extension,
Madurai – 625 010. India
Ph: +91(0)452 4353439/2587104
Cell:+91 98433 19933


By karuppasamy11486 Posted in Uncategorized

Display a Success Message like Twitter



i find the Css and Jquery way to display the Error or Success Message Like Twitter. For this you need Jquery.js and the Small css


Here Is my Code




text-align: center;
display: none;
width: 100%;
position: fixed;
padding-top: 8px;
padding-bottom: 8px;
margin: 0;
font-weight: bold;
font-size: 1.2em;
overflow: visible;
.success {background:#FFF;color:#264409;border-color:#c6d880;}
.error, .alert, .notice, .success, .info {padding:0.8em;margin-bottom:1em;border:2px solid #ddd;}
.error, .alert {background:#fbe3e4;color:#8a1f11;border-color:#fbc2c4;}



var notifyCallBack;

function showNotification(message, type, callback) {

notifyCallBack = callback;

var notification = $(“#notification”);
notification.removeClass(“success notice error”);

//Make sure it’s visible even when top of the page not visible
notification.css(“top”, $(window).scrollTop());
notification.css(“width”, $(document).width()/2 +40);

// $(“#notification-text”).html(message);

//show the notification
notification.slideDown(“slow”, function() {


function hideNotification() {
$(“#notification”).slideUp(“slow”, function() {
if (null != notifyCallBack && (typeof notifyCallBack == “function”)) {
//reset the callback variable
notifyCallBack = null


In Html


Past the Below code


<div id=”notification” class=’notification’>

<span id=’notification-text’></span>



call the function Body on load or at the end of the page showNotification(”, “success”, function(){});




Convert XML to JSON in PHP

IBM’s developerWorks has posted an interesting article on converting XML to JSON using PHP. At first glance, the question would be “Why”? After all, both XML and JSON serve similar purposes and they both do their job. Almost. It turns out that people find it much easier to process JSON data in the browser than XML. Since many web services return XML, there needs to be a conversion process. Here’s where IBM’s article comes in. Here’s a quote where they talk a little about what they are trying to do.

More and more applications need to convert XML data into JSON. Several Web-based services are already popping up to do such conversions. The IBM T.J. Watson Research Center has developed a particular approach that uses PHP to do the conversion. This approach accepts XML string data as input and converts that into JSON-formatted data output. This PHP-based solution provides several benefits:

  • It can be run in a standalone mode, executed from the command line.
  • It can be included in an existing server-side code artifact.
  • It can be easily hosted as a Web service on the Web.

If you are working with web services, especially if you are proxying other’s services for your own use, you’ll want to read this article. It’s not a long read. If you are already familiar with XML and JSON then it’s even shorter because you can skip the “basics” sections. Most of the rest of the article is source code and explanations.

We used XML for the web service api, and converting xml(returned from REST web service API) to php array was consuming time, does using JSON for web service, increases the performance?

For this we need the xml2json.php

xml2json.php – A PHP class with two static functions

you can download the file form here

.Htaccess Tips and Tricks

Rewrite URLs using htacccess

Upper case URL to lower case

RewriteCond %{REQUEST_URI} !([A-Z]+)
RewriteRule .* – [S=27]
RewriteRule ^(.*)A(.*)$ http://%{HTTP_HOST}/$1a$2 [R=301,L]
RewriteRule ^(.*)B(.*)$ http://%{HTTP_HOST}/$1b$2 [R=301,L]
RewriteRule ^(.*)C(.*)$ http://%{HTTP_HOST}/$1c$2 [R=301,L]
RewriteRule ^(.*)D(.*)$ http://%{HTTP_HOST}/$1d$2 [R=301,L]
RewriteRule ^(.*)E(.*)$ http://%{HTTP_HOST}/$1e$2 [R=301,L]
RewriteRule ^(.*)F(.*)$ http://%{HTTP_HOST}/$1f$2 [R=301,L]
RewriteRule ^(.*)G(.*)$ http://%{HTTP_HOST}/$1g$2 [R=301,L]
RewriteRule ^(.*)H(.*)$ http://%{HTTP_HOST}/$1h$2 [R=301,L]
RewriteRule ^(.*)I(.*)$ http://%{HTTP_HOST}/$1i$2 [R=301,L]
RewriteRule ^(.*)J(.*)$ http://%{HTTP_HOST}/$1j$2 [R=301,L]
RewriteRule ^(.*)K(.*)$ http://%{HTTP_HOST}/$1k$2 [R=301,L]
RewriteRule ^(.*)L(.*)$ http://%{HTTP_HOST}/$1l$2 [R=301,L]
RewriteRule ^(.*)M(.*)$ http://%{HTTP_HOST}/$1m$2 [R=301,L]
RewriteRule ^(.*)N(.*)$ http://%{HTTP_HOST}/$1n$2 [R=301,L]
RewriteRule ^(.*)O(.*)$ http://%{HTTP_HOST}/$1o$2 [R=301,L]
RewriteRule ^(.*)P(.*)$ http://%{HTTP_HOST}/$1p$2 [R=301,L]
RewriteRule ^(.*)Q(.*)$ http://%{HTTP_HOST}/$1q$2 [R=301,L]
RewriteRule ^(.*)R(.*)$ http://%{HTTP_HOST}/$1r$2 [R=301,L]
RewriteRule ^(.*)S(.*)$ http://%{HTTP_HOST}/$1s$2 [R=301,L]
RewriteRule ^(.*)T(.*)$ http://%{HTTP_HOST}/$1t$2 [R=301,L]
RewriteRule ^(.*)U(.*)$ http://%{HTTP_HOST}/$1u$2 [R=301,L]
RewriteRule ^(.*)V(.*)$ http://%{HTTP_HOST}/$1v$2 [R=301,L]
RewriteRule ^(.*)W(.*)$ http://%{HTTP_HOST}/$1w$2 [R=301,L]
RewriteRule ^(.*)X(.*)$ http://%{HTTP_HOST}/$1x$2 [R=301,L]
RewriteRule ^(.*)Y(.*)$ http://%{HTTP_HOST}/$1y$2 [R=301,L]
RewriteRule ^(.*)Z(.*)$ http://%{HTTP_HOST}/$1z$2 [R=301,L]
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]

Rewriting product.php?id=12 to product-12.html

1 RewriteEngine on
2 RewriteRule ^product-([0-9]+)\.html$ product.php?id=$1

Rewriting product.php?id=12 to product/ipod-nano/12.html

1 RewriteEngine on
2 RewriteRule ^product/([a-zA-Z0-9_-]+)/([0-9]+)\.html$ product.php?id=$2

Redirecting non www URL to www URL

1 RewriteEngine On
2 RewriteCond %{HTTP_HOST} ^testl\.net$
3 RewriteRule (.*)$1 [R=301,L]

Rewriting to

1 RewriteEngine On
2 RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1
3 RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1

Change the Sub domain as directory

RewriteCond %{HTTP_HOST} ^$ [OR]
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^(.*)$ http:// [R=301,L]

Redirecting the domain to a new subfolder of inside public_html

1 RewriteEngine On
2 RewriteCond %{HTTP_HOST} ^test\.com$ [OR]
3 RewriteCond %{HTTP_HOST} ^www\.test\.com$
4 RewriteCond %{REQUEST_URI} !^/new/
5 RewriteRule (.*) /new/$1

Prevent Directory Listing

Add any of the following snippet to avoid directory listing.

1 Options -Indexes


1 IndexIgnore *