Banner Management With phpAdsNew (Part One)

One easy way to manage the display ads on your website is by using phpAdsNew. This first article shows you how to quickly set up phpAdsNew to suit your needs. Read on to find out how this simple tool can help you keep track of those revenue-producing ads and advertisers.

Yahoo! was an early pioneer in this field. Google took the concept to greater heights. Web masters made millions because of it. And I am definitely not talking about search engines. So, what am I talking about?

If you guessed earning “moolah” from displaying banner advertisements on your website, pat yourself on the back. On second thought, the title of this article may have been a dead give away!

On a more serious note, revenues from advertisements are important source of revenues for most websites. The popularity of Google’s AdSense software (and its ubiquitous text ads) because of its ease-of-use is a testimony to this. However, the AdSense software does not give you, as a Web master, much control as to deciding which advertisements are displayed on your website. Then again, there are several third-party agencies that provide banner management services, but they claim their pound of flesh when it comes to sharing revenues.

So, if you want total control, do not wish to share your pot of “gold” and think that – this is very, very important – you can sell your website to potential advertisers, then “phpAdsNew” is just the tool that can help you to monetize the popularity of your website.

Sound interesting? Read on!

{mospagebreak title=Getting Started}

In order to get started with phpAdsNew, you’ll need Apache installed with PHP (PHP version 4.0.3 or above), a MySQL database server (MySQL version 3.23 or above) and a copy of the latest release (currently phpAdsNew version 2.0) of the package; you can download this release from

Note that you may have to edit your “php.ini” PHP configuration file to ensure that “track_vars” and “file_uploads” are turned “On.” Furthermore, you may also need to install the following PHP extensions (if they are not already installed): the ZLib extension (if you plan to use Flash-based SWF files) and the FTP extension (if you plan to store the banners on the server’s file system).

Since the database should already exist before you install the application, you’ll need to create one. I recommend that you create a separate database (say “phpads”) along with a special MySQL user with the appropriate permissions on this new database.

So, start up a MySQL prompt on your console and execute the following commands.

mysql> CREATE DATABASE `phpads`;
Query OK, 1 row affected (0.05 sec)

After confirming that the “phpads” database has been created, we proceed to create a MySQL user with appropriate permissions. Just a little note before you execute the next command: be sure to change the password in the following SQL statement for obvious security reasons.

mysql> GRANT SELECT ,  INSERT ,  UPDATE , DELETE , CREATE , DROP , INDEX , ALTER ON `phpads`.* TO  “phpadsadmin”@”localhost” IDENTIFIED BY “new_password_here”;
Query OK, 0 rows affected (0.02 sec)

This should create a MySQL user with the username “phpadsadmin” with the appropriate permissions to manage our new “phpads” database.

Before you proceed any further, here is a little note on the installation procedure: I plan to integrate phpAdsNew with the website using the “Local mode” invocation mode. The best location to install the software package for this mechanism is under the root folder of your website; mine is located “/www/htdocs/mysite/”.

Uncompress the source code archive, as shown below.

$ cd /www/htdocs/mysite/

$ tar -xzvf /tmp/phpAdsNew-2.0.tar.gz

This should create a directory named “phpAdsNew-2.0” with the required files.  I recommend that you rename this “phpAdsNew-2.0” folder to “phpads” so that the tool can be accessed using a simpler URL such as The following command should do the needful.

$ mv phpAdsNew-2.0 phpads

One final step before I talk about the browser-based installation screen: file permissions. As is common with most Web-based applications, certain files should be writable by the Web server. In this case, the following command should suffice.

$ chmod 666

{mospagebreak title=phpAdsNew Installation Wizard}

After checking to make sure that Apache and MySQL are running in the background, you can try accessing the installation wizard by pointing your Web browser to the URL (remember to update this URL if you’ve installed the application at a different location).

You should see the following welcome screen:

Click on the “Proceed” button to view the GPL License, a common feature with Open Source software packages these days.

This next screen is displayed only  if a problem crops up during pre-installation routine checks carried out by the installer. The most common problem is the lack of appropriate permissions on the “” file.

