Realchat Einbindung

Begonnen von burak69, 01 Januar 2008, 19:26:30

⏪ vorheriges - nächstes ⏩

0 Mitglieder und 1 Gast betrachten dieses Thema.

burak69

wer kann mir hilfen

ich habe realchat instaliert
aber habe probleme bei meine bestehende datanbank zu verbinden
ich habe zu zeit v3chat datenbank ich möchte das realchat datenbank auf v3chat datenbank verbinden
und wie gehts aber nicht

hier sind die realchat ph
<?php
    /**
     * Nickname, avatar and profile URLs.
     * These are usually pulled from the database.
     */
    $_name=($i['username']);   // rawurlencode is important
    $profileURL = rawurlencode("http://example.net/chatprofil/profiles/index.php?user=");
    $avatarURL = rawurlencode("http://example.net/chatprofil/profiles/thumbnails/");
     
    /**
     * This string must match the Authentication Key, that you
     * specified in the RealChat Control Center, Server Settings.
     */
    $authKey = "GGHTFDUTOILPUK";
     
    /**
     * Valid chat launching link generated with the Control Center.
     */
    $link = "http://example.net:8085/?0,0,0,17,0";
     
    /**
     * Generates a HMAC-protected link, based on the source link,
     * username, avatar and profile URLS, and authKey.
     */
    function HMACLink($_name, $profileURL, $avatarURL, $link, $authKey) {
        $cpID = substr(strrchr($link, ','), 1);
        $hmac = md5($cpID.$_name.$profileURL.$avatarURL.$authKey.date('Ymd'));
        return $link."&nn=".$_name."&pu=".$profileURL."&au=".$avatarURL."&hmac=".$hmac;
    }
     
    /**
     * The dedicated chat URL for this user.
     * It should be used for Chat Now buttons, etc.
     */
    $hmacLink = HMACLink( $_name, $profileURL, $avatarURL, $link, $authKey );
     
     
     
    // a test
    echo '<a href="'.$hmacLink.'">Chat Now!</a>';
?>

und das ist die bestehende datenbank php

<?php
include_once 'config.php';
include_once 'languages/'.C_LANG.'.php';
include_once 'images/template.php';
if(file_exists('install/index.php')) {
echo "<body bgcolor=\"#eaeaea\"><br><div style=\"font-family: Verdana, Arial; font-size: 12px\" align=center><b>Security Warning</b> - Please delete the folder <b><font color=red>install</font></b> to continue...<br><br><br><a href=\"javascript:parent.window.close();\">close window</a></div>";die;
}

setcookie("is_admin", "", time()-86400);

$secs = date("U");
$username = strip_tags($username);

if($_POST){ // searches badwords to check username is ok for login (non offensive)
$tmp=mysql_query("SELECT * FROM v3chat_room_badwords");
while($ws=mysql_fetch_array($tmp)) {
$badword = ($ws['word']);
$pos = strpos(strtolower($username), strtolower($badword));
if ($pos === false) {} else {
echo "<body bgcolor=\"#eaeaea\"><br><div style=\"font-family: Verdana, Arial; font-size: 12px\" align=center><b><?=lang_login_17?></b><br><br><?=lang_login_18?> <a href=\"javascript:parent.window.close();\"><?=lang_login_19?></a>.</div>";
if(isset($_SESSION['usname'])){unset($_SESSION['usname']);}
die;
}
}
}

////////////////////////////////////////////

if ($action=='logout') {
$sql = "UPDATE v3chat_room_users SET status = 'Logout', room = '$room' WHERE username = '".$_SESSION['usname']."'";;mysql_query($sql);
$ban=mysql_query("SELECT * FROM v3chat_room_bans WHERE username='".$_SESSION['usname']."'");
$banned = mysql_num_rows($ban);if($banned<='0'){
$sql = "INSERT INTO v3chat_room_messages (memberid, membername, message, room, date_mess, status)
VALUES ('$_id', '".$_SESSION['usname']."', 'LOGOUT', '$room', '$secs', '0')";mysql_query($sql) or die(mysql_error());
}
setcookie("is_admin", "", time()-86400);
if(isset($_SESSION['usname'])){unset($_SESSION['usname']);}
header("Refresh:0;URL=login.php");
?>
<script language="JavaScript">
<!--
parent.window.close();
// -->
</script>
<?
die;
}

