Research and Development work on PHP, MYSQ,JQuery,Angular Js,React Native,Laravel,Wordpress,Magento,Joomla
Thursday, May 23, 2013
Tuesday, May 21, 2013
Wednesday, May 1, 2013
Monday, April 29, 2013
PHP Script to create cache
1). Create Folder Name "cache";
2).
ob_start();
$strUrl = "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
if(file_exists("cache/".basename($strUrl)))
{
require_once("cache/".basename($strUrl));
}
else
{
echo "This is home page content......................";
}
$fp = fopen("cache/".basename($strUrl),"w");
fwrite($fp, ob_get_contents());
fclose($fp);
ob_end_flush();
2).
ob_start();
$strUrl = "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
if(file_exists("cache/".basename($strUrl)))
{
require_once("cache/".basename($strUrl));
}
else
{
echo "This is home page content......................";
}
$fp = fopen("cache/".basename($strUrl),"w");
fwrite($fp, ob_get_contents());
fclose($fp);
ob_end_flush();
How to Print a part of webpage using Javascript
<div dir="ltr" style="text-align: left;" trbidi="on">
<script type="text/javascript">
function printDiv()
{
var divToPrint=document.getEelementById('areaToPrint');
newWin= window.open("");
newWin.document.write(divToPrint.outerHTML);
newWin.print();
newWin.close();
}
</script>
<div id="areaToPrint">
The text you want to print or the content you want to print
</div>
</div>
How to add a Bookmark to the Browser using Javascript
<div dir="ltr" style="text-align: left;" trbidi="on">
<script type="text/javascript">
function Add_Bookmark_Favorite(url,title)
{
if (window.sidebar)
{ // Mozilla Firefox Bookmark
//Make sure "Load this bookmark in the sidebar is deselected
window.sidebar.addPanel(title, url,"");
return false;
}
else if( window.external )
{ // IE Favorites
window.external.AddFavorite( url, title);
return false;
}
else if(window.opera && window.print)
{ // Opera Bookmark
return !addToFav(url,title)
}
}
</script>
<a href="" onclick="Add_Bookmark_Favorite('http://www.google.com/','Google')">Bookmark this link</a>
</div>
Check whether site is down or good using php
function VisitSite($url)
{
//$agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL,$url );
//curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch,CURLOPT_VERBOSE,false);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$page=curl_exec($ch);
//echo curl_error($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if($httpcode >= 200 && $httpcode < 300){
return true;
}
else {
return false;
}
}
if(VisitSite('http://www.google.co.in'))
{
echo "Website looks Good<br />";
}else
{
echo "Website looks Down<br />";
}
Compress & decrease the page loading time using HTACCESS
Upgrade Phpmyadmin in XAMPP
Just download the latest version of Phpmyadmin from phpmyadmin or download from the link below.
http://www.phpmyadmin.net/home_page/downloads.php
First take a copy of Phpmyadmin folder in XAMPP or else just rename it in XAMPP then extract the downloaded files into XAMPP folder.
And now, take the config.inc.php file from the renamed folder & place it in the new folder, thats it & just check the latest version is running successfully.
Friday, April 26, 2013
Wednesday, April 24, 2013
Tuesday, April 23, 2013
Subscribe to:
Posts (Atom)