PHP Classes

Advertisement Banner Module: Manage and display advertisement banners in MySQL

Recommend this page to a friend!
  Info   View files Example   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 432 All time: 6,283 This week: 106Up
Version License PHP version Categories
advertisement-banner 1.1Freeware5.0HTML, PHP 5, Graphics, Content manage...


This class can manage and display advertisement banners in MySQL.

It can add several types of advertisements and stores its details in a MySQL database table like the title, description, image data and size.

The class can also pick one or more banner randomly from the database to display filtering by banner size.

It also generates the necessary HTML to display the banner on a Web page and update the number of impressions when the banner is displayed.

The class can also return the number of impressions and clicks on a given banner.

Picture of Bharat Parmar
  Performance   Level  
Name: Bharat Parmar <contact>
Classes: 11 packages by
Country: India India
Age: 32
All time rank: 52230 in India India
Week rank: 180 Up17 in India India Up
Innovation award
Innovation award
Nominee: 3x


$Advertisement = new Advertisement();
    <meta charset="UTF-8">
        <title>Example Script : Manage Advertisement</title>
        <h3>Add New Addvertisement</h3>
        <?php $Advertisement->DisplayMessage();?>
<form method="post" enctype="multipart/form-data">
            <div class="row">
                <div>Title : </div>
                <input type="text" name="title" value="<?php echo @$_POST['title'];?>" placeholder="Enter Advertisement Title" maxlength="50" size="50">

            <div class="row">
                <div>Description : </div>
                <textarea name="description" maxlength="150" placehoder="Enter Advertisement Description Here" cols="39"><?php echo @$_POST['description'];?></textarea>

            <div class="row">
                <div>Banner Size : </div>
                <select name="banner_size">
                    <option value="120x60">120x60</option>
                    <option value="120x90">120x90</option>
                    <option value="125x125">125x125</option>
                    <option value="180x150">180x150</option>
                    <option value="120x400">120x400</option>
                    <option value="250x250">250x250</option>
                    <option value="468x60">468x60</option>
                    <option value="728x90">728x90</option>
            <div class="row">
                <div>Banner Image : </div>
                <input type="file" name="banner_image" accepty="image/*">
            <div class="row">
                <div>Destination URL : </div>
                <input type="text" name="destination_url" value="<?php echo @$_POST['destination_url'];?>" placeholder="Enter Destination URL. Example :" size="50">
            <div class="row">
                <div>Advertisement Impression : </div>
                <input type="text" name="impression" value="<?php echo @$_POST['impression'];?>" placeholder="Enter Advertisement Impression in Numeric Value. Example : 100" size="50">
            <div class="row">
                <input type="submit" name="submit_add" value="Add Advertisement">
        <?php $Advertisement->DisplayBanner("120x60","1");?>
<?php $Advertisement->DisplayBanner("125x125","2");?>
<?php $Advertisement->DisplayBanner("468x60","1");?>
<h3>Manage Advertisement</h3>
        <table width="100%" border="1" cellpadding="3" cellspacing="3">
                <th>Display Counter</th>
                <th>Click Counter</th>
            <?php if(!empty($Advertisement->data)) { $total_clicks = $Advertisement->DisplayClickHistory();?>
<?php foreach ($Advertisement->data as $record) { ?>
<tr align="center">
                        <td><?php echo $record['id'];?></td>
                        <td><?php echo stripslashes($record['title']);?></td>
                        <td><?php echo stripslashes($record['description']);?></td>
                        <td><img src="banner/<?php echo stripslashes($record['banner_image']);?>" height="50%" width="50%"></td>
                        <td><?php echo $record['impression'];?></td>
                        <td><?php echo $record['display_counter'];?></td>
                        <td><?php echo $total_clicks[$record['id']];?></td>
                            <?php if($record['active_status']==1) { ?>
<a href="advertisement.php?status=0&id=<?php echo $record['id'];?>">Active</a>
                            <?php } else { ?>
<a href="advertisement.php?status=1&id=<?php echo $record['id'];?>">Inactive</a>
                            <?php } ?>
                <?php } ?>
<?php } else { ?>
<tr><td colspan="7" align="center">Records not available.</a></tr>
            <?php } ?>

  Files folder image Files  
File Role Description
Files folder imageclass (1 file)
Accessible without login Plain text file advcounter.php Example Click Counter on Advertisement Click
Accessible without login Plain text file advertisement.php Example Manage Advertisement
Accessible without login Plain text file clickhistory.php Example Click Counter History Page
Accessible without login Plain text file config.php Conf. Configuration File
Plain text file database.sql Class Database File
Accessible without login Plain text file readme.txt Doc. Read Me : Documentation for the script

  Files folder image Files  /  class  
File Role Description
  Plain text file Advertisement.Class.php Class Class file of all methods

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:6,283
This week:106Up