////////////////////////////////////////////

if ($username!='' || isset($_SESSION['usname'])){
if(isset($_SESSION['usname'])){$username = $_SESSION['usname'];}

$user_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];if ($user_ip ==''){$user_ip = $_SERVER['REMOTE_ADDR'];}

if ($ban_user_by=='1'){$banned_user = "username='$username'";} // ban by username
if ($ban_user_by=='2'){$banned_user = "userip='$user_ip'";} // ban by ip
if ($ban_user_by=='3'){$banned_user = "username='$username' OR userip='$user_ip'";} // ban by both

$ban=mysql_query("SELECT * FROM v3chat_room_bans WHERE ".$banned_user."");
$banned = mysql_num_rows($ban);
if($banned){echo "<body bgcolor=\"#eaeaea\"><div style=\"font-family: Verdana, Arial; font-size: 12px\"><b>$lang_login_1</b><br><br>$lang_login_2</div>";die;}

$tmp=mysql_query("SELECT * FROM v3chat_room_users WHERE username ='$username' LIMIT 1");
while($i=mysql_fetch_array($tmp)) {
$_name=($i['username']);
$_id=($i['id']);
$_userid=($i['userid']);
$_status=($i['status']);
$_userlevel=($i['userlevel']);
$_pass=($i['password']);
$_system_c=($i['system_c']);
}

if ($userpass == $admin_pass || $_userlevel == 'admin'){ // set admin cookie if admin password supplied and user is admin
setcookie("is_admin", md5(C_ADMINP), time()+86400);
}

if (strtolower($_name) == strtolower($username) && $_status == 'Login' && $_system_c > date("U")-60){ // check if user is already logged in
echo "<body bgcolor=\"#eaeaea\"><div style=\"font-family: Verdana, Arial; font-size: 12px\"><b>".$lang_login_3."</b><br><br>".$lang_login_11."</div>";
if(isset($_SESSION['usname'])){unset($_SESSION['usname']);}
$username='';$usname='';
return;
}

if ($profile_def=='0' && strtolower($_name) == strtolower($username) && $_userlevel == 'admin' && !$userpass){ // require moderator password (set in db.php)
echo "<body bgcolor=\"#eaeaea\"><div style=\"font-family: Verdana, Arial; font-size: 12px\"><b>".$lang_login_21."</b><br><br>".$lang_login_20."</div>";
if(isset($_SESSION['usname'])){unset($_SESSION['usname']);}
$username='';$usname='';
return;
}

if ($profile_def!='1' && $_pass != $userpass){ // password does not match users password
echo "<body bgcolor=\"#eaeaea\"><div style=\"font-family: Verdana, Arial; font-size: 12px\"><b>".$lang_login_22."</b><br><br>".$lang_login_23." (<a href=index.php>".$lang_login_19."</a>)</div>";
if(isset($_SESSION['usname'])){unset($_SESSION['usname']);}
$username='';$usname='';
return;
}

if ($_name == ''){ // add new user
$sql = "INSERT INTO v3chat_room_users (userid, username, password, userip, userlevel, status, room, date, system_c)
VALUES ('$userID', '$username', '', '$user_ip', 'guest', 'Login', '$room', NOW(''), '".date("U")."')";mysql_query($sql) or die(mysql_error());
}
else{ // update existing user
$sql = "UPDATE v3chat_room_users SET date = NOW(''),  system_c = '$secs', status = 'Login', room = '$room' WHERE username = '$username'";;mysql_query($sql);
}

$tmp=mysql_query("SELECT * FROM v3chat_room_users WHERE username ='$username' LIMIT 1");
while($log_in=mysql_fetch_array($tmp)) {$_id=($log_in['id']);$_uid=($log_in['userid']);}

if ($userID!=''){$_id=$_uid;}

setcookie("usname", $username, 0, "/");

$sql = "UPDATE v3chat_room_messages SET status = '1' WHERE status = '0'";;mysql_query($sql);

$sql = "INSERT INTO v3chat_room_messages (memberid, membername, message, room, date_mess, status)
VALUES ('$_id', '$username', 'LOGIN', '$room', '$secs', '0')";mysql_query($sql) or die(mysql_error());

