News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Error on my site

Started by jbraum, October 27, 2007, 04:36:53 PM

Previous topic - Next topic

jbraum

I just got the following error.  Did nothing to the site.  I image my host did something but not sure.

8: Undefined index: CATEGORY
File: /home2/della/public_html/Sources/LoadAds.php
Line: 42

H

You can try uninstalling the Ad Management Mod
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

jbraum

Can't login to the site because of the error.

H

Please attach Sources / LoadAds.php here :)
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

jbraum

#4
Sorry couldn't find way to attach.

<?php
/******************************************************************************
* LoadAds.php                                                                 *
*******************************************************************************
* SMF: Simple Machines Forum - Ad Management Mod                              *
*                                                                             *
* =========================================================================== *
* Software Version:           Ad mod: 2.3                                     *
* Software by:                jerm                                            *
* Copyright 2006-2007 by:     jerm                                            *
* Support site:               www.smfads.com                                  *
*******************************************************************************
* This mod is free software; you may redistribute it and/or modify it as long *
* as you credit me for the original mod. This mod is distributed in the hope  *
* that it is and will be useful, but WITHOUT ANY WARRANTIES; without even any *
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    *
*                                                                             *
* All SMF copyrights are still in effect. Anything not mine is theirs. Enjoy! *
* Some code found in here is copy written code by SMF, therefore it can not   *
* be redistributed without official consent from myself or SMF.               *
******************************************************************************/
if (!defined('SMF'))
die('Hacking attempt...');

function 
loadads()
{
global $db_prefix;
global $adverts;

$query db_query("
SELECT *
FROM 
{$db_prefix}ads 
order by ADS_ID"
__FILE____LINE__);
while ($row mysql_fetch_assoc($query))
{
$adverts[] = array(
'id' => $row['ADS_ID'],
'name' => $row['NAME'],
'content' => $row['CONTENT'],
'boards' => $row['BOARDS'],
'posts' => $row['POSTS'],
'category' => $row['CATEGORY'],
'hits' => $row['HITS'],
'type' => $row['TYPE'],
'show_index' => $row['show_index'],
'show_board' => $row['show_board'],
'show_threadindex' => $row['show_threadindex'],
'show_lastpost' => $row['show_lastpost'],
'show_thread' => $row['show_thread'],
'show_bottom' => $row['show_bottom'],
'show_welcome' => $row['show_welcome'],
'show_topofpage' => $row['show_topofpage'],
'show_towerright' => $row['show_towerright'],
'show_towerleft' => $row['show_towerleft'],
'show_underchildren' => $row['show_underchildren'],
);
}

mysql_free_result($query);
$adverts stripslashes__recursive($adverts);


}


function 
show_threadindexAds()
{
return showAds('show_threadindex');
}

function 
show_boardAds()
{
return showAds('show_board');
}

function 
show_threadAds()
{
return showAds('show_thread');
}

function 
show_bottomAds()
{
return showAds('show_bottom');
}

function 
show_indexAds()
{
return showAds('show_index');
}

function 
show_towerleftAds()
{
return showAds('show_towerleft');
}

function 
show_towerrightAds()
{
return showAds('show_towerright');
}

function 
show_topofpageAds()
{
return showAds('show_topofpage');
}

function 
show_welcomeAds()
{
return showAds('show_welcome');
}

function 
show_lastpostAds()
{
return showAds('show_lastpost');
}

function 
show_underchildren()
{
return showAds('show_underchildren');
}


