Jump to content

Fatal error: Call to undefined function


hackalive

Recommended Posts

Hello I keep getting a Fatal error: Call to undefined function

for NO real reason allow url includes is on, and I get the function trough a require_once, the file being called by require_once if I echo something from it it appears on the page, only the functions even a blank function foo(){}; wont work grrrrrrrrrrrrrrr

any ideas?

 

thanks in advance

Link to comment
Share on other sites

index.php

	require_once('http://10.0.0.1/validate.php');
foo();

 

validate.php

	function foo(){
}

 

and yes I need it to call via url becuase eventually they will be on two different servers so it would be more like

 

index.php

 

	require_once('http://myserver.com/validate.php');
foo();

 

error is

 

tal error: Call to undefined function foo() in C:\inetpub\mysite\index.php on line 03

Link to comment
Share on other sites

When you use a URL in a require or include, the PHP is executed and the results are included in your script. This is usually not what you want. Just use the plain file name

<?php
require_once('validate.php');
?>

 

Ken

Link to comment
Share on other sites

if I make this validate.php

echo "AA"; 	function foo(){
}

 

it will echo AA when validate.php is called through the require_once, but I still get the undefined function error, this is sooooooooooo annoying. Can anyone test the code on their system to see if they get the same result? (of course you'll need to use your IP not 10.0.0.1, unless that is also you test environments IP :-)).

Link to comment
Share on other sites

The php code is parsed and executed when the URL is requested (the same as if you browsed to the file being include.) As you have already been told, you only receive any output from the included file. You don't receive the raw php code.

Link to comment
Share on other sites

Why do you want to be able to include code from a different server?

 

Putting a URL into an include() statement takes at least 50-100 times longer to execute than including the file directly thorough the file system. Putting a URL into an include() statement also means that your site will be broken any time the site where the include file is located at is also down. Do you want your site to be slow and unnecessarily crippled?

Link to comment
Share on other sites

It is done once, and is for license key cross checking for a particular system.

Basically it checks that the license key in the DB is one that is in the global licensing DB and matches the credentials stored in the local DB (eg Name, phone etc)

 

It cross checks, in a simple way of putting it

So I really do need to be able to achieve this somehow, mainly becuase I could achieve the MySQL query in the index.php but then the global DB's mysql credentials are floating around

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.