PunBB Resource

Your ultimate PunBB resource!

Keywords:

    (Extended)

You are not logged in.

#1 2006-12-13 18:44:46

dollarbill
Member
Registered: 2006-07-17
Posts: 21

Affiliation Mod 1.1.0

Code:

##
##
##            Mod title:     Affiliate Mod
##
##      Mod version:     1.1.0
##   Works on PunBB:     1.2.*
##     Release date:     2006.12.12
##           Author:     DollarBill
##
##      Description:     Allows you to add affiliates as well as track in hits and out hits. All stats can be viewed by any admin.
##
##  Difference with
## previous version:     Added (Editing, Disabling, Image Support)
##
##   Affected files:     None, unless you want to use the include method.
##
##       Affects DB:     Yes, installer included (Creates 1 table with 7 fields)
##
##            Notes:    Very easy and very effective mod if your looking to track stats
##
##       DISCLAIMER:      Please note that "mods" are not officially supported by
##                        PunBB. Installation of this modification is done at your
##                        own risk. Backup your forum database and any and all
##                        applicable files before proceeding.
##
##

Download here

Offline

 

#2 2006-12-14 06:12:53

Taco
Member
Registered: 2006-11-16
Posts: 11

Re: Affiliation Mod 1.1.0

Sweet, I've been wanting something like this for a long time.

Thanks a lot, you made my day. smile

Offline

 

#3 2006-12-16 20:20:11

Mark
Moderator
From: North West England
Registered: 2005-06-06
Posts: 1165

Re: Affiliation Mod 1.1.0

Thanks for sharing this. i have seen the one on hyi.cc and it looks pritty good.


Cant find something you want? try searching
Also try the wiki

Offline

 

#4 2006-12-31 19:01:09

Knib
Member
Registered: 2006-12-28
Posts: 41

Re: Affiliation Mod 1.1.0

Very nice. Good Mod yikes

Offline

 

#5 2006-12-31 21:28:02

soccermaniac
Member
Registered: 2006-04-26
Posts: 32
Website

Re: Affiliation Mod 1.1.0

Can we see a demo somewhere ? or some in-depth explanation please ....

Offline

 

#6 2007-01-01 14:09:34

Shizzled
New member
Registered: 2006-09-13
Posts: 7

Re: Affiliation Mod 1.1.0

I have it running here

And here is a screenshot of the plugin.

Offline

 

#7 2007-01-01 17:14:57

soccermaniac
Member
Registered: 2006-04-26
Posts: 32
Website

Re: Affiliation Mod 1.1.0

Ah yes big_smile .... Thanks

Offline

 

#8 2007-02-22 06:46:57

bizpro
Member
Registered: 2007-02-14
Posts: 36
Website

Re: Affiliation Mod 1.1.0

What if I want the links to run horizontally not vertically?
Look at athe forum in my sig.

Offline

 

#9 2007-02-22 19:36:23

dollarbill
Member
Registered: 2006-07-17
Posts: 21

Re: Affiliation Mod 1.1.0

edit the file that is making the links. I haven't looked at it in forever but I'm sure it's in the include folder. Instead of using <li></li> just list em with whatever divider you want.

Offline

 

#10 2007-02-28 19:02:47

Immy
New member
Registered: 2007-02-28
Posts: 2

Re: Affiliation Mod 1.1.0

hi question regarding this mod is there any way on my site www.mixheaven.com i can remove the . next to the affilates ?

Offline

 

#11 2007-03-01 20:26:19

Immy
New member
Registered: 2007-02-28
Posts: 2

Re: Affiliation Mod 1.1.0

issue now sorted cant remember what i did but its worked

Offline

 

#12 2007-04-14 20:18:49

TraxX
New member
Registered: 2007-04-14
Posts: 9

Re: Affiliation Mod 1.1.0

Dude this is Awesome, Thanks A lot.

Offline

 

#13 2007-04-21 21:51:29

Martin
Member
Registered: 2005-11-21
Posts: 123

Re: Affiliation Mod 1.1.0

Are there demos or screenshots available?

Offline

 

#14 2007-04-21 23:26:26

Mark
Moderator
From: North West England
Registered: 2005-06-06
Posts: 1165

Re: Affiliation Mod 1.1.0


Cant find something you want? try searching
Also try the wiki

Offline

 

#15 2007-04-22 19:17:35

Martin
Member
Registered: 2005-11-21
Posts: 123

Re: Affiliation Mod 1.1.0

Oops the link is also in post #10. Somehow I have overseen it. Sorry.

