Den kommer her, det er lidt rodet og uoverskueligt, men kode oprydningsfasen, er jeg ikke helt kommet til endnu :-)
Som koden er nu virker chatten fint, den er bare ikke med i mit layout.
jeg går ud fra at det skylde linjen:
if ( !isset($user_name) || $user_name=="" ) Header ( "Location: login.php" );
For hvis jeg flytter den længere ned, til det hvor selve chatten begynder, så kommer chatten med i layoute som den skal, men give fejlen:
Warning: Cannot add header information - headers already sent by (output started at /var/www/html/sektor/system/moduler/chat/chaten.php:88) in /var/www/html/sektor/system/moduler/chat/chaten.php on line 90
<?
include ( "config.php" );
unset( $user_name );
session_start();
if ( !isset($user_name) || $user_name=="" ) Header ( "Location: login.php" );
include ("/var/www/html/sektor/php-lib/commons.php");
include ("$anticache");
include ("$tagster");
include ("$header");
include ("$dbconnect");
include ("$aabendb");
?>
<body bgcolor=\"#dedede\">
<table width="1000" border="0" cellspacing="0" cellpadding="0" bgcolor="#dedede" cool gridx="16" gridy="16" height="310" showgridx showgridy usegridx usegridy>
<tr height="56">
<td width="481" height="609" rowspan="6"><spacer type="block" width="48" height="609"></td>
<td width="656" height="16" colspan="2"><spacer type="block" width="656" height="56"></td>
<td width="501" height="609" rowspan="6"><spacer type="block" width="50" height="609"></td>
<td width="11" height="16"><spacer type="block" width="1" height="16"></td>
</tr>
<tr height="20">
<?
echo "<a href=http://www.danstud.dk><img src=\"
http://www.danstud.dk/sektorcare/grafik/logo.jpg\" border=0></a>";
echo "<td content bgcolor=\"$bgmenu1\" csheight=\"20\"
width=\"656\" height=\"20\" colspan=\"2\" valign=\"top\" align=\"left\" xpos=\"48\">";
//Henter menu nr. 1
echo"<table cellspacing=5>";
echo"<table cellspacing=5>";
//////////////////////////
// Laver menuer
//////////////////////////
<?
include ("$menu1");
include ("$menu2");
//BLOK A
echo " <p class=\"overskrift\"><b><font size=-2> Min side - $row[realname]</font></b>
</p><img src=\"../grafik/tekstspacer.gif\"><br>";
$resultat = mysql_query("select * from user where username='$PHP_AUTH_USER'") or die(mysql_error());
$row = mysql_fetch_array($resultat);
echo"<p class=\"tekst\"><font size=-1>$tekst";
//////////////////////////////////////////////////////////////////////////////////
?>
<table cellpadding=10 cellspacing=0 border=0 width=800 bgcolor=#CCCCCC>
<tr><td width="800"><table cellspacing="0" cellpadding="0" border="0" width="800">
<tr><td><table width=800 border=0 cellpadding=0 cellspacing=0>
<td align="right" valign="top"></td></tr></table>
<table cellpadding=0 cellspacing=0 border=0 width="800">
<tr><td width=50% valign=top><table border=0 cellspacing=0 cellpadding=0>
<tr><td nowrap bgcolor=#4682b4 class="framefocus">
<div class="subtabheaderselected">
Chat
</div></td><td nowrap width="100%"><div class=""> </div></td></tr></table>
<table bgcolor="#395D8C" width="100%" cellpadding=0 cellspacing=0 border=0>
<tr><td></td></tr></table><table width=100% cellpadding=4 cellspacing=0 border=0 bgcolor=#EFEFEF><tr><td width=20 valign=top align=middle><img src="images/tdot.gif" vspace=10 WIDTH=20 HEIGHT=1></td><td colspan=2 width=100% bgcolor=#ffffff><span class="textb">
<?
?>
<!-- ***********************************************************************
OleBole-Chat Version 1.0
(c) Copyright Ole Clausen, 2003
This chat was downloaded from
http://www.eksperten.dk/spm/ The code is free to use if you leave these lines untouched.
If you alter the code, dont erase these lines.
Add a modification-notice instead.
************************************************************************ -->
<style type="text/css">
td {
font-family: verdana, arial, sans-serif;
font-size: 11px;
}
.msgTbl {
width: 100%;
}
td, input, button {
font-family: verdana, arial, sans-serif;
font-size: 11px;
}
input {
width: 100%;
border: 1px dashed #336699;
}
button {
background-color: #dedede;
border: 1px solid #336699;
margin-left: 15px;
}
.u {
width: 100px;
color: #ff0000;
vertical-align: top;
padding: 5px 12px 5px 5px;
border-bottom: 1px dashed #999999;
}
.m {
padding: 5px;
border-bottom: 1px dashed #999999;
}
.time {
color: #336699;
font-size: 9px;
}
.clHidFrame {
position: absolute;
width: 1px;
height: 1px;
left: 0px;
top: 0px;
}
#chat {
width: 450px;
}
</style>
<script type="text/JavaScript">
var maxNumMsgs = <?=$maxNumMsgs?>;
var hiCol = "<?=$hiCol?>";
var loCol = "<?=$loCol?>";
var d=document;
function gE(id){return d.getElementById(id)}
function gA(o,tN){return o.getElementsByTagName(tN)}
function writeChat( a ) {
var tbl = gE("chat");
for (i=0; i<a.length; i+=3) {
var bgCol = ( gA(tbl, "TR")[0].style.backgroundColor=="#ffffff" )? loCol : hiCol;
var newRow = tbl.insertRow(0);
var newCell = newRow.insertCell(0);
newCell.innerHTML = "<b>" + a[i] + "</b><div class=\"time\">[" + a[i+1] + "]</div>";
newCell.className = "u";
var newCell = newRow.insertCell(1);
newCell.innerHTML = a[i+2];
newCell.className = "m";
newRow.style.backgroundColor = bgCol;
}
var numMsgs = gA(tbl, "TR").length;
while ( numMsgs>maxNumMsgs ) {
tbl.deleteRow(numMsgs-1);
numMsgs--;
}
}
window.onunload = function() {
window.open( "logout.php", "logOutWin", "width=100,height=100" );
}
</script>
</head>
<body>
<div style="width:470px">
<div id="bla" style="height:250px;overflow:auto;">
<table id="chat" cellspacing="0" cellpadding="0" border="0">
<tr>
<td colspan="2"> </td>
</tr>
</table>
</div>
<form name="msgForm" target="msgFrame" action="msg.php" method="post">
<table class="msgTbl" cellspacing="0" cellpadding="0" border="0">
<tr>
<td><input type="text" name="msg"></td>
<td style="width:10px;"><button type="submit">Send</button></td>
</tr>
</table>
</form>
</div>
<iframe name="msgFrame" class="clHidFrame" src="msg.php" frameborder="0"></iframe>
<iframe name="chatFrame" class="clHidFrame" src="chat.php" frameborder="0"></iframe>
</table><table bgcolor='#395D8C' width='100%' cellpadding=0 cellspacing=0 border=0><tr><td></td></tr></table></td></tr></table></td></tr></table><tr><td></td></tr></table>
<?
include ("$sidemidt");
include ("$sidemidt2");
include ("$sidemidt3");
?>
<p></p><img src="grafik/blaaspacer.gif" width="220" height="1">
<?
include ("$bund");
include ("$lukdb");
?>
</body>
</html>