Solarum – Information For Everyone

Archive for the ‘PHP’ Category

Oct
16

Getting the IP of the current visitor in PHP

Sometimes, you have the need to grab the IP address of the current visitor to your site.  I use this for logging actions like comment forms, etc., but also for blocking IPs if there is a need.  Whatever your reason, this is a good chunk of code, in the form of a function you can call, to return the IP address of whoever is loading that page.  Check it out in the forums!

Oct
5

Find the current directory with PHP

Here is a quick PHP tip that has come in handy for me in times past, it deals with finding the current directory that you are in. I am going to show you how to get two different answers to that question depending on what your needs are. First, let me explain why we would get (or even need for that matter) two different answers. This is because from a PHP page being served up by your web server, there are two current directories from its perspective. One would be the absolute directory to the script, which includes the full path to the root of the web files.

Read the rest of this entry »

Search

Pages

Articles