phpAdsNew is a banner management and tracking system written in
PHP.
Homepage: http://www.sourceforge.net/projects/phpadsnew/
General Information
Please read the INSTALL file for installation instructions.
phpAds is split into three parts:
- An administration interface, accessible through http://<yourdomain>/<PathToPhpAdsNew>/admin/
- A web interface for your clients, accessible through http://<yourdomain>/<PathToPhpAdsNew>/client/
- A backend, which handles banner display and logging and sends
statistics to your clients via email
The Admin Interface
Through this web based control center, you can manage your clients
and their banners. It also allows to view statistics for individual
clients.
Access Control Lists
In the banner administration section, you can access a page named
Modify banner ACL. This allows you to set up Access Control
Lists - filters defining the circumstances when the banner should
be shown. Currently, the following filters are available:
Title |
Argument |
Description |
Client IP |
IP net/mask: ip.ip.ip.ip/mask.mask.mask.mask, for example
127.0.0.1/255.255.255.0 |
Display banner only for a specific IP region. |
User agent regexp |
Regular expression matching a user agent, for example ^Mozilla/4.?
|
Display banner only for certain browsers. |
Weekday (0-6) |
Day of the week, from 0 = Sunday to 6 = Saturday |
Display banner only on a specific day of the week. |
Domain |
2-3 letter combination of domain suffix |
Displays banner only to certain domain. |
Source |
Name of source page |
Displays banner only on certain pages. |
For example, if you want to display this banner only on weekends,
you would add two ACL entries:
- Weekday (0-6), argument 6 (for Saturday)
- Weekday (0-6), argument 0 (for Sunday)
The Client Interface
Usually, you'll give the URL of the client interface to your clients
so that they can track the adviews/adclicks of their banners. As
you can associate a username/password with each client, a client
is only able to view information belonging to her banners.
The Backend
As an administrator you need to familiarize yourself with phpAdsNew's
backend structure. phpAdsNew gives you two options to include a banner
on your site: local mode and remote invocation. It is recommended
to use the first method where possible.
Local Mode
This is the traditional style of a including a banner within a PHP3-powered
website. On every page you want to have a banner, you have to include
phpadsnew.inc.php. This file is
in your phpAdsNew-installation-directory. Banners are displayed using
the view()-function. This function has the following syntax:
int view (mixed what [, int clientID [, string target [, string source [, bool
withText = 0[, array context]]]]);
- The argument "what" is currently one of the
following:
- [int]: Display the banner with this bannerID. Example:
view(1);
- "[width]x[height]: Display a randomly selected banner
with this width/height. Example: view("468x60");
- "html": Display a randomly selected HTML-banner
- "[keyword]": Display a randomly selected banner
with this keyword associated to it. Example: view("maingroup");
Note: Banners with the special keyword "global"
associated to them, are also considered when using this syntax.
Multiple keywords are possible using conditional statements. Some examples :
key1,key2,key3 (Meaning key1 OR key2 OR key3)
key1,+key2,-key3 (Meaning key1 AND key2 AND NOT key3)
Some rules :
- The switches are "+" (meaning AND) and "-" (meaning NOT).
- The first keyword must not have a switch, the rest may.
- Do not put a space between the switch and the keyword.
- If the "+" or "_" switch is used then that keyword must be in the banner's list for the banner to show. For remote invocation you have to use "_".
- If the "-" switch is used then that keyword must not be in the banner's list for the banner to show.
- If no switch is used then that keyword is considered as OR.
In addition, multiple expressions can be specified in case one does not match
any banners.
The syntax is as follows:
what = part 1[|part 2[|..[|part n]]]
If the first part doesn't match any banners the next part is used until a
part is found which does match banners
part x = (bannerid) or (width/height) or "html" or (keywords)
For example,
key1,+key2|486x60|global (Meaning, find a banner with key1 and key2, or if no match,
find one that's 486x60, or if none match that find one matching the keyword global.)
- The optional argument clientID allows you to retrieve
only banners by a specific client. Specify "" to view
banners from all clients (in case you need the third or fourth
argument, else don't specify it at all).
Example: view("468x60", 1).
- The optional argument "target" allows you to
specify a frame target (may be one of "[framename]",
"_blank", "_parent" and "_top").
Example: view("maingroup", 0, "_blank");
- The optional argument "source" allows you to specify
the name of the current page (for example : "main page" or "subpage1").
Source ACL can then use this name to allow or deny banner displays on
that page.
- The optional argument withText allows you to show a banner with
its associated line of text below it (for example, "Suport
our sponsor" is a common line of text).
Example: view("maingroup", 0, "", 1);
- The optional argument "context" is an array
specifying banners to limit the search to or/and banners to be
excluded from the search. It is an array containing as many associative
arrays as you want. The key of the entries must either be "=="
to denote a banner to which the search is limited to or "!="
to denote a banner to be excluded from the search. The value of
an entry is a banner ID. For example, to show the same randomly
selected banner on the top and bottom of a page, you could use
the following:
// Top of the page:
$id = view("main", 5);
// Bottom of the page
$arr = array(
array("=="
=> $id)
);
view("main", 0, "", "", 0, $arr);
To make sure that the page does not show the same banner
two times, you could use this:
// Top of the page:
$id = view("main", 5);
-
// Bottom of the page
$arr = array(
array("!="
=> $id)
);
view("main", 0, "", "", 0, $arr);
Some examples:
- view(1); - Displays the banner with the bannerID of 1.
- view("html"); - Displays a randomly selected HTML
banner
- view("468x60", 0, "_blank"); - Displays
a randomly selected banner with a width of 468 pixels and a height
of 60 pixels. If user clicks on it, the target destination will
be opened in a new window.
- view("Websites/Business/New_Media/"); - Displays a
randomly selected banner from the group "Websites/Business/New_Media/"
(in other words: with that keyword).
- view("", 0, "_blank", "Main"); -
Displays a randomly selected banner which does not have a Deny for
Source ACL on "Main"
A sample HTML file could look like this:
<?
require("/usr/local/etc/phpAds/phpadsnew.inc.php");
?>
<html>
<head>
<title>phpAdsNew demo</title>
</head>
<body>
<?
view("468x60");
?>
</body>
</html>
Remote Invocation
It is also possible to use phpAdsNew on sites which lack PHP-support.
Random or pre-defined banners can be shown using a standard <img>-construct.
Just like in Local Mode, you can use the "what" argument
to select the banner.
To use multiple banners on a single page, select a unique name
for each banner and assign it to the "n" argument for
both "click.php" and "phpads.php".
Examples:
- <a href="click.php"><img src="phpads.php?what=468x60&n=ban1"></a>
- Show a randomly selected banner of the size 468x60.
- <a href="click.php?n=top"><img src="phpads.php?what=main&n=top"></a>
- Show a randomly selected banner from the "main" group
with the name "top".
- <a href="click.php?n=left"><img src="phpads.php?what=468x60&n=left"></a>
- Show a randomly selected banner of the size 468x60 with the
name "left".
Remote Invocation with JavaScript (better)
This technique allows you to use HTML banners remotely. All you need to do is insert this code :
<SCRIPT LANGUAGE=JavaScript SRC=remotehtmlview.php></SCRIPT>
You should also add parameters to the remotehtmlview.php.
Example:
<SCRIPT LANGUAGE=JavaScript SRC=remotehtmlview.php?what=main&target=_blank></SCRIPT>
- This would show a banner from the main group and, when clicked, a new window would be opened.
The mail.php File
This file is responsible for sending statistics to your clients
(via email) and for disabling banners which have no adviews left.
You should execute it daily, for example from Cron. For more instructions,
please refer to INSTALL.
FAQ - Frequently Asked Questions
The login doesn't work, it keeps prompting for username/password
all over again.
or I can't add banners.
Make sure you have enabled magic_quotes_gpc in your PHP configuration.
Make sure $phpAds_url_prefix in config.inc.php is exactly the same as it is on the server
(http://www.test.com/phpads is not the same as http://www.test.com/phpAds). Also make sure it doesn't end with a slash (/).
I get the following error: Fatal error: Call to unsupported or
undefined function mysql_pconnect().
Your PHP is not configured for MySQL support. If you're on Unix,
you need to recompile PHP --with-mysql. If you're on Windows, you
have to enable the MySQL DLL in your PHP configuration. See the
manual, installation section, for more details.
Can you help me to install phpAdsNew? Can you please implement this
feature I need?
Maybe. Let us know what you want...
|