function 
show_posts($postcount)
{
global $board$adverts$modSettings;

//Quickly check the settings to display ads for Admins
if(!empty($modSettings['ads_displayAdsAdmin']) && $modSettings['ads_displayAdsAdmin'] == && allowedTo('admin'))
return ;

//Quickly check if all ads should be disabled
if(!empty($modSettings['ads_quickDisable']) && $modSettings['ads_quickDisable'] == 1)
return ;

//Only want to go in here if there are ads!
if(!empty($adverts) && allowedTo('ad_manageperm'))
{
$displayAds = array();
$displayBoardAds = array();
//Find which ads should display in this area.
for ($i=0;$i<count($adverts);$i++)
{
if(($adverts[$i]['posts']!="" && in_array($postcountexplode(','$adverts[$i]['posts']))) && ($adverts[$i]['boards']!="" && in_array($boardexplode(','$adverts[$i]['boards']))))
$displayBoardAds[] = $adverts[$i];
elseif($adverts[$i]['posts']!="" && in_array($postcountexplode(','$adverts[$i]['posts'])) && $adverts[$i]['boards']=="")
$displayAds[] = $adverts[$i];
}
//Did we find any ads?
if(!empty($displayAds) || !empty($displayBoardAds))
{

//If the board specific ads array is empty, then display normal ads
if(empty($displayBoardAds))
{
$adtemp array_rand($displayAds);

//Update the hit counter for this ad
if(empty($modSettings['ads_updateReports']))
updateAddHits($displayAds[$adtemp]['id']);
//Return all information about the post
return $displayAds[$adtemp];

}
//else this is a board specific ads, therefor only display ads for that certain board
else
{
$adtemp array_rand($displayBoardAds);

//Update the hit counter for this ad
if(empty($modSettings['ads_updateReports']))
updateAddHits($displayBoardAds[$adtemp]['id']);
//Return all information about the post
return $displayBoardAds[$adtemp];
}
}
}

}

function 
showAds($type)
{
global $board$adverts$modSettings;

//For security reasons, we don't want to display ads if the action is "admin" or "admod"
if(isset($_REQUEST['action']) && ($_REQUEST['action'] == 'admod' || $_REQUEST['action'] == 'admin'))
return ;

//Quickly check the settings to display ads for Admins
if(!empty($modSettings['ads_displayAdsAdmin']) && $modSettings['ads_displayAdsAdmin'] == && allowedTo('admin'))
return ;

//Quickly check if all ads should be disabled
if(!empty($modSettings['ads_quickDisable']) && $modSettings['ads_quickDisable'] == 1)
return ;

//Only want to go in here if there are ads!
if(!empty($adverts) && allowedTo('ad_manageperm'))
{
$displayAds = array();
$displayBoardAds = array();
//Find which ads should display in this area.
for ($i=0;$i<count($adverts);$i++)
{
//This is where all the board specific ads go
if($adverts[$i][$type]==&& $adverts[$i]['boards']!="" && in_array($boardexplode(','$adverts[$i]['boards'])))
$displayBoardAds[] = $adverts[$i];
//This is where the non board specific ads go
elseif($adverts[$i][$type]==&& $adverts[$i]['boards']=="")
$displayAds[] = $adverts[$i];

}

//Did we find any ads?
if(!empty($displayAds) || !empty($displayBoardAds))
{

//If the board specific ads array is empty, then display normal ads
if(empty($displayBoardAds))
{
$adtemp array_rand($displayAds);
//Only update if we have reports enabled
if(empty($modSettings['ads_updateReports']))
updateAddHits($displayAds[$adtemp]['id']);
//Return all information about the post
return $displayAds[$adtemp];
}
//else this is a board specific ads, therefor only display ads for that certain board
else
{
$adtemp array_rand($displayBoardAds);
//Only update if we have reports enabled
if(empty($modSettings['ads_updateReports']))
updateAddHits($displayBoardAds[$adtemp]['id']);
//Return all information about the post
return $displayBoardAds[$adtemp];
}

}
}
}

function 
show_category($cat)
{
global $board$adverts$modSettings;

//Quickly check the settings to display ads for Admins
if(!empty($modSettings['ads_displayAdsAdmin']) && $modSettings['ads_displayAdsAdmin'] == && allowedTo('admin'))
return ;

//Quickly check if all ads should be disabled
if(!empty($modSettings['ads_quickDisable']) && $modSettings['ads_quickDisable'] == 1)
return ;

//Only want to go in here if there are ads!
if(!empty($adverts) && allowedTo('ad_manageperm'))
{
$displayAds = array();
//Find which ads should display in this area.
for ($i=0;$i<count($adverts);$i++)
{
if(in_array($catexplode(','$adverts[$i]['category'])))
$displayAds[] = $adverts[$i];
}
//Did we find any ads?
if(!empty($displayAds))
{
$adtemp array_rand($displayAds);

//Update the hit counter for this ad
if(empty($modSettings['ads_updateReports']))
updateAddHits($displayAds[$adtemp]['id']);
//Return all information about the post
return $displayAds[$adtemp];

}
}
}