Offline

 

#16 2007-04-22 20:46:47

blackfox
New member
Registered: 2007-04-22
Posts: 5

Re: Affiliation Mod 1.1.0

Has anyone else noticed that the Affiliates Plugin page in the Administration panel IS NOT valid xhtml?  Any idea how to fix?  I got 71 errors lol hmm

Offline

 

#17 2007-04-23 02:39:46

crusader
Member
From: Canada
Registered: 2006-10-26
Posts: 219
Website

Re: Affiliation Mod 1.1.0

I have fixed mine. You're more than welcome to try it. I'll post it on my site for you if you're interested.

Crusader

Offline

 

#18 2007-04-23 08:19:46

blackfox
New member
Registered: 2007-04-22
Posts: 5

Re: Affiliation Mod 1.1.0

How did you fix yours crusader?

Offline

 

#19 2007-04-25 01:19:06

crusader
Member
From: Canada
Registered: 2006-10-26
Posts: 219
Website

Re: Affiliation Mod 1.1.0

I just went through everything and made the necessary changes.

Offline

 

#20 2007-04-25 18:00:33

blackfox
New member
Registered: 2007-04-22
Posts: 5

Re: Affiliation Mod 1.1.0

Could you post a sample?

Offline

 

#21 2007-04-25 19:49:45

Mark
Moderator
From: North West England
Registered: 2005-06-06
Posts: 1165

Re: Affiliation Mod 1.1.0

Post your errors and we'll help you wink


Cant find something you want? try searching
Also try the wiki

Offline

 

#22 2007-04-25 20:07:58

crusader
Member
From: Canada
Registered: 2006-10-26
Posts: 219
Website

Re: Affiliation Mod 1.1.0

Here is my AP_Affiliates.php file.

Code:

<?php
/***********************************************************************

  Copyright (C) 2006  DollarBill (I.R.DollarBill@GMail.Com)
  
  This file is not part of punbb

  PunBB is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published
  by the Free Software Foundation; either version 2 of the License,
  or (at your option) any later version.

  PunBB is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  MA  02111-1307  USA

************************************************************************/

// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
    exit;

// Tell admin_loader.php that this is indeed a plugin and that it is loaded
define('PUN_PLUGIN_LOADED', 1);

// Do the deletions
if(isset($_GET['action'],$_GET['id']) && $_GET['action'] == 'delete')
    {
    $id = strval($_GET['id']);
    $db->query("DELETE FROM ".$db->prefix."affiliates WHERE id='$id'") or error("Affiliates Code error: ",__FILE__, __LINE__, $db->error());
    
    redirect("admin_loader.php?plugin=" . $plugin, "Affiliate removed successfully");
    }
// Enable/Disable
if(isset($_GET['action'],$_GET['id'],$_GET['status']) && $_GET['action'] == 'disable' || $_GET['action'] == 'enable')
    {
    $id = strval($_GET['id']);
    $status = strval($_GET['status']);
    $db->query('UPDATE '.$db->prefix.'affiliates SET disabled="'.$status.'" WHERE id='.$id) or error('Update Affiliates Code error:', __FILE__, __LINE__, $db->error());
    
    redirect("admin_loader.php?plugin=" . $plugin, "Affiliate status updated successfully");
    }
    
    
//Add Affiliate
if(isset($_POST['form_sent']) && $_GET['action'] == 'addaffiliate')
    {
        // Check to see if the Site Name / Site URL we're sent
        if(empty($_POST['site_name']))
            message('You need to enter the name of the affiliate');
        elseif(empty($_POST['site_url']))
            message('You need to enter the URL of the affiliate');
            
        //insert the affiliate into the database
        $db->query('INSERT INTO '.$db->prefix.'affiliates (site_name, site_url, site_image, count_in, count_out) VALUES("'.$_POST['site_name'].'", "'.$_POST['site_url'].'", "'.$_POST['site_image'].'", "'.$_POST['count_in'].'", "'.$_POST['count_out'].'")') or error('Unable to add affiliate', __FILE__, __LINE__, $db->error());
    
    redirect("admin_loader.php?plugin=" . $plugin, "Affiliate added successfully");
    }