However, there is no reason to panic because the wizard will recommend possible solutions. In fact, you can view a list of possible errors (and solutions) in the “Administrator Guide,” located in the “misc/documentation” folder.

After rectifying the errors (if any), re-load the installation wizard to view the “Administrator Account” screen that allows you to “configure” an account for an “administrator” – a super-user with the permissions and privileges to control all aspects of the application.

Complete the personal details for this “administrator” user along with a “username” and “password,” specify the language for the user interface, modify the URL to point to the root folder of the application (if it does not, already) and click on “Proceed” to view the following screen:

This “MySQL database” screen allows you to specify the different parameters required to set up the database for the application. These include:

  • Database hostname: the name of the server where the MySQL database is located. The default value of “localhost” is sufficient for most requirements.

  • Database port number: the port on which the database server is running. The default value, i.e. 3306, should be left as it is, unless you’ve installed the database on a different port.

  • Database username: the MySQL username. Set this to “phpadsadmin,” the MySQL user created earlier.

  • Database password: the MySQL password for the “phpadsadmin” MySQL user.

  • Database name: the name of the database. Set the value of this parameter to “phpads.”

In the “Advanced database settings” section, you have two additional options:

  • Table names prefix: the prefix for each database table created by the installer. I recommend that you stick to the default value, i.e. “phpads_”.

  • Table type: here, you can modify the MySQL table type – use the default “MyISAM” table type if you’re unfamiliar with other types.

Next, click on the “Proceed” button to complete the installation process. If all goes well, you should be able to view the following “Congratulations” screen.

This final screen also lists certain steps that must be implemented before you log into the administration module of the tool:

First, ensure that the “” file has correct file permissions. The following UNIX commands should do the needful.

$ cd /www/htdocs/mysite/phpads/
$ chmod 755 config.php

Second, you need to create a cron job that executes a maintenance script every hour, on the hour. This is possible by adding the following entry to your crontab file:

00 00 * * * lynx
admin_maintenance.php –dump > /dev/null

You could also use the PHP executable (if available)  to execute this maintenance script.

One final note: if you encounter any problems during the installation process, do not hesitate to look at the “Administrator” guide for possible solutions.

{mospagebreak title=phpAdsNew Administration Overview}

Now that the installation of phpAdsNew is complete, it is time to configure the software. Point your browser to the following URL – – to view the following “Authentication” screen:

Use the credentials for the “administrator” user, provided earlier, in order to log on and view the default “Administration” screen.

Let me quickly review the different tabs that you see above:

  • Inventory: the most critical of all sections, here you can manage your publishers – the folks that display banners (including yourself) on their websites, and advertisers – the people who fork out the “moolah” to display their advertisements on every publisher’s website (including yours).

  • Statistics: this section gives you a complete breakdown of “AdViews” – the number of times a banner is displayed and “AdClicks” – the number of times visitors click on the banners displayed on the website.

  • Reports: here, the administrator can generate useful reports based on a wide range of parameters.

  • Settings: as the name suggests, this section allows you to modify the different settings that control the functioning of the software.

You should have noticed that I introduced a number of new terms, such as “publishers,” “advertisers,” “AdViews,” “AdClicks” and so forth. It is essential that you become familiar with these terms before you proceed any further.

For starters, phpAdsNew allows an administrator to define a “publisher” – an entity (or a Web master, practically speaking) that uses this tool to display ad banners on his/her website. Each “publisher,” in turn, can divide his/her website into different “zones.” Each “zone” represents a unique banner display component of the website. For example, the  popular top “banner” (of size 468 by 60 pixels) and “side” banner (of size 120 by 600 pixels) locations could represent two different “zones.” The much-maligned “pop-up window” is another “zone” supported by this tool.

After you’ve defined “publishers” and “zones,” it’s time to move on to more important things – yes, I’m talking about the “advertisers.” After all, you’ve gone through this entire rigamarole to transfer money from their pockets to your own, isn’t it?

