Someone from this forum wrote this code for me to display a chat window so my memebers could see who was in the chat room. The code does not work in 1.2 Can someone help me? Thanks!
require "./global.php";
require "./inc/functions_post.php";
ob_start();
include("http://www.mysite.com/forum/chat/info.php");
$chatstats = ob_get_clean();
Where are you placing this code?
The posted code should work, the only thing that might be wrong is that you need define("IN_MYBB", 1);
That's just speclation, because you haven't really provided us with an error so I can't know for sure.
Just as an side note, you shouldn't use an url in include, use the servers path.
Ryan Ashbrook Wrote:Where are you placing this code?
In the index file. Here is a copy from my 1.0 index file.
define("KILL_GLOBALS", 1);
$templatelist = "index,index_whosonline,index_welcomemembertext,index_welcomeguest,index_whosonline_memberbit,forumbit_depth1_cat,forumbit_depth1_forum,forumbit_depth2_cat,forumbit_depth2_forum,forumbit_depth1_forum_lastpost,forumbit_depth2_forum_lastpost,index_modcolumn,forumbit_moderators,forumbit_subforums,index_welcomeguesttext";
$templatelist .= ",index_birthdays_birthday,index_birthdays,index_pms,index_loginform,index_logoutlink,index_stats,forumbit_depth3";
require "./global.php";
require "./inc/functions_post.php";
ob_start();
include("http://www.mysite.com/forum/chat/info.php");
$chatstats = ob_get_clean();
There is no error message. It just doesn't show up. It does nothing.
define("KILL_GLOBALS", 1);
should be
define("IN_MYBB", 1);
CraKteR Wrote:define("KILL_GLOBALS", 1);
should be
define("IN_MYBB", 1);
It does say IN_MYBB. The KILL GLOBALS was from the older versions index file.
include("http://www.mysite.com/forum/chat/info.php");
I don't believe you can include an http file in that manner. You need to have it on the server with a server path unless you want to include the info.php page AFTER it's parsed.
From php.net
Quote:If "URL fopen wrappers" are enabled in PHP (which they are in the default configuration), you can specify the file to be included using a URL (via HTTP or other supported wrapper - see Appendix M for a list of protocols) instead of a local pathname. If the target server interprets the target file as PHP code, variables may be passed to the included file using a URL request string as used with HTTP GET. This is not strictly speaking the same thing as including the file and having it inherit the parent file's variable scope; the script is actually being run on the remote server and the result is then being included into the local script.
labrocca Wrote:I don't believe you can include an http file in that manner. You need to have it on the server with a server path unless you want to include the info.php page AFTER it's parsed.
I'm not a programmer and all I know is that this code worked fine in 1.1.8
Can someone help me by showing me what on that line i would need to change? Thanks.
What are the contents of chat.info?