function 
updateAddHits($id)
{
global $db_prefix;
$request db_query("
UPDATE 
{$db_prefix}ads
SET hits = hits+1
WHERE ADS_ID = 
$id"__FILE____LINE__);

}


?>


Mod edit: Code tag

H

This code should make the error 'go away' so you can login to your forum and then reinstall the ad mod :)

<?php
/******************************************************************************
* LoadAds.php                                                                 *
*******************************************************************************
* SMF: Simple Machines Forum - Ad Management Mod                              *
*                                                                             *
* =========================================================================== *
* Software Version:           Ad mod: 2.3                                     *
* Software by:                jerm                                            *
* Copyright 2006-2007 by:     jerm                                            *
* Support site:               www.smfads.com                                  *
*******************************************************************************
* This mod is free software; you may redistribute it and/or modify it as long *
* as you credit me for the original mod. This mod is distributed in the hope  *
* that it is and will be useful, but WITHOUT ANY WARRANTIES; without even any *
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    *
*                                                                             *
* All SMF copyrights are still in effect. Anything not mine is theirs. Enjoy! *
* Some code found in here is copy written code by SMF, therefore it can not   *
* be redistributed without official consent from myself or SMF.               *
******************************************************************************/
if (!defined('SMF'))
die('Hacking attempt...');

function 
loadads()
{
global $db_prefix;
global $adverts;

$query db_query("
SELECT *
FROM 
{$db_prefix}ads 
order by ADS_ID"
__FILE____LINE__);
while ($row mysql_fetch_assoc($query))
{
$adverts[] = array(
'id' => $row['ADS_ID'],
'name' => $row['NAME'],
'content' => $row['CONTENT'],
'boards' => $row['BOARDS'],
'posts' => $row['POSTS'],
// 'category' => $row['CATEGORY'],
'hits' => $row['HITS'],
'type' => $row['TYPE'],
'show_index' => $row['show_index'],
'show_board' => $row['show_board'],
'show_threadindex' => $row['show_threadindex'],
'show_lastpost' => $row['show_lastpost'],
'show_thread' => $row['show_thread'],
'show_bottom' => $row['show_bottom'],
'show_welcome' => $row['show_welcome'],
'show_topofpage' => $row['show_topofpage'],
'show_towerright' => $row['show_towerright'],
'show_towerleft' => $row['show_towerleft'],
'show_underchildren' => $row['show_underchildren'],
);
}

mysql_free_result($query);
$adverts stripslashes__recursive($adverts);


}


function 
show_threadindexAds()
{
return showAds('show_threadindex');
}

function 
show_boardAds()
{
return showAds('show_board');
}

function 
show_threadAds()
{
return showAds('show_thread');
}

function 
show_bottomAds()
{
return showAds('show_bottom');
}

function 
show_indexAds()
{
return showAds('show_index');
}

function 
show_towerleftAds()
{
return showAds('show_towerleft');
}

function 
show_towerrightAds()
{
return showAds('show_towerright');
}

function 
show_topofpageAds()
{
return showAds('show_topofpage');
}

function 
show_welcomeAds()
{
return showAds('show_welcome');
}

function 
show_lastpostAds()
{
return showAds('show_lastpost');
}

function 
show_underchildren()
{
return showAds('show_underchildren');
}


function 
show_posts($postcount)
{
global $board$adverts$modSettings;

//Quickly check the settings to display ads for Admins
if(!empty($modSettings['ads_displayAdsAdmin']) && $modSettings['ads_displayAdsAdmin'] == && allowedTo('admin'))
return ;

//Quickly check if all ads should be disabled
if(!empty($modSettings['ads_quickDisable']) && $modSettings['ads_quickDisable'] == 1)
return ;

//Only want to go in here if there are ads!
if(!empty($adverts) && allowedTo('ad_manageperm'))
{
$displayAds = array();
$displayBoardAds = array();
//Find which ads should display in this area.
for ($i=0;$i<count($adverts);$i++)
{
if(($adverts[$i]['posts']!="" && in_array($postcountexplode(','$adverts[$i]['posts']))) && ($adverts[$i]['boards']!="" && in_array($boardexplode(','$adverts[$i]['boards']))))
$displayBoardAds[] = $adverts[$i];
elseif($adverts[$i]['posts']!="" && in_array($postcountexplode(','$adverts[$i]['posts'])) && $adverts[$i]['boards']=="")
$displayAds[] = $adverts[$i];
}
//Did we find any ads?
if(!empty($displayAds) || !empty($displayBoardAds))
{

//If the board specific ads array is empty, then display normal ads
if(empty($displayBoardAds))
{
$adtemp array_rand($displayAds);

//Update the hit counter for this ad
if(empty($modSettings['ads_updateReports']))
updateAddHits($displayAds[$adtemp]['id']);
//Return all information about the post
return $displayAds[$adtemp];

}
//else this is a board specific ads, therefor only display ads for that certain board
else
{
$adtemp array_rand($displayBoardAds);

//Update the hit counter for this ad
if(empty($modSettings['ads_updateReports']))
updateAddHits($displayBoardAds[$adtemp]['id']);
//Return all information about the post
return $displayBoardAds[$adtemp];
}
}
}

}

