PDA

View Full Version : Running PHP from other server / database


Breeze
Wed 16th Oct '02, 1:56pm
Hello all. I am trying to add a "whos in chat" to my private forums. The problem is chat is located on my other server/space (I am only allowed 1 database per web site.

Site 1 can't call the script from site 2. I am using phpMyChat on site 2 and VB on site 1.

There seems to be a setting in Cpanel for my servers that would allow other sites I list to access database and maybe that is all I need to do but the code I am using, as supplied with chat script, seems to be calling file from wrong site. Here is the code they gave me. Thanks for any help on this.


<?php

// This script is an example of display, in another page of your website,

// the list or number of users connected to the chat



// Lines below must be at the top of your file and completed according

// to your settings



// relative path from this page to your chat directory

$ChatPath = "chat/";



// HTML link to launch the chat (used by constants below)

$ChatLaunch = "<A HREF=\"phpMyChat.php3\" TARGET=\"_self\">chatting</A>";



$ShowPrivate = "0"; // 1 to display users even if they are in a private room,

// 0 else



$DisplayUsers = "1"; // 0 to display only the number of connected users

// 1 to display a list of users



define("NB_USERS_IN","users are ".$ChatLaunch." at this time."); // used if $DisplayUsers = 0

define("USERS_LOGIN","User ".$ChatLaunch." at this time:"); // used if $DisplayUsers = 1

define("NO_USER","Nobody is ".$ChatLaunch." at this time.");



require("./${ChatPath}/lib/connected_users.lib.php3");

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>



<HEAD>

<TITLE>Integration of chat activity into your own web page</TITLE>

</HEAD>



<BODY>

<TABLE BORDER=3 CELLPADDING=5>

<TR>

<TD>

<?php

display_connected($ShowPrivate,$DisplayUsers,($Dis playUsers ? USERS_LOGIN : NB_USERS_IN),NO_USER);

?>

</TD>

</TR>

</TABLE>

</BODY>



</HTML>

Dimava
Sat 19th Oct '02, 2:47pm
I dont believe that any site would have permission to connect to another site's mysql server

and is this enism by any chance?

Breeze
Sat 19th Oct '02, 2:59pm
What or who is that? I have opted for using a popup window on mouse over for now. I suppose if I knew how to make a frame or something to display the other site code for who us in chat that might be better.

thanks for getting back to me on this.