News Feed
Jobs Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Asvin Balloo's Blog:
Geolocate your visitors with PHP (part 1)
July 21, 2008 @ 08:49:29

On his blog today Asvin Balloo has posted the first part of his look at his method for geolocating the visitors to your website using the PEAR GeoIP package and the MaxMind GeoLite Country information.

In this first part, he just makes sure that you have what you need installed before really getting started. Brief installation instructions are provided and example code is included to make sure things are up and working correctly (a lookup for whatever IP you're coming from).

It uses the lookupCountryName method to translate the information based on the MaxMind data.

0 comments voice your opinion now!
geolocate visitor maxmind pear geoip geolite tutorial


Brent Meshier's Blog:
Blocking visitors by country using PHP & MySQL
April 23, 2007 @ 16:38:00

In a quick new post from Brent Meshier today, he shows us how, with the help of a database CVS file, to block visitors to your site from certain locales.

A client asked me last night if it was possible to block certain countries from accessing his website. He's concerned about the "axis of evil" and their comrades downloading his software. The task is easily accomplished, although it's like using a sledge hammer to tap in a finishing nail. He didn't seem too concerned that we could accidentally block Uzbekistan in the process. Unfortunately his entire site uses plain .html files, no dynamic scripting. This led me to using a slightly creative solution with .htaccess.

Broken up into five simple steps, he makes a light function to drop into an output buffering function to tell it to either show the normal content or return a 401 Unauthorized header to the visitor.

0 comments voice your opinion now!
mysql block visitor country download csv database htaccess mysql block visitor country download csv database htaccess


DevShed:
Using Visitor Objects with MySQL Data Sets in PHP 5
August 16, 2006 @ 16:11:58

DevShed is continuing its series on using Visitor objects in PHP5 with this new tutorial today, a look at uisng them in relation to MySQL and sets of data inside.

So far, implementing visitor objects with PHP is indeed a educational process, which helps to extend even more the boundaries of the vast arena of pattern-based programming. Based on this premise, in the course of this last article, I'll expand the application of the visitor pattern by developing a slightly more realistic example. It will show you how to use visitors objects to establish a direct relationship between a MySQL processing class and a pagination mechanism.

They start by establishing an interaction between the visitors and the data in the MySQL database, providing the complete code for the class and the creation of the visitor objects. The wrap it up with a look at the creation of a pagination class, linking the display of a "page" of records to each of the visitors of the site.

2 comments voice your opinion now!
mysql php5 visitor object pagination tutorial part3 mysql php5 visitor object pagination tutorial part3


DevShed:
Expanding the Application Range of Visitor Objects in PHP 5
August 09, 2006 @ 06:57:01

DevShed continues their series on the Visitor objects in PHP5 with this second part, looking at expanding the "application range" of the objects.

Well, at this stage I'm assuming that creating visitor objects with PHP isn't a strange concept to you any longer, therefore I'll continue this journey by developing some additional -yet useful- examples on how to build up and implement visitors with PHP 5. The main purpose of this is simply reaffirming the concepts deployed in the first tutorial, so you can have a solid background for including your own visitor classes inside your PHP applications.

They start off by creating a new abstract class to use in this part, a User class with plenty of properties and methods. Next up, they make a class extending this base, abstract class to make a SoftwareUser that will accept visitor objects. They then use this interface and create a Visitor class to make the calls, showing a code example of them playing nicely together.

0 comments voice your opinion now!
visitor application range tutorial php5 object visitor application range tutorial php5 object


DevShed:
Introducing Visitor Objects in PHP 5
August 02, 2006 @ 09:51:19

Hot on the heels of their previous patterns-related series, DevShed has posted this new tutorial with a look at the Visitor pattern, specifically as applied to objects.

You'll agree with me that one of the most interesting aspects of design patterns is precisely their practical side. Therefore, considering this undeniable fact, in conjunction with your permanent wish for extending your background in object-oriented programming with PHP, over the course of this series I'll be showing you some useful examples of how to build visitor objects, and more specifically how to include them in real-world applications.

They start with an example, complete with code, of a simple addElement call to store data in an array. The next logical step for storage is to an external resource, so they modify things slightly to write the data out to a file. Finally, they define the other side of things - the actual object that does the "visiting" to the previously defined classes.

0 comments voice your opinion now!
visitor pattern object tutorial introduction visitor pattern object tutorial introduction



Community Events











Don't see your event here?
Let us know!


introduction hhvm composer install framework symfony2 unittest component facebook release package performance series security application opinion podcast database language hack

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework