rstark |
01-20-2003 08:59 PM |
Quote:
Originally posted by version
ixian, the phpinclude template is always parsed, even for the front page of the site, if you include("$forumpath/global.php").
here's the chatstuff in my phpinclude template:
PHP Code:
if ($bbuserinfo[userid] != "0") {
$chatname = str_replace(" ", "%20", $bbuserinfo[username]);
$chatpass = $bbuserinfo[password];
$db=mysql_connect($servername,$dbusername,$dbpassword) or die("Can't open connection to MySQL");
mysql_select_db($dbname) or die("Can't select database");
mysql_query("DELETE from chat_users where u_time < ".(time() - 240)." and u_time > 0");
$num_chatters_query = mysql_query("SELECT DISTINCT username FROM chat_users WHERE room != \"PRIVATE_ROOM\"");
$num_chatters = mysql_num_rows($num_chatters_query);
if ($num_chatters == "0") {
$chatextra = "";
} elseif ($num_chatters == "1") {
$chatextra = "(1 user)";
$istext = "is";
$membertext = "member";
} else {
$chatextra = "($num_chatters users)";
$istext = "are";
$membertext = "members";
}
$who_chatters_query = mysql_query("SELECT DISTINCT username FROM chat_users");
while ($chatters = mysql_fetch_array($who_chatters_query)) {
$who_chatters .= " $chatters[username] ";
}
eval("\$chatinfo = \"".gettemplate("forumhome_chatinfo")."\";");
}
as you can see, i pass variables to my subscripts variables in the URLs, i.e. $chatname as $username, $bbuserinfo[userid] as $userid.
here is the contents of the "menu_chat.php" script mentioned above:
PHP Code:
print "<a href=\"/chat/index.php3?U=$username&PWD_Hash=$password&Ver=H&L=english&R0=General&T=1&D=10&N=200&EN=1\">General Chat</a><br>
<a href=\"/chat/index.php3?U=$username&PWD_Hash=$password&Ver=H&L=english&R0=Poetry+Slam&T=1&D=10&N=200&EN=1\">Poetry Slam</a><br>";
i am also attaching the template for the forumhome_chatinfo. let me know if there is more questions, and if someone wants to add more (or better) instructions to my package, send me the changes and i will give you credit. (busy life right now, got twins on the way :))
|
When I try to add this, I get:
Warning: Access denied for user: 'user_com@localhost' (Using password: NO) in /home/oursite/public_html/forums/global.php(302) : eval()'d code on line 23
Warning: MySQL Connection Failed: Access denied for user: 'user_com@localhost' (Using password: NO) in /home/oursite/public_html/forums/global.php(302) : eval()'d code on line 23
Can't open connection to MySQL
|