Jump to content

Call To Undefined Function Themeheader()


Recommended Posts

hxxp:\\www.owsleykyhist.net is the site I'm working on.

 

I'm trying to help the site administrator fix an issue that happened after they were trying to change something. I can't seem to figure out what they messed up, they seem to think it was an outside attack, but I'm not familiar with the cpanel or coding to figure out whats wrong.

 

I've read through the site error log and seem to be coming up with this error since the problem started:

Call to undefined function themeheader() in /home/owsley/public_html/header.php on line 52

 

I've replaced the header.php file (from public_html/header.php), as well as the theme.php (public_html/themes/Sand_Journey/theme.php) with versions from a site backup from 2008.

 

Still having this issue repeatedly in the error log since then. Anyone got any ideas? Just to clarify, this error wasn't happening before a few days ago, so I'm not sure why the old files wouldn't correct it, but again, I'm not an expert at coding so I'm not sure what the issue is.

Link to comment
Share on other sites

<?php

/************************************************************************/
/* PHP-NUKE: Advanced Content Management System                         */
/* ============================================                         */
/*                                                                      */
/* Copyright (c) 2005 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

if (stristr($_SERVER['SCRIPT_NAME'], "header.php")) {
Header("Location: index.php");
die();
}

@require_once("mainfile.php");

##################################################
# Include some common header for HTML generation #
##################################################

$header = 1;

function head() {
global $slogan, $sitename, $banners, $nukeurl, $Version_Num, $artpage, $topic, $hlpfile, $user, $hr, $theme, $cookie, $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $textcolor1, $textcolor2, $forumpage, $adminpage, $userpage, $pagetitle;
@include("includes/ipban.php");
$ThemeSel = get_theme();
@include("themes/$ThemeSel/theme.php");
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
echo "<html>\n";
echo "<head>\n";
echo "<title>$sitename $pagetitle</title>\n";
@include("includes/meta.php");
@include("includes/javascript.php");

if (file_exists("themes/$ThemeSel/images/favicon.ico")) {
echo "<link REL=\"shortcut icon\" HREF=\"themes/$ThemeSel/images/favicon.ico\" TYPE=\"image/x-icon\">\n";
}
echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"backend.php\">\n";
echo "<LINK REL=\"StyleSheet\" HREF=\"themes/$ThemeSel/style/style.css\" TYPE=\"text/css\">\n\n\n";
if (file_exists("includes/custom_files/custom_head.php")) {
@include_once("includes/custom_files/custom_head.php");
}
echo "\n\n\n</head>\n\n";
if (file_exists("includes/custom_files/custom_header.php")) {
@include_once("includes/custom_files/custom_header.php");
}
themeheader();
}

online();
head();
@include("includes/counter.php");
global $home;
if ($home == 1) {
message_box();
blocks(Center);
}


?>

Link to comment
Share on other sites

There error is self explanatory. You are calling a function called themeheader() and the function has not been defined. When a page loads there can be any number of include files and even the file above could have been (and probably was) included from a different file. You need to figure our in which file themeheader() is defined and figure out where that file should be included. So, look at the include files in that script above first. Then you might have to trace from the page that the user first accesses to the script above.

 

Also, as a quick test, I notice that all of your include()'s have an ampersand in front of them which would suppress an error. So, it could be that one or more of those include files have been moved or deleted (and one of them is where the function was defined). Remove those ampersands and see if any errors are reported.

Link to comment
Share on other sites

Please don't take offense, I'm actually trying to follow your instructions, and I do appreciate your help immensely.

I don't know if its because you were in a hurry, or possibly English is not your first language, but I don't understand a few of the things you're saying, could you please elaborate on a few things so I can make sure I understand them.

 

"Then you might have to trace from the page that the user first accesses to the script above."

"have an ampersand in front of them" I thought an ampersand was &. Could you type the symbol you mean so I can make sure I remove the right thing?

Link to comment
Share on other sites

"Then you might have to trace from the page that the user first accesses to the script above."

 

I *assume* that the user is not typing www.yourdomain.com/header.php into their browser but is instead going to www.yourdomain.com/somepage.php and it is the somepage.php that is including some files and it either directly including header.php or one of the files that it is including is ultimately including header.php. When a user requests a page in their browser the server could be processing one file or hundreds - which are chained together through includes or requires. Somewhere in the processing of all those files the function themeheader() needs to be defined before you call the function. There is no way for us to know where that function is defined or how the page where it is defined was/is included. It could be that the function was removed or renamed or that the file which defines that function was removed, renamed or moved to a different location.

 

"have an ampersand in front of them" I thought an ampersand was &. Could you type the symbol you mean so I can make sure I remove the right thing?

Ok, so I said ampersand instead of apetail (i.e. at symbol). But seriously, you couldn't deduce that is what I meant? Every single one of the include statements begins with the same character.

 

Here is another suggestion. Find a utility that will search the contents of all of the files and look for "function themeheader" and find out what page that file is defined in. Then do a search for any includes for that file. That should get you going in the right direction.

Link to comment
Share on other sites

Sorry guys, I don't mean to sound like an idiot, but I've never dealt with this stuff before. I'm trying to help an elderly site admin who basically only knows how to add pictures and posts through an FTP program, someone made the site 8 years ago and then left the organization, so I'm really lost, but since I know a little about computers I'm just trying to get their homepage working again for them.

 

Do you have any suggestions about a utility that can search the files? I've been using cpanel because it was the only way i knew of to get into the site files.

Link to comment
Share on other sites

You need to download (FTP) a copy of all the current files so that you can perform searches and/or get the site running on a local development system.

 

Edit: Actually, since you have a previous backup copy of the files, you should be searching the backup files to find where the function is defined at.

 

Edit2: A programming editor, like notepad++, will have a "search all files within folder" function that you can use to find where the function is defined, assuming the name in the function call has not be altered.

Edited by PFMaBiSmAd
Link to comment
Share on other sites

Found the function definition and copied and pasted it into the code, and seems like its needed in a lot of places, since I've corrected about 5 undefined functions in different files so far. Also my blank white pages are suddenly blue lol! Seems like I'm making progress, thanks for your help.

Link to comment
Share on other sites

The step after finding the file where the function is defined, would be to find out why that particular file is not being included by the rest of the code or why the code in that file is not being seen as being php code.

 

In the file where you found the function definition, were all the opening php tags full ones <?php or where they short ones <?

Link to comment
Share on other sites

They were full ones.

 function themeheader() {
   global $user, $banners, $sitename, $slogan, $cookie, $prefix, $db;
   cookiedecode($user);
   $username = $cookie[1];
   if ($username == "") {
       $username = "Anonymous";
   }
   echo "<body bgcolor=\"#004080\" text=\"#000000\" link=\"#004080\" vlink=\"#004080\" alink=\"#004080\">";
   if ($banners) {
include("banners.php");
   }
   $topics_list = "<select name=\"topic\" onchange='submit()'>\n";
   $topics_list .= "<option value=\"\">All Topics</option>\n";
   $toplist = $db->sql_query("select topicid, topictext from ".$prefix."_topics order by topictext");
   while(list($topicid, $topics) = $db->sql_fetchrow($toplist)) {
$topicid = intval($topicid);
   if ($topicid==$topic) { $sel = "selected "; }
$topics_list .= "<option $sel value=\"$topicid\">$topics</option>\n";
$sel = "";
   }
   if ($username == "Anonymous") {
$theuser = "  <a href=\"modules.php?name=Your_Account\">Create an account";
   } else {
$theuser = "  Welcome $username!";
   }
   $public_msg = public_message();
   $tmpl_file = "themes/Odyssey/header.html";
   $thefile = implode("", file($tmpl_file));
   $thefile = addslashes($thefile);
   $thefile = "\$r_file=\"".$thefile."\";";
   eval($thefile);
   print $r_file;
   blocks(left);
   $tmpl_file = "themes/Odyssey/left_center.html";
   $thefile = implode("", file($tmpl_file));
   $thefile = addslashes($thefile);
   $thefile = "\$r_file=\"".$thefile."\";";
   eval($thefile);
   print $r_file;
}

This was what was in the file, and it started with a <?php, then had various other functions defined, in fact, it looked like a template from phpnuke.org defining the various functions, as there was greyed-out text above each one, giving a small description from them, but it had been modified by the site designers when they initially started, since there were numerous additions and specifics about the site.

Link to comment
Share on other sites

Needless to say, I'm at a stopping point as there are no errors in the log, but the links that point to things, such as one that would say siteinfo/modules.php?name=Topics, are still directing me to screens that are either completely blank, or completely blank with a blue background.

Link to comment
Share on other sites

The next step would be -

to find out why that particular file is not being included by the rest of the code

 

By copy/pasting the function definition into the files where it is called, is only fixing a symptom, the one error message. The actual problem remains. The other things in that file are needed by the application, otherwise they wouldn't have been present in that file along with the themeheader() function definition.

 

Is that file present on the server? Is the file on the server identical to the file in the backup? Where and how is that file being included by the main/other files making up the application?

Link to comment
Share on other sites

I'll add the following:

 

OK, so you've found the file where the function is defined. So, somewhere that file was previously being included. There are a few things you can to figure out the cause:

 

1. The file was moved from it's previous location so the include() can't find it. You can check this by doing a search of the files for the file name. If you find any includes see if the path matches the file's actual location

 

2. The file name was changed so, again, the include() cannot find the file. I would suggest removing the at symbol from the front of every include() in all your files.

 

3. The last possibility is that the line of code to include the file has been removed. If this is the case, well, I don't know. It would be difficult to figure out where the include should be unless there are appropriate comments in the code.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.