Hjælp til et chat rykkesystem
Hej er ved at lave et rykkesystem til en chat :<?PHP
include "connect.php";
include "funcs.php";
session_start ();
$resultatu = mysql_query("SELECT * FROM users WHERE username = '$_SESSION[username]'") or die(mysql_error());
$user_info = mysql_fetch_array($resultatu);
$resultatr = mysql_query("SELECT * FROM rooms WHERE id = '$user_info[room]'") or die(mysql_error());
$room_info = mysql_fetch_array($resultatr);
function move(){
$f = $_GET[f];
if($f) {
$g_total = mysql_query("select count(id) as total from users where field = '$f' and room = '$user_info[room]'") or die(mysql_error());
$total = mysql_result($g_total,0);
if($total == 0){
$result = mysql_query("UPDATE users SET field='$f' WHERE username='$_SESSION[username]'") or die(mysql_error());
} else {
echo "<script>alert('Velkommen');</script>";
}
}
}
if($user_info[field] == "0") {
echo "<div style='position: absolute; width: 70px; height: 10px; z-index: 1; background-color: #FFFFFF;'>
<center>$lang[0031]</center></div>";
}
echo "BETA";
?>
<?php
echo "
<table border='1' width='600' height='400' style='z-index:1; background-image:url('images/indgangen.png');'>
";
?>
<tr>
<?php $field = "1"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_1" <?php if(!$field[username]){echo "onclick='MoveField(1)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "2"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_2" <?php if(!$field[username]){echo "onclick='MoveField(2)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "3"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_3" <?php if(!$field[username]){echo "onclick='MoveField(3)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "4"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_4" <?php if(!$field[username]){echo "onclick='MoveField(4)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "5"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_5" <?php if(!$field[username]){echo "onclick='MoveField(5)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "6"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_6" <?php if(!$field[username]){echo "onclick='MoveField(6)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "7"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_7" <?php if(!$field[username]){echo "onclick='MoveField(7)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "8"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_8" <?php if(!$field[username]){echo "onclick='MoveField(8)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
</tr>
<tr>
<?php $field = "9"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_9" <?php if(!$field[username]){echo "onclick='MoveField(9)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "10"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_10" <?php if(!$field[username]){echo "onclick='MoveField(10)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "11"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_11" <?php if(!$field[username]){echo "onclick='MoveField(11)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "12"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_12" <?php if(!$field[username]){echo "onclick='MoveField(12)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "13"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_13" <?php if(!$field[username]){echo "onclick='MoveField(13)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "14"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_14" <?php if(!$field[username]){echo "onclick='MoveField(14)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "15"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_15" <?php if(!$field[username]){echo "onclick='MoveField(15)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "16"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_16" <?php if(!$field[username]){echo "onclick='MoveField(16)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
</tr>
<tr>
<?php $field = "17"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_17" <?php if(!$field[username]){echo "onclick='MoveField(17)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "18"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_18" <?php if(!$field[username]){echo "onclick='MoveField(18)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "19"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_19" <?php if(!$field[username]){echo "onclick='MoveField(19)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "20"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_20" <?php if(!$field[username]){echo "onclick='MoveField(20)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "21"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_21" <?php if(!$field[username]){echo "onclick='MoveField(21)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "22"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_22" <?php if(!$field[username]){echo "onclick='MoveField(22)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "23"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_23" <?php if(!$field[username]){echo "onclick='MoveField(23)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "24"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_24" <?php if(!$field[username]){echo "onclick='MoveField(24)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
</tr>
<tr>
<?php $field = "25"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_25" <?php if(!$field[username]){echo "onclick='MoveField(25)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "26"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_26" <?php if(!$field[username]){echo "onclick='MoveField(26)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "27"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_27" <?php if(!$field[username]){echo "onclick='MoveField(27)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "28"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_28" <?php if(!$field[username]){echo "onclick='MoveField(28)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "29"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_29" <?php if(!$field[username]){echo "onclick='MoveField(29)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "30"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_30" <?php if(!$field[username]){echo "onclick='MoveField(30)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "31"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_31" <?php if(!$field[username]){echo "onclick='MoveField(31)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
<?php $field = "32"; $result = mysql_query("SELECT * FROM users where field = '$field' and room = '$user_info[room]'") or die(mysql_error()); $field = mysql_fetch_array($result);?>
<td width="68" height="98" id="field_32" <?php if(!$field[username]){echo "onclick='MoveField(32)'";}?>><?php if($field[username]){ echo ShowUser($field[id],$field[avatar]); }else{ echo " "; }?></td>
</tr>
</table>
<script type="text/javascript">
document.ondragstart=new Function("return false;");
document.onmousemove=new Function("window.status='';");
if(window.self.location.href.indexOf("http://")==-1) window.location="";
function MoveField(num) {
if(num >= 0) {
move();
} else {
alert("STOP");
Refresh();
}
}
function Refresh() {
location.href = "move_system.php";
}
setTimeout("Refresh();",100000);
</script>
Kan man på en eller anden måde lave så hele vinduet ikke blinker når man rykker ?
