chat.php
<?php
session_start();
mysql_connect("localhost", "deplox_dk", "olli567") or die(mysql_error());
mysql_select_db("deplox_dk") or die(mysql_error());
if(isset($_SESSION['cusername']))
{
if(isset($_GET['felt']))
{
mysql_query("UPDATE chat_users SET felt='{$_GET['felt']}' WHERE username='{$_SESSION['cusername']}'");
}
// LOGIN ^^
?>
<script type="text/javascript" src="
http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> <!-- jQuery library -->
<script>
jQuery(document).ready(function(){ajax_update();});
</script>
<script type="text/javascript">
function ajax_update() {
$.post("iframe.php", function(data){ // fil der skal vises i div
$("#DIVBOKSEN").html(data); // div boksen
setTimeout(ajax_update, 100); // opdateres hvert halve sekund.
});
}
</script>
<style type="text/css">
A:link {text-decoration: none; color: black;}
A:visited {text-decoration: none; color: black;}
A:active {text-decoration: none; color: black;}
A:hover {text-decoration: none; color black;}
</style>
<body leftmargin="0" topmargin="0">
<form method="POST">
<div id="DIVBOKSEN"></div>
<a href="chat.php?felt=1"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=2"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=3"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=4"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=5"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=5x1"><img src="room_1_bg.jpg"
></a><br><a href="chat.php?felt=6"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=7"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=8"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=9"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=10"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=10x1"><img src="room_1_bg.jpg"></a><br>
<a href="chat.php?felt=11"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=12"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=13"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=14"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=15"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=15x1"><img src="room_1_bg.jpg"
></a><br><a href="chat.php?felt=16"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=17"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=18"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=19"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=20"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=20x1"><img src="room_1_bg.jpg"
></a><br><a href="chat.php?felt=21"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=22"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=23"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=24"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=25"><img src="room_1_bg.jpg"
></a><a href="chat.php?felt=25x1"><img src="room_1_bg.jpg"
></a>
<?php
echo "<br>{$_GET['felt']} || {$_SESSION['cusername']} -|- <b><a href=\"login.php?logout=YEAH\">Log Ud</a></b>";
?>
</form>
</body>
<?php
}
else
{
header('Location: login.php');
}
?>
iframe.php
<?php
session_start();
mysql_connect("localhost", "deplox_dk", "olli567") or die(mysql_error());
mysql_select_db("deplox_dk") or die(mysql_error());
// LOGIN ^^
$hey = mysql_query("SELECT * FROM chat_room_1");
while($row = mysql_fetch_array($hey))
{
$hey2 = mysql_query("SELECT felt FROM chat_users WHERE username='{$row['online_users']}'");
while($rowe = mysql_fetch_array($hey2))
{
if($rowe['felt'] == "1"){$l = "0"; $r = "0";}
elseif($rowe['felt'] == "2"){$l = "0"; $r = 56+2;}
elseif($rowe['felt'] == "3"){$l = "0"; $r = 56+56+5;}
elseif($rowe['felt'] == "4"){$l = "0"; $r = 56+56+56+10;}
elseif($rowe['felt'] == "5"){$l = "0"; $r = 56+56+56+56+14;}
elseif($rowe['felt'] == "5x1"){$l = "0"; $r = 56+56+56+56+56+16;}
elseif($rowe['felt'] == "6"){$l = 73+3; $r = "0";}
elseif($rowe['felt'] == "7"){$l = 73+3; $r = 56+2;}
elseif($rowe['felt'] == "8"){$l = 73+3; $r = 56+56+5;}
elseif($rowe['felt'] == "9"){$l = 73+3; $r = 56+56+56+10;}
elseif($rowe['felt'] == "10"){$l = 73+3; $r = 56+56+56+56+14;}
elseif($rowe['felt'] == "10x1"){$l = 73+3; $r = 56+56+56+56+56+16;}
elseif($rowe['felt'] == "11"){$l = 73+73+4; $r = "0";}
elseif($rowe['felt'] == "12"){$l = 73+73+4; $r = 56+2;}
elseif($rowe['felt'] == "13"){$l = 73+73+4; $r = 56+56+5;}
elseif($rowe['felt'] == "14"){$l = 73+73+4; $r = 56+56+56+10;}
elseif($rowe['felt'] == "15"){$l = 73+73+4; $r = 56+56+56+56+14;}
elseif($rowe['felt'] == "15x1"){$l = 73+73+4; $r = 56+56+56+56+56+16;}
elseif($rowe['felt'] == "16"){$l = 73+73+73+6; $r = "0";}
elseif($rowe['felt'] == "17"){$l = 73+73+73+6; $r = 56+2;}
elseif($rowe['felt'] == "18"){$l = 73+73+73+6; $r = 56+56+5;}
elseif($rowe['felt'] == "19"){$l = 73+73+73+6; $r = 56+56+56+10;}
elseif($rowe['felt'] == "20"){$l = 73+73+73+6; $r = 56+56+56+56+14;}
elseif($rowe['felt'] == "20x1"){$l = 73+73+73+6; $r = 56+56+56+56+56+16;}
elseif($rowe['felt'] == "21"){$l = 73+73+73+73+10; $r = "0";}
elseif($rowe['felt'] == "22"){$l = 73+73+73+73+10; $r = 56+2;}
elseif($rowe['felt'] == "23"){$l = 73+73+73+73+10; $r = 56+56+5;}
elseif($rowe['felt'] == "24"){$l = 73+73+73+73+10; $r = 56+56+56+10;}
elseif($rowe['felt'] == "25"){$l = 73+73+73+73+10; $r = 56+56+56+56+14;}
elseif($rowe['felt'] == "25x1"){$l = 73+73+73+73+10; $r = 56+56+56+56+56+16;}
echo "<div style=\"position: absolute; top: {$l}; left: {$r};\"><img src=\"figur.png\"></div>";
}
}
?>