<?
require("config.php");
require("funktioner.php");
$brugerinfo = brugerinfo($_COOKIE[minichat3_id]);
if ($brugerinfo[kickby] != ""){
if ($brugerinfo[kicktype] == 1){
print "<h2>You were kicked by: $brugerinfo[kickby]</h2><br>\n";
print "<h3>KickText: $brugerinfo[kicktext]</h3>";
}
if ($brugerinfo[kicktype] == 2){
print "<h2>You were banned by: $brugerinfo[kickby]</h2><br>\n";
print "<h3>KickText: $brugerinfo[kicktext]</h3>";
}
exit;
}
checksession($brugerinfo[sesid]);
Skaer_txt($_COOKIE[minichat3_id]);
Skaer_txt($brugerinfo[room]);
?>
<?
if ($_GET[action] == "changeroom"){
if ($brugerinfo[room] != $_GET[newroom]){
ChangeRoom($brugerinfo[id],$_GET[newroom]);
}
else {
WriteToRemote("",$brugerinfo[id],"".Language("50")."");
}
}
elseif ($_GET[action] == "take_credits"){
$credit = format($_GET[credit]);
$res_credit = mysql_query("SELECT * FROM minichat3_givecredits where id='$credit'");
$row_credit = mysql_fetch_array($res_credit);
if ($brugerinfo[status] >= 1){
if ($row_credit[giveto] == 0){
mysql_query("UPDATE minichat3_givecredits SET giveto='$brugerinfo[uid]' where id='$credit'");
$takefrominfo = unikinfo($row_credit[takefrom]);
WriteToChat($brugerinfo[room],"System","","".Language("51")." <b>".$takefrominfo[nick]."</b> [".Language("52").": ".$row_credit[amount]."] ".Language("53")." <b>".$brugerinfo[nick]."</b>");
mysql_query("UPDATE minichat3 SET credits=credits-'$row_credit[amount]' where id='$takefrominfo[id]'");
mysql_query("UPDATE minichat3 SET credits=credits+'$row_credit[amount]' where id='$brugerinfo[uid]'");
}
else {
WriteToRemote("",$brugerinfo[id],"".Language("54")."!");
}
}
else {
WriteToRemote("",$brugerinfo[id],"".Language("55")."!");
}
}
elseif ($_POST[action] == "skriv"){
$text = format($_POST[text]);
if ($brugerinfo[mute] == 1){
WriteToRemote("",$brugerinfo[id],"".Language("56")."!");
}
elseif ($text != "" && $text != " "){
if ($text == "?"){
include("help.php");
exit;
}
elseif ($_POST[sendto] == "System"){
if ($brugerinfo[status] == 3){
WriteToChat($brugerinfo[room],"System","","$text");
}
else {
WriteToRemote("",$brugerinfo[id],"".Language("57")."!");
}
}
elseif ($_POST[sendto] > 1){
$remoteinfo = brugerinfo($_POST[sendto]);
if ($remoteinfo[id] > 1 && $remoteinfo[kicktype] == 0){
if ($brugerinfo[status] > 1){
if (substr($text,0,5) == "/kick"){
$text2 = substr($text,5);
Kick($brugerinfo[id],$_POST[sendto],$text2);
header("Location: top.php");
$admin_done = 1;
}
elseif (substr($text,0,4) == "/ban"){
$text2 = substr($text,4);
Ban($brugerinfo[id],$_POST[sendto],$text2);
header("Location: top.php");
$admin_done = 1;
}
elseif (substr($text,0,5) == "/mute"){
$text2 = substr($text,5);
Mute($brugerinfo[id],$_POST[sendto],$text2);
$admin_done = 1;
}
}
if ($admin_done == 0){
if ($text == "help" || $text == "?"){
include("help.php");
}
elseif ($text == "/ignore"){
Ignore($brugerinfo[id],$_POST[sendto]);
}
else {
WriteToRemote($brugerinfo[id],$remoteinfo[id],$text);
}
}
}
else {
WriteToRemote("",$brugerinfo[id],"".Language("58")."!");
}
}
elseif (substr($text,0,9) == "/chatinfo"){
ShowChatInformation($brugerinfo[id]);
header("Location: top.php");
}
elseif (substr($text,0,9) == "/roomname"){
if ($brugerinfo[status] >= 3){
$newroom = substr($text,10);
ChangeRoomName($brugerinfo[id],$brugerinfo[room],$newroom);
}
header("Location: top.php");
}
elseif (substr($text,0,9) == "/subject "){
if ($brugerinfo[status] >= 3){
$emne = substr($text,9);
ChangeRoomEmne($brugerinfo[id],$brugerinfo[room],$emne);
}
header("Location: top.php");
}
elseif (substr($text,0,5) == "/nick"){
$newnick = substr($text,6);
ChangeNick($brugerinfo[id],$newnick);
header("Location: top.php");
}
elseif (substr($text,0,11) == "/textcolor "){
$newcolor = substr($text,11);
ChangeColor($brugerinfo[id],"text_color",$newcolor);
header("Location: top.php");
}
elseif (substr($text,0,11) == "/namecolor "){
$newcolor = substr($text,11);
ChangeColor($brugerinfo[id],"name_color",$newcolor);
header("Location: top.php");
}
elseif (substr($text,0,12) == "/restartchat"){
RestartChat($brugerinfo[id],$brugerinfo[room]);
header("Location: top.php");
}
elseif (substr($text,0,5) == "/mode"){
$newmode = substr($text,6);
Mode($brugerinfo[id],$newmode);
header("Location: top.php");
}
elseif (substr($text,0,6) == "/give "){
$text = substr($text,6);
GiveCredits($brugerinfo[id],$text);
header("Location: top.php");
}
elseif (substr($text,0,4) == "/me "){
$text = substr($text,4);
WriteEmoteToChat($brugerinfo[id],$text);
header("Location: top.php");
}
elseif (substr($text,0,7) == "/think "){
$text = substr($text,7);
WriteEmoteToChat($brugerinfo[id]," . o O ( ".$text." ) ");
header("Location: top.php");
}
else {
WriteToChat($brugerinfo[room],$brugerinfo[nick],$brugerinfo[id],$text);
}
AddChatline($brugerinfo[id],$text);
}
header("Location: top.php");
}
?>
<HTML>
<HEAD>
<link rel="stylesheet" type="text/css" HREF="style.css">
<META HTTP-EQUIV="Refresh" CONTENT="6; URL=top.php">
</HEAD>
<BODY>
<br>
<div CLASS="alm-txt">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr valign="top">
<td> </td>
<td width="700">
<table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolor="#000000" align="right" CLASS="alm-text">
<tr>
<td bgcolor="#84B0DD" bordercolor="#84B0DD">
<div align="center"><b>
<?=RoomNavn($brugerinfo[room]);?>
(<?=RoomEmne($brugerinfo[room]);?>)</b></div>
</td>
</tr>
<?
$res_chat = mysql_query("SELECT * FROM minichat3_txt_".$brugerinfo[id]." order by id DESC");
while ($row_chat = mysql_fetch_array($res_chat)){
// Fejl($brugerinfo[ignore_list].",".$row_chat[fra_id]."");
if (!strstr($brugerinfo[ignore_list], "$row_chat[fra_id],") || $row_chat[fra] == "System"){
if ($row_chat[fra] != "System") {
$row_chat[msg] = ereg_replace($brugerinfo[nick],"<font color='FF9900'><b>$brugerinfo[nick]</b></font>",$row_chat[msg]);
}
?>
<tr>
<td bgcolor="#eeeeee" bordercolor="#eeeeee" onMouseOver="style.backgroundColor='#dddddd';" onMouseOut="style.backgroundColor='#eeeeee';">
<?
if ($row_chat[fra] == "System"){
if ($row_chat[type] == 1){
print "<div CLASS='private'><b>($row_chat[fra] -> $row_chat[til]):</b> $row_chat[msg]</div>\n";
}
else {
print "<div CLASS='system'><b>$row_chat[fra]:</b> $row_chat[msg]</div>\n";
}
}
else {
if ($row_chat[type] == 1){
print "<div CLASS='private'><b>($row_chat[fra] -> $row_chat[til]):</b> $row_chat[msg]</div>\n";
}
elseif ($row_chat[type] == 2){
print "<div CLASS='emote'><i><b>$row_chat[fra] </b> $row_chat[msg]</i></div>\n";
}
else {
print "<div CLASS='normal'><b><font color=".$row_chat[name_color].">$row_chat[fra]:</font></b> <font color=".$row_chat[text_color].">$row_chat[msg]</font></div>\n";
}
}?>
</td>
</tr>
<?
}
}
?>
</table>
</td>
<td width="180">
<table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolor="#000000" CLASS="alm-text">
<tr>
<td bordercolor="#84B0DD" bgcolor="#84B0DD">
<div align="center"><b><?=Language("39");?></b></div>
</td>
</tr>
<? $res_rooms = mysql_query("SELECT * FROM minichat3_rooms order by navn ASC");
while ($row_rooms = mysql_fetch_array($res_rooms)){
$res_tal = mysql_query("SELECT * FROM minichat3_sessions where room='$row_rooms[id]' and kicktype='0'");
$tal = mysql_num_rows($res_tal);?>
<tr bgcolor="#eeeeee" bordercolor="#eeeeee" onMouseOver="style.backgroundColor='#dddddd';" onMouseOut="style.backgroundColor='#eeeeee';" CLASS="normal">
<td><a href="top.php?action=changeroom&newroom=<?=$row_rooms[id];?>"><?=$row_rooms[navn];?> (<?=$tal;?>)</a></td>
</tr>
<? } ?>
</table>
<br>
<? $res_count_vote = mysql_query("SELECT * FROM minichat3_vote_ses where open='1'");
if (mysql_num_rows($res_count_vote)){?>
<form action="vote.php" method="post" target="_self">
<table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolor="#000000" class="alm-text">
<tr>
<td bordercolor="#84B0DD" bgcolor="#84B0DD">
<div align="center"><b><?=Language("120");?></b></div>
</td>
</tr>
<?
$res_vote = mysql_query("SELECT * FROM minichat3_vote_ses where open='1' order by id DESC LIMIT 1");
$row_vote = mysql_fetch_array($res_vote);
?>
<tr bgcolor="#eeeeee" bordercolor="#eeeeee" onMouseOver="style.backgroundColor='#dddddd';" onMouseOut="style.backgroundColor='#eeeeee';" class="normal">
<td>
<?=$row_vote[spm];?>
</td>
</tr>
<?
$res_user_vote = mysql_query("SELECT * FROM minichat3_votes where voteid='$row_vote[id]' and user='$brugerinfo[uid]'");
if (mysql_num_rows($res_user_vote) == 0 && $brugerinfo[status] >= 1){
$i = 1;
while ($i <= 3){
$svar_id = "vote".$i;?>
<tr bgcolor="#eeeeee" bordercolor="#eeeeee" onMouseOver="style.backgroundColor='#dddddd';" onMouseOut="style.backgroundColor='#eeeeee';" class="normal">
<td>
<table width=100% CLASS="normal">
<tr>
<td width="94%">
<?=$row_vote[$svar_id];?>
</td>
<td width="6%">
<input type="radio" name="vote" value="<?=$i;?>">
</td>
<tr>
</table>
</td>
</tr>
<? $i++;}?>
<tr bgcolor="#eeeeee" bordercolor="#eeeeee" onMouseOver="style.backgroundColor='#dddddd';" onMouseOut="style.backgroundColor='#eeeeee';" class="normal">
<td>
<div align="center">
<input type="hidden" name="vote_id" value="<?=$row_vote[id];?>">
<input type="submit" value="<?=Language("121");?>">
</div>
</td>
</tr>
<?
}
else {
$i = 1;
while ($i <= 3){
$svar_id = "vote".$i;
?>
<tr bgcolor="#eeeeee" bordercolor="#eeeeee" onMouseOver="style.backgroundColor='#dddddd';" onMouseOut="style.backgroundColor='#eeeeee';" class="normal">
<td>
<table width=100% CLASS="normal">
<tr>
<td width="94%">
<?=$row_vote[$svar_id];?>
</td>
<td width="6%">
<?=CountVotes($row_vote[id],$i);?>
</td>
<tr>
</table>
</td>
</tr>
<?
$i++;
}
}
?>
</table>
</form>
<? } ?>
</td>
</tr>
</table>
<td bgcolor="#84B0DD" bordercolor="#84B0DD">
<div align="center"><b>©2006 hage-lund</b></div>
</div>
</BODY>