Monthly Archives: December 2015

Exclude one folder in htaccess protected directory

Just create an .htaccess file in the subdirectory with the content: Satisfy any  

Read More »

jQuery: How to open specific links in new tab having specific url?

Just put following code in your javascript file and It will pick all links globally from your website and will open them in a new tab. Don’t forget to replace url with your own website’s url. $(document).ready(function(){ $('a[href*="website.com"] ').click(function(e) { e.preventDefault(); window.open(this.href, '_blank'); return false; }); });  

Read More »

PHP: How to force to download remote file using php?

Following funcion can be used to force to download remote files via curl: $file = 'https://googledrive.com/host/0B_3oJnpnNoF9UjlkVUwtWE5CY0U/city.jpg'; download($file); function download($url) { set_time_limit(0); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $r = curl_exec($ch); curl_close($ch); header('Expires: 0'); // no cache header('Cache-Control: must-revalidate, …

Read More »