Hello:
While checking my site error logs, I've noticed one repetitive error that fills the log file. The error is "PHP Notice: Undefined variable: adHTML in /.../bot_jrheader.php on line 61". The code does what it's intended to do, and this error has existed nearly a year, but it's probably time to clean up the code and minimize the log file growth. I'm a novice at coding, but have a grasp of the the absolute basics. Any assistance would be appreciated.
Line 61 is "$adHTML .= $adHTML_1;"
The entire file consists of the following code:
<?php
defined('_VALID_MOS') or die('Direct Access to this location is not allowed.') ;
$_MAMBOTS->registerFunction('onPrepareContent', 'head') ;
function head($published, &$row, &$mosParams, $page=0)
{
global $database, $mosConfig_live_site, $params;
$linksSuffix = '' ;
$query = "SELECT id FROM #__mambots WHERE element = 'bot_jrheader' AND folder = 'content'";
$database->setQuery( $query );
$id = $database->loadResult();
$mambot = new mosMambot( $database );
$mambot->load( $id );
$params =& new mosParameters( $mambot->params );
$rotate=$params->get('ad_rotate');
if ($rotate==1 ) {$rotate="true";}
else {$rotate="false";}
$adHTML_1 = "<script type="text/javascript">rn"
. "<!--rn"
. "ad_ext_path = "" . $params->get('ad_ext_path') . ""; rn"
. "ad_partner = "" . $params->get('ad_partner') . ""; rn"
. "ad_width = "" . $params->get('ad_width') . ""; rn"
. "ad_height = "" . $params->get('ad_height') . ""; rn"
. "ad_max_stores = "" . $params->get('ad_max_stores') . ""; rn"
. "ad_shrink_iframe = "" . $params->get('ad_shrink_iframe') . ""; rn"
. "ad_expand_iframe = "" . $params->get('ad_expand_iframe') . ""; rn"
. "ad_style = "" . $params->get('ad_style') . ""; rn"
. "ad_topcat_id = "" . $params->get('ad_topcat_id') . ""; rn"
. "ad_prefer_multiple = "" . $params->get('ad_prefer_multiple') . ""; rn"
. "ad_channel = "" . $params->get('ad_channel') . ""; rn"
. "ad_transparent = "" . $params->get('ad_transparent') . ""; rn"
. "ad_rotate = "" . $rotate . ""; rn"
. "ad_target = "" . $params->get('ad_target') . ""; rn"
. "ad_alternate_color = "" . $params->get('ad_alternate_color') . ""; rn"
. "ad_alternate_url = "" . $params->get('ad_alternate_url') . ""; rn";
$adHTML_3 = "//--> rn"
. "</script>rn"
. "<script src="http://ads.justrelevant.com/show_ad.js" type="text/javascript"></script>rn";
$regex = "/{(Mosjrheader)s*(.*?)}/i" ;
$GLOBALS['botNewadHTML1'] = $adHTML_1 ;
$GLOBALS['botNewadHTML3'] = $adHTML_3 ;
$GLOBALS['botMosjrheaderKeywords'] = $params->get('ad_keywords') ;
$row->text = preg_replace_callback( $regex, 'botMosjrheader_replacer', $row->text );
unset($GLOBALS['botNewadHTML1']);
unset($GLOBALS['botNewadHTML3']);
unset($GLOBALS['botMosjrheaderKeywords']);
return true ;
}
function botMosjrheader_replacer( &$matches ) {
global $params;
$NewadParams = explode("|", $matches[2]) ;
if (sizeof($NewadParams) > 0) {
$mykeyword= $NewadParams[0];
$defkey = $NewadParams[1];
$align = $NewadParams[2];
}
if ($mykeyword==""){$mykeyword= $params->get('ad_keywords');}
if ($defkey==""){$defkey = $params->get('ad_default_keywords');}
if ($align==""){$align = "center";}
$adHTML_1 = $GLOBALS['botNewadHTML1'];
$adHTML_3 = $GLOBALS['botNewadHTML3'];
$adHTML .= $adHTML_1;
$adHTML .= "ad_keywords = Array("" . $mykeyword . ""); rn";
$adHTML .= "ad_default_keywords = Array("" . $defkey . ""); rn";
$adHTML .= $adHTML_3;
$margin=0;
return botMosjrheader_align($align, $margin, $adHTML);
}
function botMosjrheader_align($align, $margin, $relevantAd)
{
if ($align == "none")
return "<div>".$relevantAd."</div>" ;
if ($align != "center"){
return "<div style='float:".$align."; margin-top:".$margin."px ; margin-left:".$margin."px ; margin-right:".$margin."px ; margin-bottom:".$margin."px ;'>".$relevantAd."</div>" ;}
return "<div align='center' style='margin-top:".$margin."px ; margin-bottom:".$margin."px ;'>".$relevantAd."</div>" ;
}
?>
Problem with PHP/mySQL login code
Hello,There is an error in my login script and I can't figure out what it is...I believe it might be my "SELECT" statement...Can anyone help me? Code: <?php//define ('SASI Services
Selecting an "empty" date formated field
How do you select an "empty" date field? I've tried the few ways I can think.
standard ALV application toolbar, into custom report....
HI,
need help in update query
i create a form for update. there are 8 columns in my mysql table. on my main page all the data is retrieve from db and displayed on the page. after every row there is a link edit. when user click
Post PHP form to non-existing page
The company that I work for host their PHP code on IIS on a Windows server, no Apache, so no mod_rewrite. I recently wrote a custom framewok that is loosely based on Codeigniter. To get SEF URL's 'n
generating random codes
Hi guys n gals,I have a requirement to generate 250,000 unique codes...These codes are for a tracking service and will be stored in the database (table field has a unique index).Now I am working on
get the country of visitor and display content based on that
Hello all,I have seen that Google analytics can tell you where a visitor is coming from and I want to do something similar. But I would like to add the functionality of redirecting a user based on his
Any decent php formatter/beautifier/pretty printer?
Any decent php formatter/beautifier/pretty printer class/function?I found the following whilst
Strange Oracle Query problem
Ok So I have this PHP class that talks to a Javascript class that basically creates a table of information from a database query and puts it in a sortable, filterable table. This all works fine and
Grouping and sorting results
Please help with this query.I have 2 tables in a database, countires and cities. states looks like thiscountriesid -----------country1 ------------uk2 ------------us3 ------------japancitiesid