Haii, godt nok er svaret gammelt og ubrugeligt nu men her er en færdig scriptet kode til at tælle Timer oG Level .. Har selv en chat .. Det ER EN LANG KODE !!
<?
include("../inc/password.php");
include("inc/header.php");
$select_info = mysql_query("SELECT username,room,rum,status,roomname,roommax,roombgpic FROM users WHERE(id='$id')");
$row_info = mysql_fetch_array($select_info);
if ($action=="ringerpaa") {
$room=addslashes($room);
$select_info2 = mysql_query("SELECT username FROM users WHERE(room='$room')");
$row_info2 =mysql_fetch_array($select_info2);
print "Du ringer nu på hos $row_info2[username].";
}
if ($action=="smidud") {
$uid = addslashes($uid);
$select_info2 = mysql_query("SELECT rum,status,username FROM users WHERE(id='$uid')");
$row_info2 = mysql_fetch_array($select_info2);
if ($row_info[room] != $row_info2[rum] && $row_info[status]=="3") {
print "Du kan nok kun smide folk ud der er i din egen lejligheder skal du se.";
}
elseif ($row_info2[status] > 3) {
print "Du kan ikke smide admins ud.";
} else {
print "$row_info2[username] blev kicket ud.";
$select_chatten = mysql_query("SELECT id FROM users WHERE(username='Chatten')");
$row_chatten = mysql_fetch_array($select_chatten);
$time = time();
mysql_query("INSERT INTO chat (rum,text,time,f,t) VALUES('$row_info[rum]','$row_info[username] smed $row_info2[username] ud af rummet $row_info[rum].','$time','$row_chatten[id]','0')");
mysql_query("UPDATE users SET botmes='$row_info[username] smed dig ud af rummet $row_info[rum].<Script>\n parent.bot.location=\"bot.php?action=changeroom&rum=1&smidud=true\";\n </Script>' WHERE (id='$uid')");
}
}
if($action=="indret") {
if ($row_info[rum] != $row_info[room]) {
print "Du skal nok lige ind i din lejligheder for at indrette den.";
include("inc/footer.php");
exit;
}
$x=addslashes($x);
$y=addslashes($y);
$status=addslashes($status);
$roomname=addslashes($roomname);
$roommax=addslashes($roommax);
$roombg=addslashes($roombg);
$roomname = htmlspecialchars($roomname);
$roomname = str_replace("\\\'","'",$roomname);
print "<center><font size=\"4\">Indret Suite</font><br>";
print "<table cellspacing=\"0\" cellpadding=\"0\"><div style=\"position:absolute;z-index:-1\"><img src=\"../gfx/rum/$row_info[roombgpic]\" width=\"214\" height=\"180\"></div><tr>";
$i=0;
$y2=-70;
$x2=0;
while ($i < 35) {
if ($i%7==0) {
$y2=$y2+70;
$x2=0;
print "</tr><tr>";
}
$i++;
print "<td><a href=\"info.php?action=indret&x=$x2&y=$y2&felt=$i\"><img src=\"../gfx/spacer.gif\" width=\"30\" height=\"35\""; if ($felt!=$i) { print " border=\"0\""; } print "></a></td>";
$x2+=60;
}
print "</tr></table>";
if($x!="" && $y!="") {
if ($save=="true") {
if ($status=="url") {
if ($row_info[status]==0 && $row_info[room]>99) {
print "Intet Har du snydt, eller lugter du bare af lort.. Kun admins må lave URL's";
include("inc/footer.php");
exit;
}
}
if ($status=="normal") {
mysql_query("DELETE FROM felter WHERE(rum='$row_info[room]' && x='$x' && y='$y')");
} else {
if (mysql_num_rows(mysql_query("SELECT x FROM felter WHERE(rum='$row_info[room]' && x='$x' && y='$y')"))=="0") {
mysql_query("INSERT INTO felter (rum,x,y,status,value) VALUES('$row_info[room]','$x','$y','$status','$value')");
} else {
mysql_query("UPDATE felter SET status='$status',value='$value' WHERE(rum='$row_info[room]' && x='$x' && y='$y')");
}
}
print "<font size=\"1\">Gemt.</font>";
}
$select_felt = mysql_query("SELECT status,value FROM felter WHERE(rum='$row_info[room]' && x='$x' && y='$y')");
$row_felt = mysql_fetch_array($select_felt);
print "<form>Felt $felt<br>
<select name=\"nyk\" onchange=\"changefelt(this.form.elements[0])\">
<option value=\"info.php?felt=$felt&action=indret&status=locked&save=true&x=$x&y=$y\""; if ($row_felt[status]=="locked") { print " selected"; } print ">Låst</option>
<option value=\"info.php?felt=$felt&action=indret&status=normal&save=true&x=$x&y=$y\""; if (mysql_num_rows($select_felt)==0) { print " selected"; } print ">Normal</option>
";
if ($row_info[status]>3 || $row_info[room]<101) {
print "
<option value=\"info.php?felt=$felt&action=indret&status=url&save=true&x=$x&y=$y\"";
if ($row_felt[status]=="url") { print " selected"; } print ">URL</option>
";
}
print "
</select>";
if ($row_felt[status]=="url") {
print "</form>
<form action=\"info.php?action=indret&x=$x&y=$y&status=url&save=true&felt=$felt\">
<input type=\"hidden\" name=\"action\" value=\"indret\">
<input type=\"hidden\" name=\"x\" value=\"$x\">
<input type=\"hidden\" name=\"y\" value=\"$y\">
<input type=\"hidden\" name=\"status\" value=\"url\">
<input type=\"hidden\" name=\"save\" value=\"true\">
<input type=\"hidden\" name=\"felt\" value=\"$felt\">
URL: <input type=\"text\" name=\"value\" value=\"$row_felt[value]\"><br>
<input type=\"submit\" value=\"Gem\" class=\"submit\">";
}
print "</form>";
}
if ($roomname && $roommax && $roombg) {
mysql_query("UPDATE users SET roomname='$roomname',roommax='$roommax',roombg='$roombg' WHERE(id='$id')");
print "
<Script>
parent.chat.location='chat.php?framecheck=true';
parent.besked.location='besked.php';
parent.beskeder.document.bgColor='#A0BEBF'
</Script>
";
}
$select_roominfo = mysql_query("SELECT roomname,roommax,roombg FROM users WHERE(id='$id')");
$row_roominfo = mysql_fetch_array($select_roominfo);
print "
<font size=\"1\">
<form action=\"info.php\">
<input type=\"hidden\" name=\"action\" value=\"indret\">
<input type=\"hidden\" name=\"roombg\" value=\"000000\">
Suite Navn : <input type=\"text\" name=\"roomname\" maxlength=\"15\" value=\"$row_roominfo[roomname]\" class=\"text\"><br>
Max antal i din lejlighed : <input type=\"text\" name=\"roommax\" maxlength=\"2\" value=\"$row_roominfo[roommax]\" class=\"text\"><br>
<input type=\"submit\" value=\"Gem\" class=\"submit\">
</form>
Bemærk:<br>Nogen gange kan det være du skal trykke F5 før det virker.
";
}
if($action=="options") {
print "
<center>
<font size=\"4\">Instillinger</font>
<form name=\"options\" action=\"java script:showinfo(1)\">
<input type=\"submit\" name=\"showinfo\" class=\"submit\">
</form>
<input type=\"button\" onclick=\"parent.beskeder.document.body.innerHTML = '<font color=#000000 face=verdana size=1>Chatvinduet er tømt.<br>'\" class=\"submit\" value=\"Tøm Textbox\">";
if ($row_info[room]!=0) {
print "
<form action=\"info.php\">
<input type=\"hidden\" name=\"action\" value=\"indret\">
<input type=\"submit\" class=\"submit\" value=\"Indret Lejlighed\">
</form>
";
}
print "
<Script>
showinfo(0)
</Script>
";
}
if ($action=="changeroom") {
$select_rooms = mysql_query("SELECT room,roomname,roommax FROM users WHERE(room !=0 && onlinechat!=0) ORDER BY room");
print mysql_error();
while($row_rooms = mysql_fetch_array($select_rooms)) {
$select_visitors = mysql_query("SELECT id FROM users WHERE(rum='$row_rooms[room]')");
$you="";
if ($row_rooms[room] == $row_info[rum]) {
$you = "<font size=\"1\"><b></b></font>";
}
if ($row_rooms[room] < 100) {
$normalrooms .= "
<tr>
<td>[<b>$row_rooms[room]</b>]</td>
<td>
<font size=\"1\"><a href=\"java script:changeroom($row_rooms[room])\">$row_rooms[roomname]</a>
</td>
<td> <font size=\"1\">(".mysql_num_rows($select_visitors)."/$row_rooms[roommax])
</td>
<td>
</td><td> $you
</td>
</tr>";
} else {
$privaterooms .= "
<tr>
<td><font size=\"1\">[<b>$row_rooms[room]</b>]</td>
<td><font size=\"1\">
<a target=\"bot\""; if ($row_rooms[room]!=$row_info[room]) { $privaterooms .= " onclick=\"document.location='info.php?action=ringerpaa&room=$row_rooms[room]'\""; } $privaterooms .= " href=\"bot.php?action=changeroom&rum=$row_rooms[room]\">$row_rooms[roomname]</a>
</td>
<td> <font size=\"1\">(".mysql_num_rows($select_visitors)."/$row_rooms[roommax])
</td>
<td>
</td><td> $you
</td>
</tr>";
}
}
print "<table height=\"18\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">$normalrooms</table><br><br><table height=\"18\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">$privaterooms</table>";
}
if ($action=="showuser") {
$uid = addslashes($uid);
$select_info = mysql_query("SELECT username,room,alder,onlinetid,spir,sex,rum,onlinechat,roomvisits,oprettet FROM users WHERE(id='$uid')");
$row_info = mysql_fetch_array($select_info);
$result_info2 = mysql_query("SELECT rum,room,status,roomvisits,oprettet FROM users WHERE(id='$id')");
$row_info2 = mysql_fetch_array($result_info2);
$sex = ucwords($row_info[sex]);
$online = "<br><br>$sex er ikke længere online på chatten.";
if ($row_info[onlinechat] != "0")
{
$temphour = $row_info[onlinetid]/60/60;
$hour = floor($temphour);
$tempmin = $row_info[onlinetid]/60;
$min = $tempmin-$hour*60;
$min = floor($min);
$now = time();
$min2 = $now-$row_info[onlinechat];
$min2 = $min2/60;
$min2 = floor($min2);
//// HER UNDER KAN DU SE LEVEL SYSTEMET, VED IKK OM DET PASSER, MEN RET DET SELV HVIS DET ER ... !!! SLET DENNE LINIE NÅR DU SKAL BRUGE SCRIPTET ...
function level($onlinechat) {
if ($onlinechat < 1) {$level = 1; }
elseif ($onlinechat < 4) { $level = 2; }
elseif ($onlinechat < 5) { $level = 3; }
elseif ($onlinechat < 10) { $level = 4; }
elseif ($onlinechat < 12) { $level = 5; }
elseif ($onlinechat < 15) { $level = 6; }
elseif ($onlinechat < 20) { $level = 7; }
elseif ($onlinechat < 35) { $level = 8; }
elseif ($onlinechat < 50) { $level = 9; }
elseif ($onlinechat < 75) { $level = 10; }
elseif ($onlinechat < 100) { $level = 11; }
elseif ($onlinechat < 125) { $level = 12; }
elseif ($onlinechat < 150) { $level = 13; }
elseif ($onlinechat < 200) { $level = 14; }
elseif ($onlinechat < 250) { $level = 15; }
elseif ($onlinechat < 350) { $level = 16; }
elseif ($onlinechat < 500) { $level = 17; }
elseif ($onlinechat < 700) { $level = 18; }
elseif ($onlinechat < 1000) { $level = 19; }
elseif ($onlinechat < 1500) { $level = 20; }
return $level;
}
$online = "";
}
echo "<BR>";
echo "<BR>";
print "<b><u><font size=\"1\"><h3> $row_info[username] </h3></u></b>
<br><b>CCK: </b>".floor($row_info[spir])."<br><b>Online tid:</b> $hour</b> timer og $min min.<br><b>Loggede på chatten:</b> $min2 min. siden<br><b>Level: </b> ".level($hour)."";
$select_info2 = mysql_query("SELECT sum(spir) AS spirialt FROM users");
$row_info2 = mysql_fetch_array($select_info2);
$procent = $row_info[spir]/$row_info2[spirialt]*100;
$hour = floor($row_info[onlinetid]/60/60);
$tempmin = $row_info[onlinetid]/60;
$min = floor($tempmin-$hour*60);
if($row_info[oprettet]!=0) {
$oprettet = date("d",$row_info[oprettet])."/".date("m",$row_info[oprettet])."-'".date("y",$row_info[oprettet])." [".date("H",$row_info[oprettet]).":".date("i",$row_info[oprettet])."]";
} else {
$oprettet = "N/A";
}
print "
<br>Der er ialt <b>".floor($row_info2[spirialt])."</b>, hvor af du ejer <b>".substr($procent,0,5)."</b> %.<br>
Du blev oprettet: <b>$oprettet</b>.<br>
";
if ($row_info[room] != "0") {
print "<br><b>$row_info[roomvisits]</b> har besøgt dit room.<br>";
print "<font size=\"1\"><br><b>Lej: </b>$row_info[room] <a href=\"bot.php?action=changeroom&rum=$row_info[room]\" target=\"bot\"> (Gå dertil)";
}
if ($row_info2[room2] != $row_info[room] && $row_info[room] != 0) {
print "<font size=\"1\"><br><br><a href=\"bot.php?action=changeroom&rum=$row_info[room]\" target=\"bot\"><b>$room_info[room]</b></a><BR>";
}
if ($row_info[rum] == $row_info2[room] || $row_info2[status] > 0) {
if ($uid != $id) {
print "<br><font size=\"1\"><a href=\"info.php?action=smidud&uid=$uid\">Kick</a>";
}
}
include("seprofil.php");
print "$online<br><br><left>";
$result_ting = mysql_query("SELECT id,tingname,figur FROM ting WHERE(owner='$uid')");
if (mysql_num_rows($result_ting) != 0)
{
while($row_ting = mysql_fetch_array($result_ting)) {
print "<font size=\"1\"><b><h4><u>$row_ting[tingname]</u></h4></b><font size=\"1\"><a href=\"info.php?action=showthing&tid=$row_ting[id]\"><img src=\"../gfx/ting/$row_ting[figur]\" border=\"0\"><br><img src=\"../gfx/spacer.gif\" border=\"0\"></a><br><font size=\"1\"><b></b><font size=\"1\"><br>";
$i++;
}
print "";
}
if($i==0)
{
print "<font size=\"1\">Ingen ting..";
}
}
if ($action=="pickupthing") {
$tid = addslashes($tid);
$pickupting = addslashes($pickupthing);
$select_ting_info = mysql_query("SELECT tingname,value,rum,owner,x,y FROM ting WHERE(id='$tid')");
$row_ting_info = mysql_fetch_array($select_ting_info);
$select_user_info = mysql_query("SELECT rum,x,y,status,room,spir FROM users WHERE(id='$id')");
$row_user_info = mysql_fetch_array($select_user_info);
$select_room_info = mysql_query("SELECT roomstatus FROM users WHERE(room='$row_ting_info[rum]')");
$row_room_info = mysql_fetch_array($select_room_info);
if ($row_user_info[rum] != $row_ting_info[rum] || $row_user_info[y] != $row_ting_info[y] || $row_user_info[x] != $row_ting_info[x]) {
print "<font size=\"1\">Du står ikke på tingen!";
}
elseif ($row_user_info[room] != $row_user_info[rum] && $row_user_info[rum] > 99) {
print "<font size=\"1\">Du kan ikke samle op i en andens room!";
}
elseif ($row_room_info[roomstatus]=="1" && $row_ting_info[value] > $row_user_info[spir]) {
print "<font size=\"1\">Du har ikke Coinz nok. $row_ting_info[tingname] koster altså <b>$row_ting_info[value]</b> coinz. Og Du har altså kun <b>".floor($row_user_info[spir])."</b> coinz. Du mangler ca. <b>".floor($row_ting_info[value]-$row_user_info[spir])."</b> Coinz.";
}
else {
if ($row_room_info[roomstatus]=="1") {
mysql_query("UPDATE users SET spir=spir-$row_ting_info[value] WHERE(id='$id')");
$ext = " <font size=\"1\">Du har nu <b>".floor($row_user_info[spir]-$row_ting_info[value])."</b> coinz.";
}
if(ereg("And",$row_ting_info[tingname])) {
mysql_query("UPDATE users SET fisk=fisk+1 WHERE(id='$id')");
$select_info2 = mysql_query("SELECT fisk FROM users WHERE(id='$id')") or die("FEJL");
$row_info2 = mysql_fetch_array($select_info2);
mysql_query("UPDATE ting SET rum='0',owner='-1',x='',y='',tingname='Chilliplante',value='2',figur='chilliplante.gif' WHERE(id='$tid')");
print "<font size=\"1\">Du har nu <b>$row_info2[fisk]</b> ænder.";
} else {
mysql_query("UPDATE ting SET rum='0',owner='$id',x='',y='' WHERE(id='$tid')");
print "<font size=\"1\">Du fik $row_ting_info[tingname].$ext
<Script>
parent.bot.location='bot.php';
</Script>
";
}
}
}
if ($action=="dropthing") {
$tid = addslashes($tid);
$pickupting = addslashes($dropthing);
$select_ting_info = mysql_query("SELECT tingname,owner,value FROM ting WHERE(id='$tid')");
$row_ting_info = mysql_fetch_array($select_ting_info);
$select_user_info = mysql_query("SELECT rum,x,y,id,spir FROM users WHERE(id='$id')");
$row_user_info = mysql_fetch_array($select_user_info);
$select_room_info = mysql_query("SELECT roomstatus FROM users WHERE(room='$row_user_info[rum]')");
$row_room_info = mysql_fetch_array($select_room_info);
if ($row_ting_info[owner] != "$id") {
print "<font size=\"1\">Du ejer ikke denne ting, og kan derfor ikke smide den.";
} else {
if ($row_room_info[roomstatus] == "1") {
$ext = " <font size=\"1\">Du har nu <b>".floor($row_user_info[spir]+$row_ting_info[value])."</b> Coinz.";
mysql_query("UPDATE users SET spir=spir+$row_ting_info[value] WHERE(id='$id')");
}
mysql_query("UPDATE ting SET owner='0',rum='$row_user_info[rum]',x='$row_user_info[x]',y='$row_user_info[y]' WHERE(id='$tid')");
print "<font size=\"1\">$row_ting_info[tingname] blev smidt.$ext<br>
<Script>
parent.bot.location='bot.php';
</Script>
";
}
}
if ($action=="showthing") {
$tid = addslashes($tid);
$visting = addslashes($visting);
$select_ting_info = mysql_query("SELECT tingname,value,rum,owner FROM ting WHERE(id='$tid')");
$row_ting_info = mysql_fetch_array($select_ting_info);
if ($row_ting_info[owner] != "0") {
$owner = $row_ting_info[owner];
} else {
if ($row_ting_info[rum] < 100) {
$owner = "Ingen";
} else {
$select_owner_info = mysql_query("SELECT id FROM users WHERE(room='$row_ting_info[rum]')");
$row_owner_info = mysql_fetch_array($select_owner_info);
$owner = $row_owner_info[id];
}
}
if ($owner == "$id" && $row_ting_info[rum] == "0") {
$youraction = "<a href=\"info.php?action=dropthing&tid=$tid\">Smid $row_ting_info[tingname]</a>";
} else {
if ($row_ting_info[rum] < 100 || $row_info[room] == $row_ting_info[rum]) {
$youraction = "<a href=\"info.php?action=pickupthing&tid=$tid\">Samle Op</a>";
}
}
if ($owner != "Ingen") {
$select_owner_info = mysql_query("SELECT username FROM users WHERE(id='$owner')");
$row_owner_info = mysql_fetch_array($select_owner_info);
$owner = $row_owner_info[username];
}
print "<br>
<b>Ting Navn :</b> $row_ting_info[tingname]<br>
<b>Ting Værdi :</b> $row_ting_info[value]<br>
<b>Ting ID :</b> $tid<br>
<br>
$youraction";
}
include("inc/footer.php");
?>
<link rel="stylesheet" HREF="
http://www.nss.frac.dk/style.css" type="text/css">
<meta name="generator" content="Namo WebEditor v5.0(Trial)">
<p> </p>
Din IP er: <b>
<?
echo "$REMOTE_ADDR";
?>
</b>
Håber du da kan bruge det hvis ik de er for sent ...