Jump to content

Remote Functions - Is it Possible


jack_wetson

Recommended Posts

So...

 

I have a file clients server that I wan't to use functions from a script on our work server, and I keep getting the error that the function im trying to use is un-defined, im probably doing it wrong so any help would be greatly appreciated.

 

Client's Server

include ($cms_Server."/functions/db.php"; 
dbconnect();

 

Work Server

<?php
function dbconnect()
{
    mysql_connect("*snip*", "*snip*", "*snip*") or die(mysql_error());
}
function dbselect($db)
{
    mysql_select_db($db) or die(mysql_error());
}
?>

 

Error: Fatal error: Call to undefined function dbconnect() in C:\xampp\htdocs\client\cms_index.php on line 20

Link to comment
Share on other sites

What is the value of $cms_Server ?

 

I think this is quite obvious http://www.work-server.com

 

And this indeed doesn't work because your .php is parsed on the client server and the result is returned as a response so you'll have to rename it to for example .inc However I do not recommend it as anyone will be able to look up your source code.

Link to comment
Share on other sites

Is there any particular technical reason why that file must be on the work server? Including remote files is terribly inefficient, not to mention the security implications of passing the database credentials over the wire (assuming SSL isn't used).

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.