function 
showAds($type)
{
global $board$adverts$modSettings;

//For security reasons, we don't want to display ads if the action is "admin" or "admod"
if(isset($_REQUEST['action']) && ($_REQUEST['action'] == 'admod' || $_REQUEST['action'] == 'admin'))
return ;

//Quickly check the settings to display ads for Admins
if(!empty($modSettings['ads_displayAdsAdmin']) && $modSettings['ads_displayAdsAdmin'] == && allowedTo('admin'))
return ;

//Quickly check if all ads should be disabled
if(!empty($modSettings['ads_quickDisable']) && $modSettings['ads_quickDisable'] == 1)
return ;

//Only want to go in here if there are ads!
if(!empty($adverts) && allowedTo('ad_manageperm'))
{
$displayAds = array();
$displayBoardAds = array();
//Find which ads should display in this area.
for ($i=0;$i<count($adverts);$i++)
{
//This is where all the board specific ads go
if($adverts[$i][$type]==&& $adverts[$i]['boards']!="" && in_array($boardexplode(','$adverts[$i]['boards'])))
$displayBoardAds[] = $adverts[$i];
//This is where the non board specific ads go
elseif($adverts[$i][$type]==&& $adverts[$i]['boards']=="")
$displayAds[] = $adverts[$i];

}

//Did we find any ads?
if(!empty($displayAds) || !empty($displayBoardAds))
{

//If the board specific ads array is empty, then display normal ads
if(empty($displayBoardAds))
{
$adtemp array_rand($displayAds);
//Only update if we have reports enabled
if(empty($modSettings['ads_updateReports']))
updateAddHits($displayAds[$adtemp]['id']);
//Return all information about the post
return $displayAds[$adtemp];
}
//else this is a board specific ads, therefor only display ads for that certain board
else
{
$adtemp array_rand($displayBoardAds);
//Only update if we have reports enabled
if(empty($modSettings['ads_updateReports']))
updateAddHits($displayBoardAds[$adtemp]['id']);
//Return all information about the post
return $displayBoardAds[$adtemp];
}

}
}
}

function 
show_category($cat)
{
global $board$adverts$modSettings;

//Quickly check the settings to display ads for Admins
if(!empty($modSettings['ads_displayAdsAdmin']) && $modSettings['ads_displayAdsAdmin'] == && allowedTo('admin'))
return ;

//Quickly check if all ads should be disabled
if(!empty($modSettings['ads_quickDisable']) && $modSettings['ads_quickDisable'] == 1)
return ;

//Only want to go in here if there are ads!
if(!empty($adverts) && allowedTo('ad_manageperm'))
{
$displayAds = array();
//Find which ads should display in this area.
/* for ($i=0;$i<count($adverts);$i++)
{
if(in_array($cat, explode(',', $adverts[$i]['category'])))
$displayAds[] = $adverts[$i];
}*/
//Did we find any ads?
/* if(!empty($displayAds))
{
$adtemp = array_rand($displayAds);

//Update the hit counter for this ad
if(empty($modSettings['ads_updateReports']))
updateAddHits($displayAds[$adtemp]['id']);
//Return all information about the post
return $displayAds[$adtemp];

}*/
$displayAds '';
return $displayAds;
}
}

