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>" ;
}
?>
Socket Server Response Headers
Earlier I had a post about my Socket Server, I wasn't able to get it to connect, now I can I am using socket_write() to well hopefully send html to a web page, the problem I think is that I have to
rand() function
just a general question guys a girls, is the rand() function 100% random or is it based on time?
HTML form problem
Ive made a form to that i want to send to my email via PHP. but when it send only the name's etc send and then the table belpw only Job location sends and the other columns do not send. is this a html
Taxonomy? Classification? Categorisation?
Not sure if there is a way around this classification problem
Regarding accessing SQL query issued by any user in Oracle 10g
Hi all,
Collecting AOL Search Terms
I am attempting to collect AOL search terms. I know the code is correct (it works for google, bing, yahoo, etc) but not AOL. Here's the code that doesn't' work. Can anyone help?else if
Download Image from URL and Upload it
Ok, I have been googling for the last 1/2 hour trying to figure this out, Most likely I'm just not searching for the right thing. Here is what I want to do. I want to have a Text box which somebody
removing space from the end of a variable
i have a variable $image which contains the following url "http://tiles.xbox.com/tiles/oo/P5/0mdsb2JgbA9ECgR8GgMfWSpVL2ljb24vMC84MDAwIAABAAAAAP3Wg70=.jpg"but for some reason it is breaking
Best way to check for end of a record and send it back to the first record
I'm hoping someone can help me out and explain the best way to accomplish this.What I'm doing I'm pulling data from a data base. I display the information 1 item at a time then have a next and
comparing tables across databases sql refinement ideas required
Hi all