//Edit Affiliate
if ($_GET['action'] == 'editaffiliate') {
    if(isset($_POST['form_sent']))
        {
            // Check to see if the Site Name / Site URL we're sent
            if(empty($_POST['site_name']))
                message('You need to enter the name of the affiliate');
            elseif(empty($_POST['site_url']))
                message('You need to enter the URL of the affiliate');
            $id = strval($_GET['id']);
            //insert the affiliate into the database
            $db->query('UPDATE '.$db->prefix.'affiliates SET site_name="'.$_POST['site_name'].'", site_url="'.$_POST['site_url'].'", site_image="'.$_POST['site_image'].'", count_in="'.$_POST['count_in'].'", count_out="'.$_POST['count_out'].'" WHERE id='.$id) or error('Update Affiliates Code error:', __FILE__, __LINE__, $db->error());
    
        redirect("admin_loader.php?plugin=" . $plugin, "Affiliate edited successfully");
        }
        // Display the admin navigation menu
        generate_admin_menu($plugin);
        $result = $db->query("SELECT * FROM ".$db->prefix."affiliates WHERE id='".intval($_GET['id'])."'") or error("Affiliates Code error: ",__FILE__, __LINE__, $db->error());
        if (!$db->num_rows($result))
        message($lang_common['Bad request']);
        
        $editdata = $db->fetch_assoc($result);
        ?>
        <div class="blockform">
    <h2><span>Edit Affiliate</span></h2>
    <div class="box">
        <div class="inbox">
        <form id="add_affiliate" name="add_affiliate" method="post" action="admin_loader.php?plugin=<?php echo $plugin; ?>&amp;action=editaffiliate&amp;id=<?php echo $editdata['id']; ?>">
              <fieldset style="width:45%">
            <legend>Enter affiliate information.</legend>
            <input type="hidden" name="form_sent" value="TRUE" />
            <label><strong>Site Name</strong> (<i>Will be the link text</i>)<br /><input type="text" name="site_name" value="<?php echo $editdata['site_name']; ?>" size="50" maxlength="255" /><br /></label><br />
              <label><strong>Site URL</strong> (<i>Must include http://</i>)<br /><input type="text" name="site_url" value="<?php echo $editdata['site_url']; ?>" size="50" maxlength="255" /><br /></label><br />
              <label><strong>Site Image</strong> (<i>link to an image to use (not required)</i>)<br /><input type="text" name="site_image" value="<?php echo $editdata['site_image']; ?>" size="50" maxlength="255" /><br /></label><br />
              <label><strong>Hits Out</strong> (<i>Incase you need it</i>)<br /><input type="text" name="count_out" value="<?php echo $editdata['count_out']; ?>" size="15" maxlength="10" /><br /></label><br />
              <label><strong>Hits In</strong> (<i>Incase you need it</i>)<br /><input type="text" name="count_in" value="<?php echo $editdata['count_in']; ?>" size="15" maxlength="10" /><br /></label><br />
            </fieldset>
          <br />
          <input type="submit" name="submit_edit" value="Edit Affiliate" />
        </form>
        </div>
    </div>
</div>
<?php
}    
else{    
// Display the admin navigation menu
generate_admin_menu($plugin);
?>
<div class="blockform">
    <h2><span>Current Affiliates</span></h2>
    <div class="box">
        <div class="inbox">
        <?php
        $result = $db->query("SELECT * FROM ".$db->prefix."affiliates ORDER BY id") or error("Affiliates Code error: ",__FILE__, __LINE__, $db->error());
        $num = $db->num_rows($result);
        ?>
        <table width="100%" border="0" cellspacing="2" cellpadding="0">
          <tr style="text-align:left">
            <th scope="col" style="background-color : #5D5C5C; color : #C0C0C0; width:3%; text-align:left">ID</th>
            <th scope="col" style="background-color : #5D5C5C; color : #C0C0C0; text-align:left; width:10%">Name</th>
            <th scope="col" style="background-color : #5D5C5C; color : #C0C0C0; text-align:left; width:auto%">Image</th>
            <th scope="col" style="background-color : #5D5C5C; color : #C0C0C0; text-align:left; width:18%">Links</th>
            <th scope="col" style="background-color : #5D5C5C; color : #C0C0C0; text-align:center; width:10%">In-Hits</th>
            <th scope="col" style="background-color : #5D5C5C; color : #C0C0C0; text-align:center; width:10%">Out-Hits</th>
            <th scope="col" style="background-color : #5D5C5C; color : #C0C0C0; text-align:left; width:10%">Status</th>
          </tr>
        <?php
        if($num == 0)
            {
            echo "<tr><td colspan=\"6\">No affiliates found in the database.</td>";
            }
        else
            {
            while($row = $db->fetch_assoc($result))
                {
                echo "<tr>";
                echo "<td>" . $row["id"] . "</td>";
                echo "<td>" . $row["site_name"] . "</td>";
                if ($row["site_image"] != "")
                echo "<td><a href=\"affiliates.php?out=" . $row["id"] . "\"><img src=\"" . $row["site_image"] . "\"></a></td>";
                else
                echo "<td>No Image</td>";
                echo "<td><a target=\"_blank\" href=\"affiliates.php?out=" . $row["id"] . "\">affiliates.php?out=" . $row["id"] . "</a><br /><a href=\"affiliates.php?in=" . $row["id"] . "\">affiliates.php?in=" . $row["id"] . "</a></td>";
                echo "<td style=\"text-align: center;\">" . $row["count_in"] . "</td>";
                echo "<td style=\"text-align: center;\">" . $row["count_out"] . "</td>";
                if ($row["disabled"] == 0)
                echo "<td>[<a href=\"admin_loader.php?plugin=" . $plugin . "&amp;action=editaffiliate&amp;id=" . $row["id"] . "\">Edit</a>]<br />[<a href=\"admin_loader.php?plugin=" . $plugin . "&amp;action=delete&amp;id=" . $row["id"] . "\" onclick=\"return confirm('Are you sure you want to delete this affiliate?')\">Delete</a>]<br />[<a href=\"admin_loader.php?plugin=" . $plugin . "&amp;action=disable&amp;status=1&amp;id=" . $row["id"] . "\">Disable</a>]</td>";
                else
                echo "<td>[<a href=\"admin_loader.php?plugin=" . $plugin . "&amp;action=editaffiliate&amp;id=" . $row["id"] . "\">Edit</a>]<br />[<a href=\"admin_loader.php?plugin=" . $plugin . "&amp;action=delete&amp;id=" . $row["id"] . "\" onclick=\"return confirm('Are you sure you want to delete this affiliate?')\">Delete</a>]<br />[<a href=\"admin_loader.php?plugin=" . $plugin . "&amp;action=enable&amp;status=0&amp;id=" . $row["id"] . "\">Enable</a>]</td>";
                echo "</tr>";
                }
            }
        ?>
        </table>
        </div>
    </div>
</div>
<br />
<div class="blockform">
    <h2><span>Add Affiliate</span></h2>
    <div class="box">
        <div class="inbox">
        <form id="add_affiliate" name="add_affiliate" method="post" action="admin_loader.php?plugin=<?php echo $plugin; ?>&amp;action=addaffiliate">
              <fieldset style="width:45%">
            <legend>Enter affiliate information.</legend>
            <input type="hidden" name="form_sent" value="TRUE" />
            <label><strong>Site Name</strong> (<i>Will be the link text</i>)<br /><input type="text" name="site_name" size="50" maxlength="255" /><br /></label><br />
              <label><strong>Site URL</strong> (<i>Must include http://</i>)<br /><input type="text" name="site_url" size="50" maxlength="255" /><br /></label><br />
              <label><strong>Site Image</strong> (<i>link to an image to use (not required)</i>)<br /><input type="text" name="site_image" size="50" maxlength="255" /><br /></label><br />
              <label><strong>Hits Out</strong> (<i>Incase you need it</i>)<br /><input type="text" name="count_out" size="15" maxlength="10" /><br /></label><br />
              <label><strong>Hits In</strong> (<i>Incase you need it</i>)<br /><input type="text" name="count_in" size="15" maxlength="10" /><br /></label><br />
            </fieldset>
          <br />
          <input type="submit" name="submit_add" value="Add Affiliate" />
        </form>
        </div>
    </div>
</div><?php } ?>

Offline

 

#23 2007-04-25 20:26:22

Mark
Moderator
From: North West England
Registered: 2005-06-06
Posts: 1165

Re: Affiliation Mod 1.1.0

hopefully dollarbill will update his file to use that one smile


Cant find something you want? try searching
Also try the wiki

Offline

 

#24 2007-04-28 02:19:33

Scripter
Member
Registered: 2006-06-11
Posts: 171
Website

Re: Affiliation Mod 1.1.0

I've tried a lot of things and I can't seem to get it working. Is there a way we can center the text.

Offline

 

#25 2007-04-28 07:29:08

Mark
Moderator
From: North West England
Registered: 2005-06-06
Posts: 1165

Re: Affiliation Mod 1.1.0

you enter the text threw the admin plugin


Cant find something you want? try searching
Also try the wiki

Offline

 

Board footer

Based on PunBB
© Copyright 2002–2005 Rickard Andersson

© Copyright 2004–2006 Kristoffer Jansson

User contributed files are property of their respective owners.