picture picture
October 25, 2011 PHP 0 Comments

HTTP Redirection in PHP

PHP code to redirect any HTTP url.

<?php
header('Location: http://you_domain.com/url.php'); // stick your url here
?>
October 25, 2011 PHP 0 Comments

Seconds to String

This function will return the duration of the given time period in days, hours, minutes and seconds.

e.g. secondsToStr(1234567) would return “14 days, 6 hours, 56 minutes, 7 seconds”

<?php
function secondsToStr($secs) {
if($secs>=86400){$days=floor($secs/86400);$secs=$secs%86400;$r=$days.' day';if($days<>1){$r.='s';}if($secs>0){$r.=', ';}}
if($secs>=3600){$hours=floor($secs/3600);$secs=$secs%3600;$r.=$hours.' hour';if($hours<>1){$r.='s';}if($secs>0){$r.=', ';}}
if($secs>=60){$minutes=floor($secs/60);$secs=$secs%60;$r.=$minutes.' minute';if($minutes<>1){$r.='s';}if($secs>0){$r.=', ';}}
$r.=$secs.' second';if($secs<>1){$r.='s';}
return $r;
}

?>
October 25, 2011 PHP 1 Comments

Get Remote IP Address in PHP

PHP Script to find out the IP address.

<?php
function getRemoteIPAddress() {
$ip = $_SERVER['REMOTE_ADDR'];
return $ip;
}
?>

The above code will not work in case your client is behind proxy server. In that case use below function to get real IP address of client.

<?php
function getRealIPAddr()
{
if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
{
$ip=$_SERVER['HTTP_CLIENT_IP'];
}
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
{
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
}
return $ip;
}
?>
October 23, 2011 Personal, Technology 2 Comments

My Facebook new timeline profile

Recently Facebook announced a host of new features in what was described by industry observers as the biggest shakeup in Facebook’s history. Most of these changes are obviously due to the emerging and growing threat from Google Plus, and one of the features that Mark Zuckerberg introduced was the radical redesign of the profile page. It’s called the “timeline” and it could prove to be the most controversial change of them all.

As the name “timeline” implies, you can move the slider back over every year you have had the Facebook profile and see all your old status messages. I found it fascinating seeing what I posted years ago and laughing at some of the bad jokes that I posted (and some of the good ones too).

My new Facebook timeline profile

Sandykadam facebook timeline profile

Sandykadam facebook timeline profile

On the whole, the timeline profile is an interesting development but it is a radical departure from what the profile used to be like, so I am sure there will be lots of people who will vehemently hate the design. But I would say give it a chance.

Not everyone has the timeline design yet and you may have to wait up to several weeks for it. However, if you’re curious about how it looks on your profile and you want to try it out now, then here is how to do it.

Please note however that your new timeline page will only be viewable to those who also have the timeline design page. Those who still have the old page design will continue to see your old page design until the timeline feature goes mainstream for everyone.

New update as on 7th Dec 2011 Facebook Timeline profile is now public.

September 27, 2011 Personal 0 Comments

Hello world!

Welcome to My World!!!

This is my first post in my personal blog site 🙂 I will be adding some useful & personal liked stuff.

So enjoy reading and feel free to give your feedback.

Thank you!

Stay in touch.