function 
updateAddHits($id)
{
global $db_prefix;
$request db_query("
UPDATE 
{$db_prefix}ads
SET hits = hits+1
WHERE ADS_ID = 
$id"__FILE____LINE__);

}


?>
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

jbraum

Now I'm getting the following error

8: Undefined index: show_lastpost
File: /home2/della/public_html/Sources/LoadAds.php
Line: 48

jbraum

Ok I saw that you comment out arrays so I just commented out the ones that showed errors and got it back up.

'id' => $row['ADS_ID'],
'name' => $row['NAME'],
'content' => $row['CONTENT'],
'boards' => $row['BOARDS'],
'posts' => $row['POSTS'],
// 'category' => $row['CATEGORY'],
'hits' => $row['HITS'],
'type' => $row['TYPE'],
'show_index' => $row['show_index'],
'show_board' => $row['show_board'],
'show_threadindex' => $row['show_threadindex'],
// 'show_lastpost' => $row['show_lastpost'],
'show_thread' => $row['show_thread'],
'show_bottom' => $row['show_bottom'],
'show_welcome' => $row['show_welcome'],
'show_topofpage' => $row['show_topofpage'],
'show_towerright' => $row['show_towerright'],
'show_towerleft' => $row['show_towerleft'],
// 'show_underchildren' => $row['show_underchildren'],


The funny thing is that I had problems with this mod before and uninstalled it about 8 months ago.  So currently this mod has been installed but I still had the error on my site.  Any suggestions?

Thanks

jbraum

So now I'm getting this message when I click on a thread.

Template Parse Error!
It seems something has gone sour on the forum with the template system. This problem should only be temporary, so please come back later and try again. If you continue to see this message, please contact the administrator.

You can also try refreshing this page.

jbraum

Got the above fixed but now when I go to post I get the following message.

8: Undefined index: youtube
File: /home2/della/public_html/Themes/default/languages/Post.english.php (eval?)
Line: 779

replaced with backup but didn't work

metallica48423

what language are you using in server settings > default forum language?
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

jbraum


metallica48423

hm....

I'm wondering if the mods installed right... can you check Themes/default/languages/modifications.english.php and see if they're installed?
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

jbraum

This is what I have.

<?php
// Version: 1.1; Modifications

// PM on new user registration.
$txt['pm_register_enable'] = 'Send a PM to newly registered members?';
$txt['pm_register_id'] = 'ID of the member to send PM as';
$txt['pm_register_id_desc'] = 'This is the user profile that will be loaded when the PM is sent.  To set as a guest sent PM set it to 0.';
$txt['pm_register_from'] = 'Send PM to newly registered member as';
$txt['pm_register_from_desc'] = 'This is the username that will appear when the PM is sent.';
$txt['pm_register_subject'] = 'The subject of the PM';
$txt['pm_register_body'] = 'The content of the PM goes here';
$txt['pm_register_body_desc'] = 'This is where you type the message that you would like to send to the user. To insert the username of the user just insert "<b>{$username}</b>".  For forum name use "<b>{$boardname}</b>".';
$txt['pm_register_body_sample'] = 'This is a sample message.' ."\n\n"'Hello {$username}, welcome to {$boardname}.  That will output Hello "username", welcome to "forum_name".';

$txt['youtube'] = 'YouTube';
$txt['uot_users_online_today']='Users Logged In Today';
$txt['uot_yesterday']='Yesterday at ';
$txt['uot_total']='Total';
$txt['uot_visible']='Visible';
$txt['uot_hidden']='Hidden';

?>

metallica48423

do you have a different language set in your profile?
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

jbraum

#15
I went and made a little code change on the themes/default/languages/modifications.english.php and site went blank.  So I uploaded the backup and it's still blank. >:(

Update:  I got the site back up.

As far as the language in my profile it's English.  I get the same error message when I try to reply quote or do anything to a post.

Could I just unload the youtube mod.  With my luck the whole site would go down...  :(




jbraum


metallica48423

well, i would first have to say it may be best to restore your forum to its untouched state and then reinstall the mods.

To do this you can download the large upgrade package, extract it to your computer, delete all the files starting with upgrade_ (theres 3 of them), then FTP those over all current files. 

So long as Settings.php doesn't get overwritten you wont have to do anything else
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

jbraum

This won't change the database? 

Thanks

metallica48423

no but while you're at it, it wouldn't hurt to take a backup anyways :P
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

Advertisement: