Tuesday, August 31, 2010

80's South Indian Film Stars

Hi Friends,

Here is the pic taken of the 80's South Indian Film Stars when they united in a special get together event held on Aug 29 (i.e. Sunday) night in Chennai. The event organised by Suhasini Maniratnam and hosted by Lissy Priyadarshan.

 All together the event was attended by around 29 actors and was called as Evergreen 80s. From the Telugu industry, Chiranjeevi, Venkatesh, Bhanuchandar, Naresh, Suresh, Ramya krishna and Suman were present. From the Tamil industry, the actors attended the event were superstar Rajnikanth, Sharat Kumar, Arjun, Mohan, Karthik, Prabhu, Suhasini, Radhika, Poornima, Radha, Kushbu, Ambika and Nadiya. From the Malayalam, Mohan Lal and Shobhan were present while from Kannada industry, Sumalatha and Ambarish attended the event.

This is nice to see all the south Indian film stars in a single pic.

Download the pic, here is the link for download, Click here


Saturday, August 28, 2010

Joomla - Most popular open source

Joomla, is the most popular open source software in PHP. It is free for publishing. It uses PHP for coding & MySQL for storage i.e. Database.

Want to learn Joomla, & publish the Site. Here is the free tutorial. Download Joomla Tutorial & have a fun learning.

For download, Click Here














 

Sunday, August 22, 2010

HTACCESS code to redirect to 404 page

htaccess in Linux server is used for rewriting the URL & also used for redirecting to a Pre-defined error page(404 error page) when there is no file or page in the site.

Here is the rule for redirecting to Error page(404 page -- i.e. Page Not found)

Ex;- ErrorDocument 404 http://www.yoursitename.com/error404.php

Ex:- ErrorDocument 404 http://www.yoursitename.com/error404.html

we can define any filename for redirecting, in the above example, I've given an error404.php or error404.html as examples

Friday, August 20, 2010

Function for taking MySQL Backup in PHP

Here is the function for taking backup of a MySQL database without any external tool for MySQL.

$host ---> Hostname
$user ----> Username
$pass ----> Password
$name ----> Database name
If we need the total database, just put the value of $tables as * or else pass only the tables you want with comma separated.

function backup_tables($host,$user,$pass,$name,$tables = '*')
{

 $link = mysql_connect($host,$user,$pass);
 mysql_select_db($name,$link);

 //get all of the tables
 if($tables == '*')
 {
 $tables = array();
 $result = mysql_query('SHOW TABLES');
 while($row = mysql_fetch_row($result))
 {
 $tables[] = $row[0];
 }
 }
 else
 {
 $tables = is_array($tables) ? $tables : explode(',',$tables);
 }

 //cycle through
 foreach($tables as $table)
 {
 $result = mysql_query('SELECT * FROM '.$table);
 $num_fields = mysql_num_fields($result);

 //$return.= 'DROP TABLE '.$table.';';
 $row2 = mysql_fetch_row(mysql_query('SHOW CREATE TABLE '.$table));
 $return.= "\n\n".$row2[1].";\n\n";

 for ($i = 0; $i < $num_fields; $i++)
 {
 while($row = mysql_fetch_row($result))
 {
 $return.= 'INSERT INTO '.$table.' VALUES(';
 for($j=0; $j<$num_fields; $j++)
 {
 $row[$j] = addslashes($row[$j]);
 $row[$j] = ereg_replace("\n","\\n",$row[$j]);
 if (isset($row[$j])) { $return.= '"'.$row[$j].'"' ; } else { $return.= '""'; }
 if ($j<($num_fields-1)) { $return.= ','; }
 }
 $return.= ");\n";
 }
 }
 $return.="\n\n\n";
 }
$s_file = 'db-backup-'.time().'-'.'.sql';
 //save file
 $handle = fopen($s_file,'w+');
 fwrite($handle,$return);
 fclose($handle);
 header("Location:".$s_file);
 exit;
}

Monday, August 16, 2010

Download PHP Manual

PHP is the powerful server side scripting language, popularly known as Hypertext Preprocessor.

PHP is also called as Personal Home Page.

Download the PHP Manual here. For Free Download, Click Here

Friday, August 13, 2010

Download MySQL Tutorial

Here is PDF document for MySQL Tutorial...

MySQL is the world's most popular open source database because of its fast performance, high reliability, ease of use, and dramatic cost savings. Want to learn MySQL, download the pdf document & enhance your database skills..

Free Download, Click Here

Happy Independence Day

Wish you all a Happy Independence Day........

Happy Independence Day
Happy Independence Day to all Indians
Independence Day
Independence Day Wishes

Monday, August 9, 2010

Post your Status in Twitter using PHP

t$twitter_api_url = "http://twitter.com/statuses/update.xml";
$twitter_data = "status=Visit http://anilkajadoo.blogspot.com/ for PHP tips and tutorials!";
$twitter_user = "your_user_name";
$twitter_password = "your_password";

The $twitter_data variable contains the message to be posted to Twitter, which you must ensure is 140 characters or less before posting. You could use strlen() function to do so when you ready the data to be sent, and truncate it if it’s too long by using substr() function. The status= before the message is the POST variable, the parameter for the API.


To send the request, we will use cURL, which is included on most servers. First we initiate cURL and pass it the URL we will be sending the request to:

$ch = curl_init($twitter_api_url);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $twitter_data);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERPWD, "{$twitter_user}:{$twitter_password}");//Twitter Username & Password are used to post the status


$twitter_data = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

All that’s left really is to see whether it worked or not. Since we have our handy $httpcode variable, we can just run a conditional statement to see if the response code is equal to 200 (which means everything went okay).

if ($httpcode != 200) {
     echo "The tweet wasn't posted correctly. ";
}

         

Create a Tiny URL using PHP

Function to create a tiny URL for the site using PHP....


function get_tiny_url($url){
    $ch = curl_init();
    $timeout = 5;
    curl_setopt($ch,CURLOPT_URL,'http://tinyurl.com/api-create.php?url='.$url);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;
}

//Test the Function.......

$new_url = get_tiny_url('http://anilkajadoo.blogspot.com/');

//The tinyURL has been generated & just print it below
echo $new_url;


       

Tuesday, August 3, 2010

Wish My Brother a Happy Birthday






Wishing a Happy Birthday to My Brother


Monday, August 2, 2010

Get the Page title of a webpage using PHP

Below is the function for getting the Title of the webpage using PHP

function getMetaTitle($content){
$pattern = "|<[\s]*title[\s]*>([^<]+)<[\s]*/[\s]*title[\s]*>|Ui";
if(preg_match($pattern, $content, $match))
return $match[1];
else
return false;
}

$url = $siteurl; //Enter the Site URL which we want to get the Page Title
$content = file_get_contents($url);
$title = getMetaTitle($content);
$tags = get_meta_tags($siteurl); // To get the meta content, description, keywords of the given URL....


$tags is a array of all meta data
To get the Meta Keywords, Description we will use the get_meta_tags which is a predefined function in PHP. To retrieve the values we need to use $tags['keywords'] for Keywords & for Description $tag['description']