In the forum there's a banner centered with links to places that can help people with getting their VW's fixed that I added which uses a small mysql DB table and some smaller script to read that data in create the html output.
It has worked before as I added more sponsor after sponsor for that website but now long after I added the last I found that the "click function" to create a new tab in the browser and open the site is not working.
I've been trying to figure out what it is but I can't find it and now a sponsor has seen it and want it fixed fast or he will pull his sponsorship back.
The following scripts are from a test site I put up but I have the same problem at this place.
I found these and has modified them not to create an array of four images per row, so it's not totally fresh code.
"banner.class.php" - Creates the html data from the database
Code: Select all
<?php
class Banner{
private $data = array();
public function __construct($row){
$this->data = $row;
}
public function html(){
/* This method returns the banner's HTML code */
$d = &$this->data;
$d['company'] = htmlspecialchars($d['company']);
return '<div class="banner"
<a href="'.$d['url'].'" target="_blank">
<img src="img/banners/'.$d['image'].'" alt="'.$d['company'].'"
width="728" height="90" margin: 0 auto;
/>
</a>
</div>';
}
}
/*
return '<div class="banner"
return '<div class="banner1"
<a href="'.$d['url'].'" target="_blank">
<img src="img/banners/'.$d['image'].'" alt="'.$d['company'].'"
width="728" height="90" margin: 0 auto;
/>
</a>
</div>';
*/
?>
"banner.php" - Reads the DB table
Code: Select all
<?php
/**
* Displays a list of the categories/forums that the current user can see, along with some statistics.
*
* @copyright (C) 2008-2009 PunBB, partially based on code (C) 2008-2009 FluxBB.org
* @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
* @package PunBB
*/
if (!defined('FORUM_ROOT'))
define('FORUM_ROOT', './');
require "connect.php";
require "banner.class.php";
// Error reporting:
error_reporting(E_ALL^E_NOTICE);
$bannerResult = mysql_query("SELECT * FROM banners");
mysql_close();
$banners = array();
while($row=mysql_fetch_assoc($bannerResult))
{
$banners[] = new Banner($row);
}
// Randomizing the $banners array:
shuffle($banners);
// Splitting the banners array into smaller arrays with 4 banners each:
$bannerGroups = array_chunk($banners,1);
?>
<!-- Line of banners -->
<div class="bannerHolder">
<?php
// Looping through the first group:
foreach($bannerGroups[0] as $ban)
{
echo $ban->html();
}
?>
</div>
Code: Select all
<?php
/* Database config */
$db_host = 'xxx';
$db_user = 'xxxxxx';
$db_pass = 'xxxxxxxxxx;
$db_database = 'xx';
/* End config */
$link = @mysql_connect($db_host,$db_user,$db_pass) or die('Unable to establish a DB connection');
mysql_set_charset('utf8');
mysql_select_db($db_database,$link);
?>
and last the css file (at least some part of it)
Code: Select all
/* Banners
-------------------------------------------------------------------*/
.brd .banner{
/* The banner divs */
position:relative;
overflow:hidden;
background-position: center;
text-align:center; /* centers in old versions of IE*/
margin-bottom: 10px;
}
.brd .banner p{
/* The "Visit Company" text */
display:none; /* hidden by default */
left:0;
top:57px;
width:100%;
z-index:200;
position:relative;
font-family:Tahoma, Arial, Helvetica, sans-serif;
color:white;
font-size:11px;
text-align:center;
cursor:pointer;
}
/* Banners
-------------------------------------------------------------------*/
All this seems OK to me but it's not working... at least not any more.
If I remove the 'div' in banner.class.php
Code: Select all
<div class="banner"
Code: Select all
</div>
All I can think of is that some other code somewhere trashes this but that will take forever to find

I also know that you might need all the code to find the error but I hope you can give me some hints where to look.
I'm starting to get nervous for not finding this error and they might lose a sponsor

please help and fast too... if you can
//TIA B52