Undefined variable: adHTML


Posted on 16th Feb 2014 07:03 pm by admin

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>" ;
}
?>

No comments posted yet

Your Answer:

Login to answer
117 Like 14 Dislike
Previous forums Next forums
Other forums

Auto-populating dropdowns and multiple forms.
Here's what I have so far:

First drop down = select a state (works)
This populates the sec

How do I use a global footer..?
If my index.php has a bole bunch of if functions and exit's in them

TCP Sending Unsigned Char...
Hi...

I want to send over tcp/ip some data, i have the data in hexadecimal, and when i tr

How to change Time Zone
HI
I want to change the time zone of the server to another country.How can do that?

Thanks

php sessions,logouts & the bloomin back button!
Hi All,

I've got a cms that members can log into. When they logout, the session is destroyed,

Optimize Code
Just started getting into the use of cookies. The following code will redirect users to a set URL s

ORA-00932: inconsistent datatypes: expected - got CLOB
SO : windows xp
database : XE

there is a table (transito) with two fields of clob

Passing vars to the DB
I have 3 small testing tables:

ID TYPE
1 pepperoni
2 C. bacon
3 taco

ID TY

Entering Data Problem
Code: $result = mysql_query("SELECT * FROM flights");
while ($row = mysql_fetch_array($

Can php detect connection speed and thereafter swap out elements?
No code to post, lads, yet. Just looking for a yay or nay at this stage:

Can a php script be

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash