How To Stop Skype Toolbar From Converting Numbers to skype Buttons in website

One of the most annoying features of the Skype toolbar is its intrusive ‘button’ injection that hijacks your website, changing phone numbers for buttons and ruining your web sites design. I’ve just installed Skype and it installed the toolbar on my machine by default and was ‘killing’ the look of some of my websites.

i have found the solution from Google

<meta name="SKYPE_TOOLBAR" content="SKYPE_TOOLBAR_PARSER_COMPATIBLE" />

it is great plesure to share the this with you guys :)

access_level

The Father of PHP says “no-framework PHP MVC framework” on March 2006

Rasmus Lerdorf, creator of the PHP langauge, has a new tutorial on his site today that looks at the creation of a “no-framework PHP MVC framework” using PHP5, the Yahoo! User Interface Library, and JSON.

Clean separation of your views, controller logic and backend model logic is easy to do with PHP. Using these ideas, you should be able to build a clean framework aimed specifically at your requirements instead of trying to refactor a much larger and more complex external framework.

Change the Admin Password inVbulletin

Hi,

I forgot the Admin Password . when i try to get the password with the forgot option the mail is not received .but i know vbulletin save the password as MD5.

I give the MD5 for password even though it is not logged me. After a long time i found that they store the password as MD5 with the salt value

then i update the DB with the following Quert to set the new password as password for my admin login

UPDATE user
set password = MD5(concat(MD5(‘password’), user.salt))
WHERE userid = 1

now it works fine for ME. i think it may be help you enjoy the Day 🙂

Sorting the Enum Filed value in Mysql

Hi,

I’m trying to sort the Enum filed integer  value  with my own level of priority. i try in google and get the lots of result with irrelavent matches and finally i got the solution.

We can sort the enum values by using the ORDER BYoption

The index can also be used even if the ORDER BY does not match the index exactly, as long as all of the unused portions of the index and all the extra ORDER BY columns are constants in the WHERE clause.

Here is the example i used the sorting inn my own

Selecte * from table order by  FIELD ( column_name , ‘ 8′,’7′,’2′,’1′,’5′,’4’);

I think it also help for you guys 🙂 enjoy  the Day

By karuppasamy11486 Posted in Mysql, php

Find the Latitude and Longitude using Gmap

Hi,

Google gives the great Javascript Api for finding the Location latitude and longitude by just giving the address only

This is following code

<script src=”http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true&amp;key=ABQIAAAANez3-95VQQxZUR1e1BaC7RQlRyH5qh-HDT3ImsMIYwyhpUeTghSwTS8yZGHT9D9mFG6mgXkotPdcKw&#8221; type=”text/javascript”></script>

var address =’chennai’;

var geocoder = new GClientGeocoder();

if ( geocoder ) {
geocoder.getLatLng(
address,
function(point) {
if ( !point ) {
//alert(address + ” not found”);
$(“#error”).html(address + ” not found”);
$(“#mapurl”).focus();
} else {
$(“#wp_geo_latitude”).val(point.lat());
$(“#wp_geo_longitude”).val(point.lng());
}
}
);
}
});

if you need more details please visit here

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’);
elem.setAttribute(‘href’,url);
elem.setAttribute(‘title’,title);
elem.setAttribute(‘rel’,’sidebar’);
elem.click();
}
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.”);
}
}
</script>

 

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’, ‘http://www.karuppasamy11486.com&#8217;)”>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’, ‘http://www.google.com&#8217;)”>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 http://www.wordpress.org 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:

/wp-content/plugins/

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: https://karuppasamy11486.wordpress.com
Description: Plugin is counting bots visits
Author: Karuppasamy
Version: 1.0
Author URI: https://karuppasamy11486.wordpress.com
*/

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:

/wp-content/plugins/bot/bots.php

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 http://codex.wordpress.org/Plugin_API/Action_Reference 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 (
        id INT(9) NOT NULL AUTO_INCREMENT,
        bot_name VARCHAR(80) NOT NULL,
        bot_mark VARCHAR(20) NOT NULL,
        bot_visits INT(9) DEFAULT 0,
	UNIQUE KEY id (id)
    );";
    $wpdb->query($structure);
 
    // 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 ".
        $wpdb->prefix."bot_counter");
 
    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);
 
            break;
        }
    }
}

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>
<div>
<h2>Bot Counter Admin</h2>
<?php
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
</a>
</div>

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 http://codex.wordpress.org/Adding_Administration_Menus

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..

REF: http://ditio.net/2007/08/09/how-to-create-wordpress-plugin-from-a-scratch/

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.

phpinfo
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.

REF:

  1. http://juixe.com/techknow/index.php/2007/10/11/run-php-web-applications-on-the-java-platform/
  2. http://php-java-bridge.sourceforge.net/pjb/tomcat6.php

 

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.