Forum Moderators: coopster
a 'Call to undefined function' means your script is trying to call a function (do what the lines of code in this function stipulate) which hasn't been defined - nowhere has it been stated what this function should do. You've got basically two kinds of functions - those which are already pre-defined and ready-to-use in php (the ones outlined in the manual), and the ones your script has defined. These always look like:
function whatever_you_call_it($somevariable, $anothervariable){
(various lines of code here)
}
whatever_you_call_it().
Your particular error means that on line 24, there's a line something like:
main_page()
function main_page($somevariable){
do_this_and_that();
}
index.php), but maybe your script can't find this file. Your script might be put in some odd place where, relatively speaking, the places it looks don't correspond to the place where that file actually is. Look and see if there aren't other errors about 'stream couldn't be opened, included file not found' or something like that and see if it isn't possible to put that file in a place where it can be found, taking those error notices as clues.
That said, you might want to do a search in all script files for "function main" and see if perhaps the function exists in your script and is named "mainPage" or something like that (if, for example, you are modifying a script that you downloaded).
Cheers,
Tom
Probably one of the best things you can do now is to get a 'local' install of PHP. This will make your own PC be able to function as a server, with PHP, database, and all. Go to [apachefriends.org...] , d/l, clickety click and bingo, you've got your own server functionality on your own PC.
Just put your script in the 'web root' directory and surf to localhost (type [localhost...] in your address bar).
You can try out stuff on your own computer then to see what works - and once it does work, you can upload it to the server. When I first got my own install of PHP, mysql, and apache on my computer, it made me feel like a six-year-old on Christmas morning.
Apart from this, there's not much more I can say than the advice ergophobe and I gave you already.
Hope you get your script working.
Met vriendelijke groeten,
minck
[edited by: ergophobe at 4:53 pm (utc) on Nov. 7, 2004]
at the top of your script somewhere that's on your local computer, after the <?php, add this line:
error_reporting(E_ALL);
look through index.php and see if there are any lines with the words include, include_once, require, or require_once like
include thisfile.php;
if so, thisfile.php is also one of the files that's supposed to have information needed for running that page. There may be more than one. If any of these files 'can't be found' by the server, it might be the file that's supposed to contain that function.
Run your script again by pointing your browser to it.
You may see some kind of error warning that a file couldn't be included, a stream couldn't be opened, etc. This could give you a clue about which file is supposed to be opened that isn't working.
Otherwise, look through all the php files in the script and see if you can find lines like the one I mentioned in the other thread:
fuction mainpage($maybesomevariableshere){
/*something here*/
}
If so, put a line in index.php like
include 'path/to/filewiththisfunction.php';
and see if that might work.
Otherwise, it's possible that your script is just plain buggy. Sometimes re-downloading it from the source you got it from can correct possible file corruptions; but if you already did this, you might try to find a more reliable script.
INDEX.PHP
<?
$indexloaded=1;
include("config/config.php");
include("$dir[func]/global.php");
include("$dir[func]/loginforms.php");
switch($action){
//PLAYER
case "join":
include("$dir[func]/player_new.php");
form_join();
break;
//END ADDONS - DEFAULT
default:
include("$dir[base]/home.php");
main_page();
break;
}
//FIND AND DELETE/AWARD WINS FOR UNRESPONDED CHALLENGES
include("$dir[func]/challengeforfeit.php");
check_unrespondedchallenges();
?>
HOME.PHP
<?
if(!$indexloaded){
header("Location: ./index.php");
}
function main_page(){
global $dir, $url, $file, $out, $misc;
etc, etc <jatar_k>
[edited by: jatar_k at 10:55 pm (utc) on Nov. 8, 2004]
[edit reason] removed code dump [/edit]
PHP gaming ladder script [webmasterworld.com] msg 8 in particular
it even smells like the same script ;)
I am sure it is just the include path in the config file