HomePHP Page 2 - Clicking Through: A phpBanner Primer
Start Me Up - PHP
As your Web site gets more and more popular, you're going to need a capable banner management program to help you keep track of customers, banners and clicks. Take a look at phpBanner, which just might be what you're looking for!
phpBanner is a simple, no-nonsense banner management and tracking system for Web sites. It allows Web site administrators to manage advertisers and banners on the pages of a Web site, display them in a random or pre-defined arrangement, and track clicks on each. And it was simple to use -- just read the single-page installation and instruction guide, and you're on your way!
The first thing is to make sure that you have everything you need for a successful installation of phpBanner. Typically, you'll need a PHP-compliant Web server (I'm using Apache), and a MySQL database server. Most Web hosting providers already offer these three components; however, in case yours doesn't, you can get Apache from http://www.apache.org/, PHP from http://www.php.net/ and MySQL from http://www.mysql.com/.
Next, create a MySQL database to store all the application information. Drop to a command prompt, and start up the MySQL client.
$ mysql Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 7311 to server version: 3.23.39
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
mysql>
Create a new database for the application (I've called mine phpbanner).
mysql> CREATE DATABASE phpbanner;
With the database created, it's time to set up all the required tables. This isn't as hard as it sounds; the phpBanner distribution comes with a single SQL file, phpBanner.sql, which contains all the SQL commands needed to set up the application's database tables. All you need to do is execute these commands via the MySQL's server's client program.
$ mysql -D phpbanner -u root -p < /usr/local/apache/htdocs/phpbanner/phpBanner.sql
Once the tables have been created, you need to set some configuration parameters so that the application knows where to find the database. Locate the config.php file in a folder named require/ in the root directory of the application. Pop it open it in your favourite text editor and modify the contents so it looks like this:
#--------------------------------------- database configuration $db_user= "phpbanner"; $db_pass= "phpbanner"; $db_name= "phpbanner"; $db_host= "localhost"; #--------------------------------------- tables configuration $tbl_country = "country"; $tbl_client= "banner_client"; $tbl_banner = "banner_data"; #--------------------------------------- path configuration $rootpath= "/usr/local/apache/htdocs/phpbanner/"; #change this to fit your environment $imagepath = "$rootpath/images"; $uploadtempdir= "/tmp"; $clientpath = "$rootpath/client"; #you must set appropriate permission for write access to this directory $reqpath= "$rootpath/require"; $incpath= "$rootpath/include"; #---------------------------------------url configuration $rooturl = "http://www.mysite.com/phpbanner"; $imageurl = "$rooturl/images"; $adminurl = "$rooturl/admin"; $clienturl= "$rooturl/client";
Most of these parameters are self-explanatory -- the first set of parameters deals with the credentials required to access the database, the second set deals with the tables used by the application, the third set sets the location of the application's file paths and the fourth section contains the URL parameters required to access the application from a browser.
Remember to create a MySQL user and password matching the above credentials if it does not already exist, else the application will pop up lots of "Access Denied" messages.
Once you've made the necessary changes, save the file, and attempt to access the application URL through your browser. If phpBanner has been successfully installed and configured, you should see something like this:
Aaaaaand you're done! Flip the page to find out how you can begin using the application.