Creating an advertiser, as you’ll soon find out, is a breeze. Each “advertiser,” in turn, can be associated with one or more “campaigns.” Characterized by a bunch of parameters such as start-date, end-date, priority, and so forth, each “campaign” is a grouping of the “banners” that the “advertiser” wishes to display across a publisher’s website. Finally, each “banner” can be one of the following: static JPEG image, animated GIF file, Flash SWF movie or plain ol’ HTML code.

Two more terms that you’ll come across regularly when you interact with potential advertisers:

  • AdViews: when associated with a “campaign,” this parameter represents the maximum number of times the “banners” should be displayed on a publisher’s Web site.

  • AdClicks: when associated with a “campaign,” this parameter this represents the maximum number of clicks that are permitted before the “campaign” expires.

Here’s a valuable nugget of information before you flip the page: the ratio of “AdClicks” to “AdViews” is often referred to by industry pundits as the “Click-Through Ratio (CTR)” and is used as a benchmark to judge the effectiveness of a campaign. The higher the CTR, the more successful the campaign.

{mospagebreak title=Setting Up A Publisher}

After much talk about the software, it is time for me to “walk the walk.” So, in the next few sections, my Quick-Start Guide will take you through the steps required to get your instance of phpAdsNew functional in quick time.

Log on to the phpAdsNew application as an “administrator” and click on the “Publishers And Zones” tab to view the following screen:

The first publisher that you should add to phpAdsNew is “yourself” – after all, the plan is to use the tool to display advertisements on “your” website. Click on the “Add new publisher” to view this Web form:

The above form requires you to provide personal information as well as a “username” and a “password” for this new “publisher” to access the phpAdsNew administration module.

You can ignore the remaining fields, for the moment, as they relate to the permissions and privileges for this “publisher,” i.e. yourself. After all, as an “administrator,” you have complete access to all features of the application. Click on the “Next” button to submit the data entered above, thereby creating your first “publisher.” phpAdsNew will immediately prompt you to enter the details of a “zone” to be associated with the “publisher,” as shown below:

Consider the top banner location, often used to display a banner image (of size 468 by 60). Let’s assume that your website also has one and create a “zone” accordingly.

After entering a meaningful name and description, select the “Banner, Button, or Rectangle” option from the “Zone type” drop down and the “IAB Full Banner (468 X 60)” option from the “Size” drop down. Click on “Next” to create your first “zone.”

Note that the “Size” drop-down lists several commonly used banner sizes; you can select the option that best matches your requirements. As far as other banner types are concerned, I’ll talk about them, in greater detail, in the second part of this tutorial.

Furthermore, each “zone” is associated with a bunch of properties that help to fine-tune the display of banners on the website. I suggest that you leave them at their default values for the moment.

Okay – you’ve successfully added yourself as a “publisher” and associated a banner location on your website as a “zone.” Now, the focus shifts to the all-important “advertiser” in the following section.

{mospagebreak title=Setting Up An Advertiser}

In the previous section, I showed you how to add yourself as a “publisher” and the top banner location of your Web site as a “zone.” So, what’s next?

It’s time to create your first “advertiser.” Click on the “Inventory” option in the left hand side menu to return to the home page of the “Inventory” section. On this page, you’ll notice that there is a link titled “Add new advertiser.” Click on it to view the following Web form:

Once again, you’re required to provide some personal information about the “advertiser” – name, contact person, e-mail address, username and password. Once again, I suggest that you add “yourself” as an “advertiser;” this allows you to define a default “campaign” whose “banners” are displayed across your website when there are no paying “advertisers.”

Next, you need to create your first “campaign” using the following screen:

Enter a descriptive name and press the “Save Changes” button, leaving the other parameters at their default values, to create your default “campaign.”

Next, you’ll view a list of “zones” that you can assign to your “campaign.” This should include the “top banner location” zone created earlier. Select this “zone” to proceed to the next step: adding a “banner” for your “campaign.”

The following Web form allows you to do so:

Select the “Local banner (SQL)” option. This ensures that the banner is stored in the database. Locate the JPEG (or GIF) image (of size 468 by 60) to be used as a “banner,” enter a valid “URL” that you would like the banner to point to and a verbose “Description” – this value is used to identify the banner on the screen – and click on the “Save Changes” button to upload your very first “banner.” Once again, you can ignore the remaining parameters that appear on the screen – I’ll talk about them at length later.

