
Just finished a complete re-design of this site, this time i decided to choose light colors. The homepage now features a “featured posts” slider and an ad box. Comments are jazzed up with “Reply” and “Quote” buttons (how i did them? coming soon…!) . Let me know in the comment below what you think about the new design.
The New Look! ( Re-design 21 Aug 09)
Download complete jQuery documentation ( jQuery API browser )
I love the official jquery docs website, and always refer to it whenever i am stuck with a method or cant remember an awesome functions name :p .As i have a slow internet connection , i was recently searching for an offline version of the awesome Official jQuery documentation but couldnt find one. I asked John Resig about it and he was kind enough to point me to the right direction and told me about the jQuery API browser which can also be downloaded to your system for free from here :
http://api.jquery.com/update/jquery-api-browser-2.0.air
The jQuery API browser will only work if you have Adobe AIR installed on your system. It makes a great source for offline reference when you are developing and dont have an internet connection.
http://api.jquery.com/update/jquery-api-browser-2.0.air
30+ Best Practices for PHP Beginners : Nettuts+
Nettuts+ recently published a very nice article summarising “30+ Best Practices for PHP Beginners” . The article is a must read for all PHP beginners. Check out the article here :
http://net.tutsplus.com/tutorials/php/30-php-best-practices-for-beginners/
Wordpress theme – Dark Temptation
Dark Temptation is a dark wordpress theme with a touch of cyan. Its beautiful, uses Cufon text-image replacement for headers, and is SEO optimized. Boasting a horizontal navigation menu, few theme options and a widgetized left side-bar. Download and enjoy ! ![]()
Download Dark Temptation Theme
Here are some tips on how to design your website with a dark theme appropriate for the holiday.
How to know what keywords visitors Googled to reach your site?
Here is a simple php script that will detect if your visitor is coming from Google and then log the keyword used to reach your site to a file. The script logs the visitors ip address along with the keyword and exact date and time to a file in the form x.x.x.x googled for “key word here” on Month Date, Year, at Hours:minutes am/pm. To use the script, just paste the following code into your php pages , and set the variable $log_file appropriately.
Here is the code :
/* JUST A FEW SETTINGS FIRST
The log file name,
this is where the key words will be stored,
make sure to keep a difficult-to-guess name
for privacy reasons
*/
$log_file="google-keywords-log.log";
/*
Set your timezone (just to make sure you can analyze the data better)
Some useful time zone values :
Asia/Karachi
Asia/Dacca
Asia/Qatar
Asia/Muscat
Asia/Tokyo
for a complete list, refer to http://www.php.net/manual/en/timezones.php
*/
date_default_timezone_set("Asia/Calcutta");
// THE CODE
if (strpos($_SERVER[‘HTTP_REFERER’],‘http://google’) OR strpos($_SERVER[‘HTTP_REFERER’],‘http://www.google’)) {
$referer=$_SERVER[‘HTTP_REFERER’];
$url=parse_url($referer);
parse_str($url["query"],$query);
$data=$_SERVER[‘REMOTE_ADDR’]." googled for \"".$query["q"]."\" on ".date("F j, Y,")." at ".date("g:i a")."\r\n\r\n";
$fp=fopen($log_file,"a+");
fwrite($fp,$data);
fclose($fp);
}
?>
Code Explained
We first check to see if our visitor has been refered to our site by google by checking the predefined variable $_SERVER["HTTP_REFERER"] for occurences of the string http://www.google or http://google using the strpos() function. Then we parse the referer url using parse_url() function. Then we go on to parse the “query” component of the array returned by parse_url() using the parse_str() function which parses the strings as if it were the query string passed via a URL and sets variables in the current scope. Once the string is parsed into the array $query , we can access our keyword term at $query["q"] .Finally we open our log file (set in $log_file ) in the append mode (a+) and append the visitors IP adress, the keyword and date and time to the file.
Sniffing Googlebot using php
Ever wanted to know when Googlebot (google’s search engine spider) visits your site? . Googlebot can be sniffed (detected) easily using php. It is identifiable by the “Googlebot” string in the HTTP_USER_AGENT field it sends with the headers. Here is a simple function called is_google() which returns TRUE if the visitor is Googlebot, else FALSE.
function is_google() {
if (strpos($_SERVER[‘HTTP_USER_AGENT’],"Googlebot"))
return true
else
return false
}
Usage
To use the function, just call it using an if statement, here is how :
{
//do something here if the visitor is Googlebot
//like log the date and time to a file/database
}
Some common uses of this function can be :
- Analyzing the visit of Googlebot to your sites
- Spamdexing,Cloaking ( deceiving )
serving different content (like bulk of links,high ranking keywords etc…) to Googlebot for better rankings
Using this function for cloaking and spamdexing is a black hat SEO technique and can cause your site to be blacklisted by Google
Parsing “ini” configuration files using php

Many times during development involving php, one would want to store some variables as settings. The most common way developers do this is by defining those variables at the beginning of the script. For example, while writing a contact form script, I would like to define a few handy variables first, including admin email, contact log file name/path and etc… The most common way to do this would be to write something similar in your php script.
$admin_email="you@yourdomain.com";
$file="logs/contact.log";
$success_msg="Thanks! your submission was recieved, we will get back to you soon!";
/****** E N D ****************/
Wordpress Theme : Simple and Sweet
Sweet and Simple is a nice wordpress theme with a minimal silvery look. As the name implies, it is simple, yet sweet.
. It has all the features typical of my wordpress themes (cufon text-image replacement,sliding widgets,jquery effects…. bla bla bla )…
Download and lemme know what you think.







