I added the option that people can add their own banner!
In each table "top 5 rated, top 5 visited, category" in links.template.php i added the banner option:
Here an example of a table, because i don't know how to show it otherwise

echo '<table border="0" cellpadding="0" cellspacing="0" width="50%">
<tr>
<td width="100%">';
//Show Top 5 rated
echo '<div class="tborder" style="margin: 2%;"><div class="catbg2" align="center">Top Five Rated Links</div>';
$dbresult = db_query("SELECT l.ID_LINK, l.rating, l.title,l.date, m.memberName, l.ID_MEMBER,banner,l.description,l.hits FROM {$db_prefix}links AS l, {$db_prefix}members AS m WHERE l.ID_MEMBER = m.ID_MEMBER AND l.approved = 1 ORDER BY l.rating DESC LIMIT 5", __FILE__, __LINE__);
while($row = mysql_fetch_assoc($dbresult))
{
echo '<div class="tborder" style="margin: 2%;"><div><a href="' . $scripturl . '?action=links;sa=visit;id=' . $row['ID_LINK'] . '" target="blank">' . $row['title'] . '</a></div>';
echo '<div class="banner" style="margin: 2%;"><a href="' . $scripturl . '?action=links;sa=visit;id=' . $row['ID_LINK'] . '" target="blank"><img src=" ' . $row['banner'] . '" maxwidth="468" maxheight="60"></a></div>';
echo '<div class="banner">' . nl2br($row['description']) . '<br /><br />';
echo 'Hits: ' . $row['hits'] . ' Rating: ' . $row['rating'];
if($ratelink)
echo ' <a href="' . $scripturl . '?action=links;sa=rate;value=1;id=' . $row['ID_LINK'] . '"><img src="', $settings['images_url'], '/post/good.gif" alt="Good Link" border="0" /></a> <a href="' . $scripturl . '?action=links;sa=rate;value=0;id=' . $row['ID_LINK'] . '"><img src="', $settings['images_url'], '/post/bad.gif" alt="Bad Link" border="0" /></a>' .' Comments:' .' <a href="http://pinklady.ath.cx/MPCS/comment.php?pageid=1" target="_blank">Comments</a><br>';
echo '<br /></div>';
if($editlink)
echo '<a href="' . $scripturl . '?action=links;sa=editlink;id=' . $row['ID_LINK'] . '">[Edit]</a> ';
if($deletelink)
echo '<a href="' . $scripturl . '?action=links;sa=deletelink;id=' . $row['ID_LINK'] . '">[Delete]</a>
<br />';
echo ' Submitted by:<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['memberName'] . '</a> <font class="smalltext">Added on ' . timeformat($row['date']) . '</font><br>';
echo '</div></div><br />';
}
echo '</div>';
echo '</td>';
echo '</tr>
</table>';
Also add in links.template.php:
After code:<tr>
<td width="28%" height="22" class="windowbg2"><span class="gen"><b>Url</b></span></td>
<td width="72%" height="22" class="windowbg2"><input type="text" name="url" size="64" maxlength="250" value="http://" /></td>
</tr>
Insert this code after above code!<tr>
<td width="28%" height="22" class="windowbg2"><span class="gen"><b>Banner(maxwidth 468px and maxheight 60px)</b></span></td>
<td width="72%" height="22" class="windowbg2"><input type="text" name="banner" size="64" maxlength="250" value="http://" /></td>
</tr>
The links.php: ( search for all the "banner" words and add those lines/words in your links.php )
<?php
/*
SMF Links
Version 1.1
by:vbgamer45
http://www.smfhacks.com
*/
if (!defined('SMF'))
die('Hacking attempt...');
function LinksMain()
{
//Load the main links template
loadtemplate('Links');
//Link actions
$subActions = array(
'addlink' => 'AddLink',
'addlink2' => 'AddLink2',
'editlink' => 'EditLink',
'editlink2' => 'EditLink2',
'visit' => 'VisitLink',
'deletelink' => 'DeleteLink',
'deletelink2' => 'DeleteLink2',
'catup' => 'CatUp',
'catdown' => 'CatDown',
'addcat' => 'AddCat',
'addcat2' => 'AddCat2',
'editcat' => 'EditCat',
'editcat2' => 'EditCat2',
'deletecat' => 'DeleteCat',
'deletecat2' => 'DeleteCat2',
'rate' => 'RateLink',
'approve' => 'Approve',
'noapprove' => 'NoApprove',
'alist' => 'ApproveList'
);
// Follow the sa or just go to main links index.
if (!empty($subActions[@$_GET['sa']]))
$subActions[$_GET['sa']]();
else
view();
}
function view()
{
global $context, $mbname;
//Check if the current user can view the links list
isAllowedTo('view_smflinks');
//Load the main index links template
$context['sub_template'] = 'main';
//Set the page title
$context['page_title'] = $mbname . ' - Links';
}
function AddCat()
{
global $context, $mbname;
isAllowedTo('links_manage_cat');
$context['sub_template'] = 'addcat';
//Set the page title
$context['page_title'] = $mbname . ' - Links - Add Category';
}
function AddCat2()
{
global $db_prefix;
isAllowedTo('links_manage_cat');
//Clean the input
$title = htmlentities($_POST['title'], ENT_QUOTES);
$description = htmlentities($_POST['description'], ENT_QUOTES);
if($title == '')
fatal_error('You need to enter a category title');
//Do the order
$dbresult = db_query("SELECT roworder FROM {$db_prefix}links_cat ORDER BY roworder DESC", __FILE__, __LINE__);
$row = mysql_fetch_assoc($dbresult);
$order = $row['roworder'];
$order++;
//Insert the category
$request = db_query("INSERT INTO {$db_prefix}links_cat
(title, description,roworder)
VALUES ('$title', '$description',$order)", __FILE__, __LINE__);
mysql_free_result($dbresult);
$_POST = '';
redirectexit('action=links');
}
function EditCat()
{
global $context, $mbname;
isAllowedTo('links_manage_cat');
$context['sub_template'] = 'editcat';
//Set the page title
$context['page_title'] = $mbname . ' - Links - Edit Category';
}
function EditCat2()
{
global $db_prefix;
isAllowedTo('links_manage_cat');
//Clean the input
$title = htmlentities($_POST['title'], ENT_QUOTES);
$description = htmlentities($_POST['description'], ENT_QUOTES);
$catid = htmlentities($_POST['catid'], ENT_QUOTES);
if($title == '')
fatal_error('You need to enter a category title');
//Update the category
$request = db_query("UPDATE {$db_prefix}links_cat
SET title = '$title', description = '$description' WHERE ID_CAT = $catid", __FILE__, __LINE__);
$_POST = '';
redirectexit('action=links');
}
function DeleteCat()
{
global $context, $mbname;
isAllowedTo('links_manage_cat');
$context['sub_template'] = 'deletecat';
//Set the page title
$context['page_title'] = $mbname . ' - Links - Delete Category';
}
function DeleteCat2()
{
global $db_prefix;
isAllowedTo('links_manage_cat');
$catid = htmlentities($_POST['catid'], ENT_QUOTES);
//Delete All links
db_query("DELETE FROM {$db_prefix}links WHERE ID_CAT = $catid", __FILE__, __LINE__);
//Finally delete the category
db_query("DELETE FROM {$db_prefix}links_cat WHERE ID_CAT = $catid", __FILE__, __LINE__);
$_POST = '';
redirectexit('action=links');
}
function AddLink()
{
global $context, $mbname;
isAllowedTo('add_links');
$context['sub_template'] = 'addlink';
//Set the page title
$context['page_title'] = $mbname . ' - Links - Add Link';
}
function AddLink2()
{
global $ID_MEMBER,$db_prefix;
isAllowedTo('add_links');
//Clean the input
$title = htmlentities($_POST['title'], ENT_QUOTES);
$banner = htmlentities($_POST['banner'], ENT_QUOTES);
$description = htmlentities($_POST['description'], ENT_QUOTES);
$url = htmlentities($_POST['url'], ENT_QUOTES);
$catid = htmlentities($_POST['catid'], ENT_QUOTES);
if($title == '')
fatal_error('You need to enter a link title');
if($url == '')
fatal_error('You need to enter a link url');
//Check if the url already exists?
$dbresult = db_query("SELECT l.url,l.ID_CAT, l.title linkname, c.title cname FROM {$db_prefix}links AS l, {$db_prefix}links_cat AS c WHERE l.url = '$url' AND l.ID_CAT = c.ID_CAT", __FILE__, __LINE__);
$row = mysql_fetch_assoc($dbresult);
//The link already exists
if(db_affected_rows() != 0)
fatal_error('The link already exists in category ' . $row['cname'] . ' with link title of ' . $row['linkname']);
//Insert the links
$t = time();
if(allowedTo('links_auto_approve'))
{
$request = db_query("INSERT INTO {$db_prefix}links
(ID_CAT, url, title, banner, description,ID_MEMBER,date,approved)
VALUES ($catid,'$url','$title', '$banner', '$description',$ID_MEMBER,$t,1)", __FILE__, __LINE__);
}
else
{
$request = db_query("INSERT INTO {$db_prefix}links
(ID_CAT, url, title, banner, description,ID_MEMBER,date,approved)
VALUES ($catid,'$url','$title','$banner','$description',$ID_MEMBER,$t,0)", __FILE__, __LINE__);
fatal_error('Note: Your link needs to be approved before it is visible.');
}
//Redirect back to category
redirectexit('action=links;cat=' . $catid);
}
function EditLink()
{
global $context, $mbname;
isAllowedTo('edit_links');
$context['sub_template'] = 'editlink';
//Set the page title
$context['page_title'] = $mbname . ' - Links - Edit Link';
}
function EditLink2()
{
global $db_prefix;
isAllowedTo('edit_links');
//Clean the input
$title = htmlentities($_POST['title'], ENT_QUOTES);
$banner = htmlentities($_POST['banner'], ENT_QUOTES);
$description = htmlentities($_POST['description'], ENT_QUOTES);
$url = htmlentities($_POST['url'], ENT_QUOTES);
$id = htmlentities($_POST['id'], ENT_QUOTES);
if($title == '')
fatal_error('You need to enter a link title');
if($url == '')
fatal_error('You need to enter a link url');
//Update the category
$request = db_query("UPDATE {$db_prefix}links
SET title = '$title',url= '$url', description = '$description' WHERE ID_LINK = $id", __FILE__, __LINE__);
//Redirect back to category
redirectexit('action=links;cat=' . $catid);
}
function DeleteLink()
{
global $context, $mbname;
isAllowedTo('delete_links');
$context['sub_template'] = 'deletelink';
//Set the page title
$context['page_title'] = $mbname . ' - Links - Delete Link';
}
function DeleteLink2()
{
global $db_prefix;
isAllowedTo('delete_links');
$id = @$_REQUEST['id'];
if($id == '')
fatal_error('No link selected');
db_query("DELETE FROM {$db_prefix}links WHERE ID_LINK = $id", __FILE__, __LINE__);
}
function VisitLink()
{
global $db_prefix;
//Check if the current user can view the links list
isAllowedTo('view_smflinks');
$id = @$_REQUEST['id'];
if($id == '')
fatal_error('No link selected');
//Update site lists
$request = db_query("UPDATE {$db_prefix}links
SET hits = hits + 1 WHERE ID_LINK = $id", __FILE__, __LINE__);
//Redirect to the site
$dbresult = db_query("SELECT url FROM {$db_prefix}links WHERE ID_LINK = $id", __FILE__, __LINE__);
$row = mysql_fetch_assoc($dbresult);
mysql_free_result($dbresult);
header("Location: " . $row['url']);
}
function CatUp()
{
global $db_prefix;
//Check if they are allowed to manage cats
isAllowedTo('links_manage_cat');
//Get the cat id
$cat = @$_REQUEST['cat'];
//Check if there is a category above it
//First get our row order
$dbresult1 = db_query("SELECT roworder FROM {$db_prefix}links_cat WHERE ID_CAT = $cat", __FILE__, __LINE__);
$row = mysql_fetch_assoc($dbresult1);
$oldrow = $row['roworder'];
$o = $row['roworder'];
$o--;
mysql_free_result($dbresult1);
$dbresult = db_query("SELECT ID_CAT, roworder FROM {$db_prefix}links_cat WHERE roworder = $o", __FILE__, __LINE__);
if(db_affected_rows()== 0)
fatal_error('There is no category above the current one.');
$row2 = mysql_fetch_assoc($dbresult);
//Swap the order Id's
$request = db_query("UPDATE {$db_prefix}links_cat
SET roworder = $oldrow WHERE ID_CAT = " .$row2['ID_CAT'], __FILE__, __LINE__);
$request = db_query("UPDATE {$db_prefix}links_cat
SET roworder = $o WHERE ID_CAT = $cat", __FILE__, __LINE__);
mysql_free_result($dbresult);
//Redirect to index to view cats
redirectexit('action=links');
}
function CatDown()
{
global $db_prefix;
//Check if they are allowed to manage cats
isAllowedTo('links_manage_cat');
//Get the cat id
$cat = @$_REQUEST['cat'];
//Check if there is a category below it
//First get our row order
$dbresult1 = db_query("SELECT roworder FROM {$db_prefix}links_cat WHERE ID_CAT = $cat", __FILE__, __LINE__);
$row = mysql_fetch_assoc($dbresult1);
$oldrow = $row['roworder'];
$o = $row['roworder'];
$o++;
mysql_free_result($dbresult1);
$dbresult = db_query("SELECT ID_CAT, roworder FROM {$db_prefix}links_cat WHERE roworder = $o", __FILE__, __LINE__);
if(db_affected_rows()== 0)
fatal_error('There is no category above the current one.');
$row2 = mysql_fetch_assoc($dbresult);
//Swap the order Id's
$request = db_query("UPDATE {$db_prefix}links_cat
SET roworder = $oldrow WHERE ID_CAT = " .$row2['ID_CAT'], __FILE__, __LINE__);
$request = db_query("UPDATE {$db_prefix}links_cat
SET roworder = $o WHERE ID_CAT = $cat", __FILE__, __LINE__);
mysql_free_result($dbresult);
//Redirect to index to view cats
redirectexit('action=links');
}
function ApproveList()
{
global $context, $mbname;
isAllowedTo('approve_links');
$context['sub_template'] = 'approvelinks';
//Set the page title
$context['page_title'] = $mbname . ' - Links - Approve Links';
}
function Approve()
{
global $db_prefix;
isAllowedTo('approve_links');
//Get link id
@$id = $_REQUEST['id'];
$request = db_query("UPDATE {$db_prefix}links
SET approved = 1 WHERE ID_LINK = $id LIMIT 1", __FILE__, __LINE__);
redirectexit('action=links;sa=alist');
}
function NoApprove()
{
global $db_prefix;
isAllowedTo('approve_links');
//Get link id
@$id = $_REQUEST['id'];
$request = db_query("UPDATE {$db_prefix}links
SET approved = 0 WHERE ID_LINK = $id LIMIT 1", __FILE__, __LINE__);
redirectexit('action=links');
}
function RateLink()
{
global $db_prefix, $ID_MEMBER;
isAllowedTo('rate_links');
//Get the link ID
@$id = $_REQUEST['id'];
if($id == '')
fatal_error('Invalid Link ID');
//See if the user already rated the link.
$dbresult = db_query("SELECT ID_LINK, ID_MEMBER FROM {$db_prefix}links_rating WHERE ID_MEMBER = $ID_MEMBER AND ID_LINK = $id", __FILE__, __LINE__);
if(db_affected_rows()!= 0)
fatal_error('You already rated this link');
//Get the value of rating
@$value = $_REQUEST['value'];
//Check value
if($value ==0)
{
//Lower Ranking
//Insert rating
$request = db_query("INSERT INTO {$db_prefix}links_rating
(ID_LINK, ID_MEMBER,value)
VALUES ($id, $ID_MEMBER,0)", __FILE__, __LINE__);
//Update main link rating
$dbresult = db_query("UPDATE {$db_prefix}links
SET rating = rating - 1 WHERE ID_LINK = $id LIMIT 1", __FILE__, __LINE__);
}
else
{
//Higher Ranking
//Insert rating
$request = db_query("INSERT INTO {$db_prefix}links_rating
(ID_LINK, ID_MEMBER,value)
VALUES ($id, $ID_MEMBER,1)", __FILE__, __LINE__);
//Update main link rating
$dbresult = db_query("UPDATE {$db_prefix}links
SET rating = rating + 1 WHERE ID_LINK = $id LIMIT 1", __FILE__, __LINE__);
}
redirectexit('action=links');
}
?>
In style.css add: ( this will give a maximum height and width to banners that members can add! You can change this if you want

)
.banner
{
width: 468px;
height: 60px;
overflow: hidden;
padding: 3px;
}
Hope you guys can understand this

Otherwise contact me and i will help you

( hope i didn't forget code

otherwise contact me if it doesn't work

)
Regards,
Penny
