“NO Hotlink” – Protect your website from hotlinking with htaccess

January 6, 2008

If you have a website running on Apache and Linux System, you can disable hotlinks.

Hotlinking is when a website or blog use your image with a direct link, so result a consuption of your website bandwith. I assume that I’ve posted a photo of 2MB on my blog and people use it on their webpage without reuploading my photo on their host. Posted Photo was viewed 200 times in 1 hour and consume 400mb of traffic only in 1 hour!! In a day became 9.6 GB of traffic and for website that hosted this photo not is good. Also, there are other many reasons to block hotlinking but this article would be only a solution to prevent hotlinking.

First of all you have to upload one image called no_hotlink.gif on your images directory of your website. (this image is attached below)

No Hotlink

(more…)

Dynamic PDF creation with PHP – Very Easy

November 22, 2007

FPDF is a PHP class which allows to create PDF files with PHP. The advantage is that PDFlib requires a fee for a commercial usage. F from FPDF stands for Free: So yu can use this class to generate PDFs for free and modify source code for your needs.

You must use this class if you want create PDF content directly from PHP to implement for example download of your site content in PDF dinamically. You can download it and see how it works in the sample code below.

(more…)

PHP – Simple authentication script with PHP_AUTH_USER and PHP_AUTH_PW

November 18, 2007

In this howto, we can create a little PHP authentication system with only few rows of PHP code. We can use header() function to submit the “Authentication Required” Message to the client browser, so on client browser we can see a dialog popup that require Username and Password. When we fill the fields, we can receive variables through arrays: “$_SERVER: PHP_AUTH_USER” and “$_SERVER: PHP_AUTH_PW”. We can use this simple authentication system only if PHP runtime is installed as Apache module.

Now we can see how it works through the source code:

(more…)

Free CSS Editor Software for Linux and Ubuntu Gutsy

There are many CSS editors for Linux. Every of this software has particular features. Normally you can use a simple text editor to do a good CSS code for your web projects, but certainly a CSS editor could help you to do a beatiful CSS code.

Quanta as a Linux CSS Editor

quanta

Quanta Plus is an HTML and CSS editor. You can use it for HTML editing but also you could use it for CSS editing. You can find a color picker inside Quanta Plus to choose the colors for your CSS links or background and much more. Quanta is a good choice especially if you run KDE as Desktop Environment.

sudo apt-get install quanta (on Ubuntu Gutsy)

(more…)