Hvad er der galt ???
jeg kan ikke lige finde ne fjel her i !!! http://131.164.185.232/chat/index.php men jeg kan iokek oprette og login med på min maskine!! ved ikke hvad fejel er men i kan lige få coderen =)<?
require("./config.php");
mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($database);
$ip = $_SERVER[REMOTE_ADDR];
CheckBan($ip);
CheckSession("System");
function Language($id){
$res_setup = mysql_query("SELECT * FROM minichat3_setup where thing='language'") or die (mysql_error());
$row_setup = mysql_fetch_array($res_setup);
if ($row_setup[value] == "dk"){
require("language.dk.inc");
return $language[$id];
}
elseif ($row_setup[value] == "eng"){
require("language.eng.inc");
return $language[$id];
}
}
function CheckBan($ip){
$res = mysql_query("select * from minichat3_banlist where ip='$ip'");
if (mysql_num_rows($res) > 0){
include("banned.php");
exit;
}
}
function Fejl($msg){
print "<script>window.alert(\"".$msg."\"); history.go(-1);</script>";
exit;
}
function Fejl2($msg){
print "<script>window.alert(\"".$msg."\");</script>";
}
function CountVotes($voteid,$vote){
$res_votes = mysql_query("SELECT * FROM minichat3_votes where voteid='$voteid' and vote='$vote'") or die (mysql_error());
$antal = mysql_num_rows($res_votes);
return $antal;
}
function MakeID($nick){
$id = strlen($nick) * time();
return $id;
}
function MakeSESID($nick){
$sesid = strlen($nick) * time() + time();
$sesid = md5($sesid);
return $sesid;
}
function AddChatline($id,$text){
if (strlen($text) > 20){
mysql_query("update minichat3_sessions set chatlines=chatlines+1 where id='$id'");
}
}
function GetUsers($type){
$Normal = "<select name=user>\n";
if ($type == "all"){
$res_getusers = mysql_query("SELECT * FROM minichat3 order by nick ASC") or die (mysql_error());
while ($row_getusers = mysql_fetch_array($res_getusers)){
$back .= "<option value=".$row_getusers[id].">".$row_getusers[nick]."</option>\n";
}
}
elseif ($type == "online"){
$res_getusers = mysql_query("SELECT * FROM minichat3_sessions order by nick ASC") or die (mysql_error());
while ($row_getusers = mysql_fetch_array($res_getusers)){
$back .= "<option value=".$row_getusers[id].">".$row_getusers[nick]."</option>\n";
}
}
else {
Fejl("You´ve made a mistake!");
}
$back .= "</select>";
return $back;
}
function GetBannedUsers(){
$back = "<select name=user>\n";
$res_getusers = mysql_query("SELECT * FROM minichat3_banlist order by nick ASC") or die (mysql_error());
while ($row_getusers = mysql_fetch_array($res_getusers)){
$back .= "<option value=".$row_getusers[id].">".$row_getusers[nick]."(".$row_getusers[ip].")</option>\n";
}
$back .= "</select>";
return $back;
}
function ChangeRoomName($id,$room,$newroom){
$brugerinfo = brugerinfo($id);
$room = format($room);
$newroom = format($newroom);
$roomname = RoomNavn($room);
$newroom = substr($newroom,0,25);
mysql_query("UPDATE minichat3_rooms SET navn='$newroom' where id='$room'");
WriteToChat($room,"System","","<b>".$brugerinfo[nick]."</b> ".Language("1")." <b>".$newroom."</b>");
}
function CheckNick($str,$thing){
if (strlen($str) < 3) { Fejl("Your ".$thing." MUST contain at least 3 letters");}
if (strlen($str) > 20) { Fejl("Your ".$thing." MUST contain less than 20 letters");}
return $str;
}
function format($str) {
if (strlen($str) > 512) { $str = substr($str,0,512); }
$str = stripslashes($str);
$str = htmlspecialchars($str);
$str = ereg_replace("'","´",$str);
$str = ereg_replace("(([Ff]|[Hh][Tt]){1}[Tt][Pp]://[a-zA-Z0-9@:%_.~#-\?&]+)", "<a href=\"\\1\" target=_blank CLASS=\"link-i-toppen\">\\1</a>", $str);
$str = ereg_replace("([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)","<a href=\"mailto:\\1\">\\1</a>",$str);
$str = ereg_replace("\__([^\|]+)\__","<b> \\1 </b>",$str);
$str = ereg_replace("\_([^\|]+)\_","<i> \\1 </i>",$str);
$str = ereg_replace("\___([^\|]+)\___","<strong> \\1 </strong>",$str);
return $str;
}
function br2nl($str){
$str = ereg_replace("<br />","",$str);
$str = ereg_replace("<br />","",$str);
return $str;
}
function Mode($id,$mode){
$brugerinfo = brugerinfo($id);
if ($brugerinfo[mode] == $mode){
WriteToRemote("",$brugerinfo[id],"".Language("16")."");
}
else {
$mode = format($mode);
if ($mode == "back" || $mode == "brb"){
mysql_query("UPDATE minichat3_sessions SET mode='$mode' where id='$brugerinfo[id]'");
WriteToChat($brugerinfo[room],"System","","<b>".$brugerinfo[nick]."</b> ".Language("2")." <b>".$mode."</b>");
}
else {
WriteToRemote("",$brugerinfo[id],"".Language("17")."");
}
}
}
function Mute($id,$sendto,$text){
if ($text == "" || $text == " "){ $text = "Ingen grund givet";}
$brugerinfo = brugerinfo($id);
$remote = brugerinfo($sendto);
if ($brugerinfo[status] > $remote[status]){
if ($remote[mute] == 1){
mysql_query("UPDATE minichat3_sessions SET mute='0' where id='$remote[id]'");
WriteToChat($brugerinfo[room],"System","","<b>".$remote[nick]."</b> ".Language("3")." <b>".$brugerinfo[nick]."</b> [ ".$text." ]");
}
else {
mysql_query("UPDATE minichat3_sessions SET mute='1' where id='$remote[id]'");
WriteToChat($brugerinfo[room],"System","","<b>".$remote[nick]."</b> ".Language("4")." <b>".$brugerinfo[nick]."</b> [ ".$text." ]");
}
}
elseif ($brugerinfo[status] == $remote[status]){
WriteToRemote("",$brugerinfo[id],"".Language("18")."!");
WriteToRemote("",$remote[id],"<b>".$brugerinfo[nick]." ".Language("19")."!");
}
else {
WriteToRemote("",$brugerinfo[id],"".Language("20")."!");
WriteToRemote("",$remote[id],"<b>".$brugerinfo[nick]."".Language("19")."!");
}
return 1;
}
function GetForbiddenNick($id){
$res_forbid = mysql_query("SELECT * FROM minichat3_forbidden_nicks where id='$id'");
$row_forbid = mysql_fetch_array($res_forbid);
return $row_forbid[nick];
}
function CheckForbiddenNicks($id,$nick){
$res_forbidden = mysql_query("SELECT * FROM minichat3_forbidden_nicks where nick='$nick'") or die (mysql_error());
$brugerinfo = brugerinfo($id);
if ($id == ""){
if (mysql_num_rows($res_forbidden) == 1){
Fejl("Your nick is NOT allowed on the chat. Choose another!");
}
return 0;
}
else {
if (mysql_num_rows($res_forbidden) == 1){
WriteToRemote("",$brugerinfo[id],"".Language("21")." <b>$nick</b>".Language("22")."!");
return 0;
}
else {
return 1;
}
}
}
function ChangeNick($id,$newnick){
$brugerinfo = brugerinfo($id);
$newnick = format($newnick);
$deni = 1;
if (CheckForbiddenNicks($id,$newnick) == 0){
$deni = 2;
}
$res = mysql_query("SELECT * FROM minichat3_sessions where nick='$newnick'");
$res2 = mysql_query("SELECT * FROM minichat3 where nick='$newnick' and id!='$brugerinfo[uid]'");
if (mysql_num_rows($res) == 1){
WriteToRemote("",$brugerinfo[id],"".Language("23")."");
$deni = 2;
}
elseif (mysql_num_rows($res2) == 1){
WriteToRemote("",$brugerinfo[id],"".Language("24")."");
$deni = 2;
}
elseif (strlen($newnick) < 3) {
WriteToRemote("",$brugerinfo[id],"".Language("25")."");
$deni = 2;
}
elseif (strlen($newnick) > 20) {
WriteToRemote("",$brugerinfo[id],"".Language("26")."");
$deni = 2;
}
if ($deni == 1){
mysql_query("UPDATE minichat3_sessions SET nick='$newnick' where id='$id'");
WriteToChat($brugerinfo[room],"System","","<b>".$brugerinfo[nick]."</b> ".Language("5")." <b>".$newnick."</b>");
}
return 1;
}
function ChangeColor($id,$thing,$newcolor){
$brugerinfo = brugerinfo($id);
if ($thing == "name_color"){
mysql_query("UPDATE minichat3_sessions SET name_color='$newcolor' where id='$id'") or die (mysql_error());
WriteToRemote("",$brugerinfo[id],"".Language("27")." <font color=".$newcolor."><b>".$newcolor."</b></font>");
}
elseif ($thing == "text_color"){
mysql_query("UPDATE minichat3_sessions SET text_color='$newcolor' where id='$id'") or die (mysql_error());
WriteToRemote("",$brugerinfo[id],"".Language("28")." <font color=".$newcolor."><b>".$newcolor."</b></font>");
}
}
function RestartChat($id,$room){
$brugerinfo = brugerinfo($id);
$res_alle = mysql_query("SELECT * FROM minichat3_sessions where room='$room'");
while ($row_alle = mysql_fetch_array($res_alle)){
mysql_query("DELETE FROM minichat3_txt_".$row_alle[id]."");
}
mysql_query("DELETE FROM minichat3_txt_".$room) or die(mysql_error());
WriteToChat($brugerinfo[room],"System","","".Language("6")." <b>".$brugerinfo[nick]."</b>");
}
function Ignore($id,$sendto){
$brugerinfo = brugerinfo($id);
$remote = brugerinfo($sendto);
if (strstr($brugerinfo[ignore_list], "$sendto,")){
$new_list = ereg_replace("$sendto,","",$brugerinfo[ignore_list]);
WriteToRemote("",$brugerinfo[id],"".Language("29")." <b>".$remote[nick]."</b>");
}
else {
$new_list = $brugerinfo[ignore_list]."".$sendto.",";
WriteToRemote("",$brugerinfo[id],"".Language("30")." <b>".$remote[nick]."</b>");
}
mysql_query("UPDATE minichat3_sessions SET ignore_list='$new_list' where id='$id'");
}
function ChangeRoom($id,$newroom){
$brugerinfo = brugerinfo($id);
$newroom = format($newroom);
$roomnavn = RoomNavn($brugerinfo[room]);
$newroomnavn = RoomNavn($newroom);
$res_newroom = mysql_query("SELECT * FROM minichat3_rooms where id='$newroom'");
if (mysql_num_rows($res_newroom) > 0){
GetChatB4Login($id,$newroom);
mysql_query("UPDATE minichat3_sessions SET room='$newroom' where id='$id'");
WriteToChat($brugerinfo[room],"System","","<b>".$brugerinfo[nick]."</b> ".Language("7")." ".RoomNavn($newroom)."");
WriteToChat($newroom,"System","","<b>".$brugerinfo[nick]."</b> ".Language("8")." ".RoomNavn($brugerinfo[room])."");
}
else {
WriteToRemote("",$brugerinfo[id],"".Language("31")."!");
}
}
function CountOnlineUsers($room){
$res = mysql_query("SELECT * FROM minichat3_sessions where room='$room' and kicktype='0'");
$tal = mysql_num_rows($res);
return $tal;
}
function brugerinfo($id){
$res_bruger = mysql_query("SELECT * FROM minichat3_sessions where id='$id'");
$row_bruger = mysql_fetch_array($res_bruger);
return $row_bruger;
}
function unikinfo($id){
$res_bruger = mysql_query("SELECT * FROM minichat3 where id='$id'");
$row_bruger = mysql_fetch_array($res_bruger);
return $row_bruger;
}
function StatusNavn($status){
if ($status == 0){$navn = "Gæst";}
elseif ($status == 1){$navn = "Normal";}
elseif ($status == 2){$navn = "CoAdmin";}
elseif ($status == 3){$navn = "Admin";}
else {$navn = "Unknown";}
return $navn;
}
function RoomNavn($no){
$no = format($no);
$res = mysql_query("SELECT * FROM minichat3_rooms where id='$no'");
if (mysql_num_rows($res) > 0){
$row = mysql_fetch_array($res);
$navn = $row[navn];
}
else {
Fejl("ROOM DOES NOT EXCIST! >".$no."");
}
return $navn;
}
function RoomEmne($no){
$no = format($no);
$res = mysql_query("SELECT * FROM minichat3_rooms where id='$no'");
if (mysql_num_rows($res) > 0){
$row = mysql_fetch_array($res);
$emne = $row[emne];
}
else {
Fejl("ROOM DOES NOT EXCIST! >".$no."");
}
return $emne;
}
function ChangeRoomEmne($id,$no,$emne){
$brugerinfo = brugerinfo($id);
$no = format($no);
$emne = format($emne);
$res = mysql_query("UPDATE minichat3_rooms SET emne='$emne' where id='$no'");
WriteToChat($no,"System","","<b>".$brugerinfo[nick]."</b> ".Language("134")." <b>".$emne."</b>");
}
function sendtouser($id){
$brugerinfo = brugerinfo($id);
print "
<select name=\"sendto\">
<option>Alle brugere</option>";
if ($brugerinfo[status] == "3"){ print " <option value=\"System\">System</option>";}
$res_sendto = mysql_query("SELECT * FROM minichat3_sessions where id!='$id' and room='$brugerinfo[room]' and kicktype='0'");
while ($row_sendto = mysql_fetch_array($res_sendto)){
print " <option value=\"$row_sendto[id]\">$row_sendto[nick]</option>\n";
}
print " </select>";
}
function checksession($sesid){
if ($sesid != "System"){
$time = time();
$check_session = mysql_query("SELECT * FROM minichat3_sessions where sesid='$sesid'");
$check_row = mysql_fetch_array($check_session);
if (mysql_num_rows($check_session) == "0"){
Fejl("Din bruger blev smidt ud af chatten");
}
else {
$update_session = mysql_query("UPDATE minichat3_sessions SET lastaction='$time' where sesid='$sesid'");
}
}
oldsession();
oldkicks();
}
function oldsession(){
$timeout = time() - 200;
$check_alle_sessions = mysql_query("SELECT * FROM minichat3_sessions where lastaction<'$timeout'");
while ($row_alle_sessions = mysql_fetch_array($check_alle_sessions)){
$dropinfo = brugerinfo($row_alle_sessions[id]);
WriteToChat($dropinfo[room],"System","","<b>".$dropinfo[nick]."</b>´s ".Language("9")." ".date("H:i:s")."");
mysql_query("DELETE FROM minichat3_sessions where id='$row_alle_sessions[id]'");
mysql_query("DROP TABLE minichat3_txt_".$row_alle_sessions[id]."");
}
}
function oldkicks(){
$timeout = time() - 20;
$check_alle_sessions = mysql_query("SELECT * FROM minichat3_sessions where kicktime<'$timeout' and kicktype>'0'");
while ($row_alle_sessions = mysql_fetch_array($check_alle_sessions)){
mysql_query("DELETE FROM minichat3_sessions where id='$row_alle_sessions[id]'");
}
}
function Kick($id,$kickid,$text){
if ($text == "" || $text == " "){ $text = "Byebye";}
$brugerinfo = brugerinfo($id);
$kickinfo = brugerinfo($kickid);
if ($brugerinfo[status] > $kickinfo[status]){
WriteToChat($brugerinfo[room],"System","","<b>".$kickinfo[nick]."</b> ".Language("10")." <b>".$brugerinfo[nick]."</b> [ ".$text." ]");
$time = time();
mysql_query("UPDATE minichat3_sessions SET kickby='$brugerinfo[nick]',kicktext='$text',kicktype='1',kicktime='$time' where id='$kickid'");
// mysql_query("DELETE FROM minichat3_sessions where id='$kickid'");
mysql_query("DROP TABLE minichat3_txt_".$kickid."");
}
elseif ($brugerinfo[status] == $kickinfo[status]){
WriteToRemote("",$brugerinfo[id],"".Language("32")." <b>".$kickinfo[nick]."</b>");
WriteToRemote("",$kickinfo[id],"ALERT! - <b>".$brugerinfo[nick]."</b> ".Language("33")."!");
}
elseif ($brugerinfo[status] < $kickinfo[status]){
WriteToRemote("",$brugerinfo[id],"Sorry - <b>".$kickinfo[nick]."</b>´s ".Language("34")."!");
WriteToRemote("",$kickinfo[id],"ALERT! - <b>".$brugerinfo[nick]."</b> ".Language("33")."!");
}
else {
WriteToRemote("",$brugerinfo[id],"ERROR");
}
}
function Ban($id,$kickid,$text){
if ($text == "" || $text == " "){ $text = "No reason given";}
$brugerinfo = brugerinfo($id);
$kickinfo = brugerinfo($kickid);
if ($brugerinfo[status] > $kickinfo[status]){
WriteToChat($brugerinfo[room],"System","","<b>".$kickinfo[nick]."</b> ".Language("11")." <b>".$brugerinfo[nick]."</b> [ ".$text." ]");
mysql_query("INSERT INTO minichat3_banlist (nick,datetime,ip,banby) VALUES ('$kickinfo[nick]',now(),'$kickinfo[ip]','$brugerinfo[nick]')");
$time = time();
mysql_query("UPDATE minichat3_sessions SET kickby='$brugerinfo[nick]',kicktext='$text',kicktype='2',kicktime='$time' where id='$kickid'");
// mysql_query("DELETE FROM minichat3_sessions where id='$kickid'");
mysql_query("DROP TABLE minichat3_txt_".$kickid."");
}
elseif ($brugerinfo[status] == $kickinfo[status]){
WriteToRemote("",$brugerinfo[id],"".Language("32")." <b>".$kickinfo[nick]."</b>");
WriteToRemote("",$kickinfo[id],"ALERT! - <b>".$brugerinfo[nick]."</b> ".Language("33")."!");
}
elseif ($brugerinfo[status] < $kickinfo[status]){
WriteToRemote("",$brugerinfo[id],"Sorry - <b>".$kickinfo[nick]."</b>´s ".Language("34")."!");
WriteToRemote("",$kickinfo[id],"ALERT! - <b>".$brugerinfo[nick]."</b> ".Language("33")."!");
}
else {
WriteToRemote("",$brugerinfo[id],"ERROR - FEJL");
}
}
function OnlineUsers($room){
$roomnavn = RoomNavn($room);
$res_alle = mysql_query("SELECT * FROM minichat3_sessions where room='$room' and kicktype='0'");
$tal = mysql_num_rows($res_alle);
if($tal){
$i = 0;
while($row_alle = mysql_fetch_array($res_alle)){
if ($tal == 1){
print "$row_alle[nick]";
}
elseif ($tal >= 2){
if ($i != 0){
print ", ";
}
print "$row_alle[nick]";
}
$i++;
}
}
if ($tal == "0"){
print Language("75");
}
elseif ($tal != "0") {
print ".";
}
}
function Credits($tid){
$diff = time() - $tid;
$res_credits = mysql_query("SELECT * FROM minichat3_setup where thing='credits'");
$row_credits = mysql_fetch_array($res_credits);
$res_credits_time = mysql_query("SELECT * FROM minichat3_setup where thing='credits_time'");
$row_credits_time = mysql_fetch_array($res_credits_time);
$credits = $diff / ($row_credits_time[value] * 60);
$credits = $credits * $row_credits[value];
$credits = floor($credits);
return $credits;
}
function GiveCredits($id,$amount){
$amount = floor($amount);
$brugerinfo = brugerinfo($id);
if ($amount <= 0){
WriteToRemote("",$brugerinfo[id],"".Language("35")."!");
}
else {
$unikinfo = unikinfo($brugerinfo[uid]);
$res_allready_out = mysql_query("SELECT * FROM minichat3_givecredits where takefrom='$brugerinfo[uid]' and giveto='0'");
$credits_taken = 0;
while ($row_allready_out = mysql_fetch_array($res_allready_out)){
$credits_taken = $credits_taken + $row_allready_out[amount];
}
$credits = $unikinfo[credits] - $credits_taken;
if ($credits < $amount){
WriteToRemote("",$brugerinfo[id],"".Language("36")."!");
}
else {
$res_insert_credit = mysql_query("INSERT INTO minichat3_givecredits (takefrom,amount,datetime) VALUES ('$brugerinfo[uid]','$amount',now())") or die (mysql_error());
$res_id = mysql_insert_id();
WriteToChat($brugerinfo[room],"System","","<a href=\"top.php?action=take_credits&credit=".$res_id."\" CLASS=\"system\"><b>".$brugerinfo[nick]."</b> ".Language("12")." <b>".$amount." Euro</b> ".Language("13")."!</a>");
}
}
}
function OnlineTid($fra,$til){
$diff = $til - $fra;
$dage = intval($diff / (24*60*60));
$timer = intval(($diff%(24*60*60))/(60*60));
$minutter = intval(($diff%(60*60))/(60));
$sekunder = intval($diff%60);
if ($minutter <= 9){
$minutter = "0$minutter";
}
if ($sekunder <= 9){
$sekunder = "0$sekunder";
}
$online_tid = "".$timer.":".$minutter.":".$sekunder."";
return $online_tid;
}
function GemOnlineTid($id){
$brugerinfo = brugerinfo($id);
$lines = $brugerinfo[chatlines];
$diff = $brugerinfo[lastaction] - $brugerinfo[logintime];
$credits_this_time = Credits($brugerinfo[logintime]);
$res_online = mysql_query("SELECT * FROM minichat3 where id='$brugerinfo[uid]'");
$row_online = mysql_fetch_array($res_online);
$onlinetid = $row_online[onlinetid] + $diff;
$chatlines = $row_online[chatlines] + $lines;
$credits = $row_online[credits] + $credits_this_time;
mysql_query("UPDATE minichat3 SET onlinetid='$onlinetid',chatlines='$chatlines',credits='$credits' where id='$brugerinfo[uid]'");
}
function skaer_txt($id){
$vaelg_tabel = mysql_query("SELECT * FROM minichat3_txt_".$id."");
$tal_tabel = @mysql_num_rows($vaelg_tabel);
$limit = 22;
$diff = $tal_tabel - $limit;
if ($diff > 0){
$vaelg_overfloedige = mysql_query("SELECT * FROM minichat3_txt_".$id." order by id ASC LIMIT 0,$diff");
while ($row_overfloedige = mysql_fetch_array($vaelg_overfloedige)){
$slet_overfloedige = mysql_query("DELETE FROM minichat3_txt_".$id." where id='$row_overfloedige[id]'");
}
}
}
function WriteToChat($room,$nick,$id,$msg){
$brugerinfo = brugerinfo($id);
$res = mysql_query("SELECT * FROM minichat3_sessions where room='$room'");
while ($row = mysql_fetch_array($res)){
mysql_query("INSERT INTO minichat3_txt_".$row[id]." (fra,fra_id,name_color,text_color,msg,time) values ('$nick','$id','$brugerinfo[name_color]','$brugerinfo[text_color]','$msg',now())");
}
mysql_query("INSERT INTO minichat3_txt_".$room." (fra,fra_id,name_color,text_color,msg,time) values ('$nick','$id','$brugerinfo[name_color]','$brugerinfo[text_color]','$msg',now())");
}
function WriteEmoteToChat($id,$msg){
$brugerinfo = brugerinfo($id);
$room = $brugerinfo[room];
$nick = $brugerinfo[nick];
$res = mysql_query("SELECT * FROM minichat3_sessions where room='$room'");
while ($row = mysql_fetch_array($res)){
mysql_query("INSERT INTO minichat3_txt_".$row[id]." (fra,fra_id,msg,type,time) values ('$nick','$id','$msg','2',now())");
}
mysql_query("INSERT INTO minichat3_txt_".$room." (fra,fra_id,msg,type,time) values ('$nick','$id','$msg','2',now())");
}
function WriteToRemote($sender,$remote,$msg){
if ($sender == ""){
$sendername = "System";
}
else {
$brugerinfo = brugerinfo($sender);
}
$remoteinfo = brugerinfo($remote);
if ($sender == ""){
mysql_query("INSERT INTO minichat3_txt_".$remote." (fra,til,msg,type,time)
values ('$sendername','$remoteinfo[nick]','$msg','1',now())");
}
elseif ($sender){
mysql_query("INSERT INTO minichat3_txt_".$remote." (fra,til,msg,type,time)
values ('$brugerinfo[nick]','$remoteinfo[nick]','$msg','1',now())");
mysql_query("INSERT INTO minichat3_txt_".$sender." (fra,til,msg,type,time)
values ('$brugerinfo[nick]','$remoteinfo[nick]','$msg','1',now())");
}
}
function ChatSetup($thing){
$res_setup = mysql_query("SELECT * FROM minichat3_setup where thing='$thing'");
$row_setup = mysql_fetch_array($res_setup);
return $row_setup[value];
}
function GetChatB4Login($id,$room){
if (ChatSetup("history") == 1){
$hent_rum = mysql_query("SELECT * FROM minichat3_txt_".$room." ORDER BY id ASC");
mysql_query("DELETE FROM minichat3_txt_".$id."");
while ($row_beskeder = mysql_fetch_array($hent_rum)){
mysql_query("INSERT INTO minichat3_txt_$id (fra,fra_id,til,name_color,text_color,msg,time)
VALUES('$row_beskeder[fra]','$row_beskeder[fra_id]','$row_beskeder[til]','$row_beskeder[name_color]','$row_beskeder[text_color]','$row_beskeder[msg]','$row_beskeder[time]')");
}
}
}
function login($id,$sesid,$nick,$pass,$room,$ip){
$nick = format($nick);
$room = format($room);
$time = time();
$uid = 0;
$res_user = mysql_query("SELECT * FROM minichat3 where nick='$nick'");
if (mysql_num_rows($res_user) > 0){
$row_user = mysql_fetch_array($res_user);
if ($row_user[pass] == $pass){
$status = $row_user[status];
$uid = $row_user[id];
}
else {
Fejl("The username is reserved - check password or choose another!");
}
}
CheckForbiddenNicks("",$nick);
$res = mysql_query("SELECT * FROM minichat3_sessions where nick='$nick' OR org_nick='$nick'");
if (mysql_num_rows($res) == 0){
$farve = "#000000";
if ($status == 2){ $farve = "#006600";}
elseif ($status == 3){ $farve = "blue";}
mysql_query("INSERT INTO minichat3_sessions (id,sesid,nick,org_nick,status,room,ip,name_color,text_color,lastaction,logintime,uid)
VALUES('$id','$sesid','$nick','$nick','$status','$room','$ip','$farve','$farve','$time','$time','$uid')");
mysql_query("
CREATE TABLE minichat3_txt_".$id." (
id int(10) unsigned NOT NULL auto_increment,
fra varchar(20) NOT NULL default '',
fra_id varchar(50) NOT NULL default '',
til varchar(20) NOT NULL default '',
name_color varchar(7) NOT NULL default '#000000',
text_color varchar(7) NOT NULL default '#000000',
msg varchar(255) NOT NULL default '',
type int(1) NOT NULL default '0',
time time NOT NULL default '00:00:00',
PRIMARY KEY (id)
)");
setcookie("minichat3_id",$id,time()+84000);
setcookie("minichat3_sesid",$sesid,time()+84000);
GetChatB4Login($id,$room);
WriteToChat($room,"System","","<b>".$nick."</b> ".Language("14")." ".date("H:i:s")."");
return 1;
}
else {
Fejl("Your username is allready in use. Please type another");
return 0;
}
}
function logoff($id,$sesid){
$brugerinfo = brugerinfo($id);
GemOnlineTid($brugerinfo[id]);
mysql_query("DELETE FROM minichat3_sessions where id='$id' and sesid='$sesid'");
mysql_query("DROP TABLE minichat3_txt_".$id."");
if ($brugerinfo[kicktype] == 0){
WriteToChat($brugerinfo[room],"System","","<b>".$brugerinfo[nick]."</b> ".Language("15")." ".date("H:i:s")."");
}
setcookie("minichat3_id","0");
setcookie("minichat3_sesid","0");
}
function Signup($nick,$pass,$email){
$res = mysql_query("SELECT * FROM minichat3 where nick='$nick'");
if (mysql_num_rows($res) != 0){
Fejl("Theres allready a user with that nick! - Choose an other nick");
}
mysql_query("INSERT INTO minichat3 (nick,pass,email) VALUES ('$nick','$pass','$email')");
header("Location: new_user.php?msg=Weee");
}
?>
og fjel er når man vil logge ind
Notice: Use of undefined constant REMOTE_ADDR - assumed 'REMOTE_ADDR' in c:\inetpub\wwwroot\chat\v.3\funktioner.php on line 6
Warning: Cannot add header information - headers already sent by (output started at c:\inetpub\wwwroot\chat\v.3\funktioner.php:6) in c:\inetpub\wwwroot\chat\v.3\login.php on line 5
Warning: Cannot add header information - headers already sent by (output started at c:\inetpub\wwwroot\chat\v.3\funktioner.php:6) in c:\inetpub\wwwroot\chat\v.3\login.php on line 6
Notice: Use of undefined constant room - assumed 'room' in c:\inetpub\wwwroot\chat\v.3\login.php on line 8
Notice: Use of undefined constant room - assumed 'room' in c:\inetpub\wwwroot\chat\v.3\login.php on line 8
Notice: Use of undefined constant navn - assumed 'navn' in c:\inetpub\wwwroot\chat\v.3\funktioner.php on line 298
Notice: Use of undefined constant login - assumed 'login' in c:\inetpub\wwwroot\chat\v.3\login.php on line 14
Notice: Undefined index: login in c:\inetpub\wwwroot\chat\v.3\login.php on line 14
Notice: Use of undefined constant value - assumed 'value' in c:\inetpub\wwwroot\chat\v.3\funktioner.php on line 13
Notice: Use of undefined constant value - assumed 'value' in c:\inetpub\wwwroot\chat\v.3\funktioner.php on line 17
:
Notice: Use of undefined constant value - assumed 'value' in c:\inetpub\wwwroot\chat\v.3\funktioner.php on line 13
Notice: Use of undefined constant value - assumed 'value' in c:\inetpub\wwwroot\chat\v.3\funktioner.php on line 17
: