Thursday, October 15, 2009

To get the real IP using PHP code

The code will get the real IP address of running those scripts.


<?php


function getRealIpAddress()

{

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;

}



echo getRealIpAddress(); // display the real IP address

?>


it will be useful.

Monday, October 5, 2009

stylesheets and javascript code working on smarty

how to add styles and javascript, to smarty application, in the head section written the styles code but when we are applying that code to the tpl file is not applied is there any separate code to written in the smarty.


for that reason go to below code


we can the simple code in the smarty application for style sheet and javascript , we add the add one keyword in the tpl files, then


{literal}


<style type=”text/css”>

.style1

{

font-family:Arial, Helvetica, sans-serif;

color:#666666;

}

</style>

{/literal}



It will be useful.