If you want a quick review of all advertisers, click on the main “Inventory” tab on the screen and locate the “Expand All” button. This button will display all advertisers along with their associated campaigns and banners, as shown below:

And what about the “publishers”? No problem. Navigate to the “Publishers & Zones” section and click on the “Expand all” hyperlink to view the following:

So, are you done? Well, not really; the task of displaying the advertiser’s banners on the publisher’s website is still pending, isn’t it?

{mospagebreak title=Putting It All Together}

In the last two sections, I showed you how to create “publishers” and “advertisers.” All that remains is get the two of them to “tango” together. Not surprisingly, this versatile tool provides several ways to integrate them.

Log on to phpAdsNew as a “publisher” – you could use your “administrator” credentials also – and navigate to the “Inventory” section. Here, you should view all the “zones” that you’ve created for this “publisher”:

Click on the “Invocationcode” option to view the following:

you’ll notice a drop down  that allows you select the type of “banner invocation” that you would like to use. For your current set-up in which you’ve installed phpAdsNew under the root folder of the website, the “Local mode” option is the best way to go as it requires a simple API call to display the banner.

Coming back to the “Invocationcode” Web form: here you’ll notice that there are some parameters for which you need to provide values. The first is “Target frame” – set it to “_self” if you wish to display the target website in the same browser (not advisable) or “_blank” if you wish to open a new window (advisable).

Next, you have a set of radio buttons that allow you to set flags for various parameters, which control the banner(s) to be displayed for the current zone on the website. The parameters are pretty self-explanatory and I suggest that you leave them at their default values.

Click on the “Generate” button to generate the code snippet that you have to insert in the PHP scripts that drive your website. Take a peek at the following code listing that integrates the code snippet in a sample PHP script (say “index.php”):

 <BASEFONT face=”Arial”>
<TABLE width=”100%” border=”2″ cellpadding=”10″ cellspacing=”0″>
  <TD width=”25%”>
  <TD align=”center” valign=”middle”>

       if (@include(getenv(‘DOCUMENT_ROOT’).’mysite/phpads/’)) {
           if (!isset($phpAds_context)) $phpAds_context = array();
           $phpAds_raw = view_raw (‘zone:2’, 0, ”, ”, ‘0’, $phpAds_context);
           echo $phpAds_raw[‘html’];

 <TR height=”80%”`>
  <TD align=”center” valign=”center” colspan=”2″>
   Content comes here

Load this example in your browser to view the following output:


As you can see, this was pretty easy – just a simple cut-copy-paste operation was all that was required to integrate the two together. Yes, there is a lot more to the code snippet listed above, but I’ll leave the gory details for later.

For the moment, you can bask in the glory of having successfully integrated this powerful banner management software with your website and laugh your way to the bank, when the dollars (from your paying advertisers) start rolling in!

{mospagebreak title=Conclusion}

This brings us to the conclusion of the first part of my tutorial on the phpAdsNew banner management software. During the course of the article, I showed you how to install the package on your server – from creating the database, ensuring that the file permissions are appropriately set, through a quick walk-through of the browser installation wizard.

Next, I gave you a quick overview of the different entities associated with the software and how they interact with each other – this is essential in order to get maximum benefit from the package. Finally, the quick-start guide demonstrated how to create “publishers” and “advertisers” and display “banners” on your website using phpAdsNew.

In the second part of this series, I show you how to install the phpAdsNew so that you can run it off a URL of its own (such as This comes in handy if you have several websites that would like to use same instance of phpAdsNew. I’ll also explain the nitty-gritty that I had to skip in the current article in order to get phpAdsNew up and running quickly.

Till next time, have fun.

Note: All examples in this article have been tested on Linux/i586 with Apache 1.3.12, MySQL 3.23 and PHP 4.3.1. Examples are illustrative only, and are not meant for a production environment. YMMV!

[gp-comments width="770" linklove="off" ]

chat sex hikayeleri Ensest hikaye