Getting real client IP address in PHP

Many times we need the visitor’s ipaddress for validation, security, spam prevention, etc. Getting the Visitor’s ipaddress is very easy in PHP.

The simplest way to get the visitor’s/client’s ipaddress is using the $_SERVER['REMOTE_ADDR'] or $_SERVER['REMOTE_HOST'] variables. The variable in the $_SERVER array are created by the web server (like apache) and we can use them in PHP.

// Get the client ip address
$ipaddress = $_SERVER['REMOTE_ADDR']

Read more »

more .htaccess tips

In my previous post .htaccess tips I had started with what is .htaccess file and some things that can be done using it. In this post I’ll cover more about .htaccess files.

Topics Covered:

Read more »

.htaccess tips

Topics Covered:

What is .htaccess file?

.htaccess file is used on Apache Web Server to make configuration changes on per-directory basis. This file contains the configuration directives and are applied to the directory and all its sub directories. The configuration directives in .htaccess files may overwrite the directives in any .htaccess file found higher up in the directory tree and even the main server configuration.

To enable use of .htaccess file the AllowOverride Directive has to be set in the Apache Server configuration.

Read more »

Cachebuster code in JavaScript

The JavaScript, CSS and other files used in a website are often cached by the browser. Sometimes we might want the browser to always fetch the file from the server instead of from the cache. To do this we can use a cachebuster code to make the browser think that every time it is fetching a new file.

Read more »

Tools for Web Development

With so many tools available for Web Development its hard to find the right tools for the job. In this post I will mention some of the tools that I personally use for Web Development. Also, I will give links to some websites which can be really helpful for certain tasks like regular expressions etc. I am not affiliated with any of the tools or websites. I am just giving the list and links of these tools which I use everyday find very useful.

Read more »