if(!isset($_SESSION['usname'])){$_SESSION['usname'] = $username;}
setcookie("usname", $username, 0, "/");
header("Refresh:0;URL=chathtml.php?memberid=".$_id."&username=".$username."&room=".$room."&login=1");return;

}

if ($guest_access=='yes'){
?>

<html>
<head>
<title>-</title>
<meta http-equiv="Content-Type" content="text/html; charset=<?=C_CHARSET?>" />
<STYLE type=text/css>
<!--
body {font-family: Verdana, Arial; font-size: 12px}
table {font-family: Verdana, Arial; font-size: 12px;border:}
.table_border {border: 1px solid #cccccc ;}
a:link.online{text-decoration:none;font-size:10px;color:blue}
a:visited.online{text-decoration:none;font-size:10px;color:blue}
a:hover.online{text-decoration:underline;font-size:10px;color:blue}
a:link{text-decoration:none;font-size:12px;color:blue}
a:visited{text-decoration:none;font-size:12px;color:blue}
a:hover{text-decoration:underline;font-size:12px;color:blue}
.transON {z-index:-1; width: 50%; background-color: white;opacity:.75;filter: alpha(opacity=75); border:1px solid black; }
// -->
</STYLE>
<script language="JavaScript">
<!--
function formCheck() {
if (form.username.value == "" || form.username.value == " "){
alert("<?=$lang_login_4?> ");
form.username.focus();
return false;
}
if (form.userpass.value == "" || form.userpass.value == " "){
alert("<?=$lang_login_4b?> ");
form.userpass.focus();
return false;
}
}
// -->
</script>
</head>
<body onLoad="form.username.focus();" bgcolor="<?=C_BACKGROUNDCOL?>" background="images/<?=C_BACKGROUNDIMG?>" marginwidth=0 marginheight=0 leftmargin=0 rightmargin=0 topmargin=0 bottommargin=0>
<table width="103%" border="0" cellpadding=10 style="width: 100%; height: 100%">
<tr valign=middle align=center><td align="center">
<table class="table_border" cellpadding=10 style="width: 100%; height: 100% " border="0">
<tr><td valign="middle">
<form name="form" action="" method="post" onSubmit="return formCheck(this);">
<table class="transON" align="center" cellpadding=10 cellspacing="0" border="0">
<tr><td>
<table height=100 align="center" cellpadding=2 cellspacing="0" border="0">
<?
$expire_secs=date("U")-60;
$tmp=mysql_query("SELECT * FROM v3chat_room_users WHERE status='Login' AND system_c >='$expire_secs' ORDER BY username ASC");
$online_users = mysql_num_rows($tmp);
?>
<tr align=center><td colspan="2"><img src="images/<?=C_SITELOGO?>" align=middle></td></tr>
<tr><td>&nbsp;</td><td align="right"><a class="online" href="online.php" target="_blank"><?=$lang_login_10?> (<?=$online_users?>)</a>&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>
<tr><td><?=$lang_login_5?>:</td><td><input type="text" name="username" value="" maxlength="16"></td></tr>
<tr><td><?=$lang_login_6?>:</td><td><input type="password" name="userpass" value="" maxlength="16"></td></tr>
<tr><td><?=$lang_login_8?>: </td><td>
<select name="room">
<option value="Lobby">Lobby
<?
$tmp=mysql_query("SELECT * FROM v3chat_room_rooms WHERE room_name != 'Admins Only' AND room_name != 'Lobby' AND password = '' ORDER BY `room_name` ASC");
while($i=mysql_fetch_array($tmp)) {
?>
<option value="<?=$i['room_name'];?>"><?=$i['room_name'];?>
<?}?>
</select>
</td></tr>
<tr align=center><td>&nbsp;</td><td><input type="submit" name="submit" value="<?=$lang_login_9?>" onClick="return formCheck(this);"></td></tr>
<tr align=center><td colspan="2"><?=$lang_login_7?> <a href="profiles/register.php"><?=$lang_login_12?></a></td></tr>
</table>
</form>
</td></tr></table>
<br></td></tr></table>
</td></tr></table>
</body>
</html>
<?}die;?>