I'm almost there...Got this error message
Parse error: syntax error, unexpected T_VARIABLE in /home/content/f/t/d/ftdj2009/html/infocenter/chat/index.php on line 63
Here is my code for the page...
<?php
/* ##########################################################################
# ET-Chat v3.x.x
# Lizenz: CCPL -
http://creativecommons.org/licenses/by-nc/2.0/de/
# Autor: Evgeni Tcherkasski <SEDesign />
# E-mail: info@s-e-d.de
# WWW:
http://www.sedesign.de
############################################################################*/
error_reporting(E_ALL ^ E_NOTICE);
session_start();
define("IN_MYBB", 1);
require("../global.php");
global $db, $mybb, $lang;
$sender = $mybb->user['uid'];
//Redirect guests to index.php
if($mybb->user['uid'] == 0) {
redirect("../index.php", "Guests aren't allowed to chat. Please login");
}
// Connect to MySQL database, MyBB integration:
$verbindung = mysql_pconnect( "myhostname", "myusername", "mypassword");
if (!$verbindung) // If there is something wrong display error message
{
echo "<br><center><b>- Database is not connectiong properly - contact admin -</b></center>";
exit;
}
mysql_select_db("myhostname");
//Get username
$abfrage = "SELECT username FROM mybb_users WHERE uid LIKE ".$sender."";
$ergebnis = mysql_query($abfrage);
mysql_query("SET NAMES 'utf8'");
while($row = mysql_fetch_object($ergebnis))
{
$chatusername = $row->username;
}
$username = $chatusername
//*****************************************************************************
// Für die Realisierung der Anbindung des Chats an Ihr Userverwaltungssystem aus einem
// Forum, CMS, usw. müssen Sie lediglich die unten stehenden Sessionvariablen
// in Ihrem System mit dem Usernamen belegen und den User mit einem
// Link auf diese Datei führen. Beachten Sie dass dabei der Username ohne Passwort übertragen wird.
// Sie dürfen also in Chat keine Passwörter für Admins und Mods anlegen. Für einen Chatbenutzer ist die
// Übergabe des Usernamen über die Sessionvar. $_SESSION['etchat_username'] aus Ihrem
// System ausreichend.
// $user_pw = $_SESSION['etchat_user_pw']; // am besten jedoch, man erstellt Admins und Mods ohne PW
// und löscht die index.php demit niemand unbefügt als Afmin rein kann.
//---------------------------------------------------------------------------
// oder als GET oder POST Übergabe, jedoch unsicher und sollte kodiert werden
// $username = $_REQUEST['etchat_username'];
// $gender = $_REQUEST['etchat_gender'];
//---------------------------------------------------------------------------
// Weiterleitung nach dem Logout(die Session bleibt bestehen,
// da sonst der User aus Ihrem System rausfliegt.)
$_SESSION['etchat_v3_logout_url']="http://www.ftdj3.com/infocenter";
//*****************************************************************************
//Bugfix 26.06.09 ------------------------
if (empty($username)){
echo "Error!<br>No username received.";
exit();
}
// ---------------------------------------------
header('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0');
include('dbcon/config.inc.php');
include('dbcon/'.$database_class);
include('dbcon/init_chat_db.class.php');
include('lang/xml_parser.class.php');
$confObj = new InitChatDB($prefix, $sqlhost,$sqluser,$sqlpass,$database,true);
$db = $confObj->dbObj;
$db->sql("delete FROM {$prefix}etchat_messages where etchat_timestamp < ".(date('U')-($confObj->loeschen_nach*3600*24)), false);
$db->sql("delete FROM {$prefix}etchat_blacklist where etchat_blacklist_time < ".date('U'), false);
$db->sql("delete FROM {$prefix}etchat_kick_user where etchat_kicked_user_time < ".date('U'), false);
// language XML auswerten ---------------------------
$xml = file_get_contents('lang/'.$confObj->lang_xml_file);
$parser = new XMLParser($xml);
$parser->Parse();
$lang=$parser->document->checkusername_php[0];
//---------------------------------------------------
// Textfarbe ermitteln. ----------------------------------
$style_lines = file("styles/".$confObj->style."/style.css");
foreach($style_lines as $line){
if (substr($line, 0, 10)=="Textfarbe:") {
$ft = explode(":", $line);
$_SESSION['etchat_v3_textcolor'] = trim($ft[1]);
}
if (substr($line, 0, 12)=="Systemfarbe:") {
$fs = explode(":", $line);
$_SESSION['etchat_v3_syscolor'] = trim($fs[1]);
}
}
// Textfarbe ermitteln ENDE ----------------------------------
// Blacklist IP Prüfung
$user_param_all = $_SERVER['REMOTE_ADDR']."@".@gethostbyaddr($_SERVER['REMOTE_ADDR'])."@".@getenv('HTTP_X_FORWARDED_FOR');
//zuerst nach Cookie:
if(isset($_COOKIE['cookie_etchat_blacklist_ip']) && isset($_COOKIE['cookie_etchat_blacklist_until']))
$blacklist_c=$db->sql("SELECT etchat_blacklist_ip FROM {$prefix}etchat_blacklist WHERE etchat_blacklist_ip = '".$_COOKIE['cookie_etchat_blacklist_ip']."' and etchat_blacklist_time = ".$_COOKIE['cookie_etchat_blacklist_until']." and etchat_blacklist_time > ".date('U'), false);
// jetzt ohne Cookie
$blacklist=$db->sql("SELECT etchat_blacklist_ip FROM {$prefix}etchat_blacklist WHERE etchat_blacklist_ip = '".$user_param_all."' and etchat_blacklist_time > ".date('U'), false);
if (is_array($blacklist) || is_array($blacklist_c)){
$db->close();
header('Location: admin/blacklist.php');
@session_unset();
@session_destroy();
exit();
}
//----------------------------------------------
// Löscht alle Datensätze, die alt sind um festzustellen ob User online
$db->sql("DELETE FROM {$prefix}etchat_useronline WHERE etchat_onlinetimestamp < ".(date('U')-(($confObj->reloadsequenz/1000)*4)), false);
$username = htmlentities($username, ENT_QUOTES, "UTF-8");
$user_vorhanden=$db->sql("SELECT etchat_user_id, etchat_username, etchat_userpw, etchat_userprivilegien FROM {$prefix}etchat_user WHERE etchat_username = '".$username."' order by etchat_userpw DESC", false);
if (is_array($user_vorhanden)){
if ($gender=='f' || $gender=='m')
$db->sql("UPDATE {$prefix}etchat_user SET etchat_usersex = '".$gender."' WHERE etchat_user_id = ".$user_vorhanden[0][0], false);
if (!empty($user_pw) && md5($user_pw)==$user_vorhanden[0][2]) {
$_SESSION['etchat_v3_user_id'] = $user_vorhanden[0][0];
$_SESSION['etchat_v3_username'] = $user_vorhanden[0][1];
$_SESSION['etchat_v3_user_priv'] = $user_vorhanden[0][3];
}
else {
if (!empty($user_vorhanden[0][2]) && md5($user_pw)!=$user_vorhanden[0][2]) {
echo "PW falsch.";
exit();
}
else {
$_SESSION['etchat_v3_user_id'] = $user_vorhanden[0][0];
$_SESSION['etchat_v3_username'] = $user_vorhanden[0][1];
$_SESSION['etchat_v3_user_priv'] = $user_vorhanden[0][3];
}
}
}
else{
if ($gender=='f' || $gender=='m')
$db->sql("INSERT INTO {$prefix}etchat_user ( etchat_username, etchat_usersex) VALUES ( '".$username."', '".$gender."')", false);
else
$db->sql("INSERT INTO {$prefix}etchat_user ( etchat_username ) VALUES ( '".$username."' )", false);
$user_neu=$db->sql("SELECT etchat_user_id, etchat_username, etchat_userprivilegien FROM {$prefix}etchat_user WHERE etchat_username = '".$username."' LIMIT 1", false);
$_SESSION['etchat_v3_user_id'] = $user_neu[0][0];
$_SESSION['etchat_v3_username'] = $user_neu[0][1];
$_SESSION['etchat_v3_user_priv'] = $user_neu[0][2];
}
// Nachricht nach Raumbetritt.
$raum_array=$db->sql("SELECT etchat_room_message FROM {$prefix}etchat_rooms where etchat_id_room = 1", false);
if (!empty($raum_array[0][0])){
// Zeilenumbruch bei WIN
$room_message_insert = str_replace("\r\n","<br />",$raum_array[0][0]);
// Zeilenumbruch bei LIN, Uniux, MacOS
$room_message_insert = str_replace("\n","<br />",$room_message_insert);
$db->sql("INSERT INTO {$prefix}etchat_messages ( etchat_user_fid , etchat_text, etchat_text_css, etchat_timestamp, etchat_fid_room, etchat_privat)
VALUES ( 1, '<div style=\"margin: 4px;\">".$room_message_insert."</div>', 'color:#".$_SESSION['etchat_v3_syscolor'].";font-weight:bold;font-style:normal;', ".date('U').", 1, ".$_SESSION['etchat_v3_user_id'].")", false);
$my_first_mess_id = $db->sql("SELECT max(etchat_id) from {$prefix}etchat_messages", false);
$db->sql("INSERT INTO {$prefix}etchat_messages ( etchat_user_fid, etchat_text, etchat_text_css, etchat_timestamp, etchat_fid_room)
VALUES ( 1, '<b>".$_SESSION['etchat_v3_username']."</b> ".$lang->eintritt[0]->tagData."', 'color:#".$_SESSION['etchat_v3_syscolor'].";font-weight:normal;font-style:normal;', '".date('U')."', 0)", false);
}
else{
$db->sql("INSERT INTO {$prefix}etchat_messages ( etchat_user_fid, etchat_text, etchat_text_css, etchat_timestamp, etchat_fid_room)
VALUES ( 1, '<b>".$_SESSION['etchat_v3_username']."</b> ".$lang->eintritt[0]->tagData."', 'color:#".$_SESSION['etchat_v3_syscolor'].";font-weight:normal;font-style:normal;', '".date('U')."', 0)", false);
$my_first_mess_id = $db->sql("SELECT max(etchat_id) from {$prefix}etchat_messages", false);
}
$_SESSION['etchat_v3_last_id'] = 0;
$_SESSION['etchat_v3_my_first_mess_id'] = $my_first_mess_id[0][0];
@$db->close();
header('Location: chat.php');
?>