Avatar billede grillo Nybegynder
13. april 2004 - 14:28 Der er 7 kommentarer

Hjælp der er noget i vejen med den PHP chat jeg har lagt ud

Hej alle sammen... prøv og gå ind på www.grillo.frac.dk og lopret 2 bruger og log ind med dem... også prøv at skriv privat til en bruger... det gøres v at vælge en burger der nede hvor der står all users der nede hvor man skriver... og nu kommer problemet... Der kommer en rød skrift når man skriver privat til en bruger og det skal der også komme men det man skriver privat til en bruger kommer også ud til andre bruger på siden... altså du det det fællels rum... håber der er nogen der vil hjælpe mig med at løse det her prøblem... Hvis du vil have koderne kan i skrive til mig på bosse@sport.dk så sender jeg gem gerne.. Men chatten kan også downloades fra http://netcoders.dk/sources.asp?id=1906&mode=view_source&tech_id=2


Tak på forhånd...


/Jesper
Avatar billede e-blog Nybegynder
13. april 2004 - 14:44 #1
Hold koden her
Avatar billede Slettet bruger
13. april 2004 - 14:45 #2
Prøv at hente en nyere udgave fra http://www.rachid.dk og se om det hjælper.

(Og prøv lige at læse dit indlæg før du sender næste gang.)
Avatar billede grillo Nybegynder
13. april 2004 - 14:56 #3
Ja okay sorry med de fejl... Skulle skynde mig at skrive den efter jeg skulle nå en bus... nå men... det link der ligger på http://www.rachid.dk virker ikke... eller det gør det ikke ved mig... Nogen der har den til at ligge??? så bare send til min mail ( bosse@sport.dk )



/Jesper
Avatar billede grillo Nybegynder
13. april 2004 - 19:50 #4
ikke noget der vil hjælpe mig?????


/Jesper
Avatar billede grillo Nybegynder
13. april 2004 - 19:50 #5
nogen*
Avatar billede Slettet bruger
13. april 2004 - 21:04 #6
Jo, prøv at smide koden her. netcoders.dk er vist også ret ustabil. (Og husk lige, at det her er et forum - ikke en chat, så du skal ikke regne med svar øjeblikkeligt.
Avatar billede grillo Nybegynder
13. april 2004 - 23:35 #7
Ahh... jeg er bare ikke så god til det der PHP... altså jeg v ikke lige hva det er for en fejl jeg skal smide koden fra... men jeg vil tro det er denne her....



<?
require("./config.php");
mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($database);

    $ip = $_SERVER[REMOTE_ADDR];
CheckBan($ip);

function CheckBan($ip){
    $res = mysql_query("select * from chatuser_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 MakeID($nick){
    $id = strlen($nick) * time();
    return $id;
}
function MakeSESID($nick){
    $sesid = strlen($nick) * time() + time();
    $sesid = md5($sesid);
    return $sesid;
}
function GetUsers($type){
    $back = "<select name=user>
\n";
    if ($type == "all"){
        $res_getusers = mysql_query("SELECT * FROM chatuser 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 chatuser_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;
    Fejl("asd");
}
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 chatuser_rooms SET navn='$newroom' where id='$room'");
    WriteToChat($room,"System","","<b>".$brugerinfo[nick]."</b> has changed the roomname to: <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("&lt;br /&gt;","",$str);
    $str = ereg_replace("<br />","",$str);
    return $str;
}
function Mode($id,$mode){
    $brugerinfo = brugerinfo($id);
    if ($brugerinfo[mode] == $mode){
        WriteToRemote("",$brugerinfo[id],"You are allready in this mode!");
    }
    else {
        $mode = format($mode);
        if ($mode == "normal" || $mode == "away"){
            mysql_query("UPDATE chatuser_sessions SET mode='$mode' where id='$brugerinfo[id]'");
            WriteToChat($brugerinfo[room],"System","","<b>".$brugerinfo[nick]."</b> has changed mode to <b>".$mode."</b>");
        }
        else {
            WriteToRemote("",$brugerinfo[id],"Unknown mode! Please write either ´/mode normal´ OR ´/mode away´");
        }
    }
}
function Mute($id,$sendto,$text){
    if ($text == "" || $text == " "){ $text = "No reason given";}
    $brugerinfo = brugerinfo($id);
    $remote = brugerinfo($sendto);

    if ($brugerinfo[status] > $remote[status]){
        if ($remote[mute] == 1){
            mysql_query("UPDATE chatuser_sessions SET mute='0' where id='$remote[id]'");
            WriteToChat($brugerinfo[room],"System","","<b>".$remote[nick]."</b> has been <b>unmuted</b> by <b>".$brugerinfo[nick]."</b> [ ".$text." ]");
        }
        else {
            mysql_query("UPDATE chatuser_sessions SET mute='1' where id='$remote[id]'");
            WriteToChat($brugerinfo[room],"System","","<b>".$remote[nick]."</b> has been <b>muted</b> by <b>".$brugerinfo[nick]."</b> [ ".$text." ]");
        }
    }
    elseif ($brugerinfo[status] == $remote[status]){
        WriteToRemote("",$brugerinfo[id],"You cannot mute/unmute a user with the same status as you!");
        WriteToRemote("",$remote[id],"<b>".$brugerinfo[nick]." tried to mute/unmute you!");
       
    }
    else {
        WriteToRemote("",$brugerinfo[id],"You cannot mute/unmute a user with a higher status than you!");
        WriteToRemote("",$remote[id],"<b>".$brugerinfo[nick]." tried to mute/unmute you!");
    }
    return 1;
}
function ChangeNick($id,$newnick){
    $brugerinfo = brugerinfo($id);
    $newnick = format($newnick);
    $deni = 1;

    $res = mysql_query("SELECT * FROM chatuser_sessions where nick='$newnick'");
    $res2 = mysql_query("SELECT * FROM chatuser where nick='$newnick' and id!='$brugerinfo[uid]'");
    if (mysql_num_rows($res) == 1){
        WriteToRemote("",$brugerinfo[id],"The nick is allready in use");
        $deni = 2;
    }
    elseif (mysql_num_rows($res2) == 1){
        WriteToRemote("",$brugerinfo[id],"This nick has been reserved by another user");
        $deni = 2;
    }
    elseif (strlen($newnick) < 3) {
        WriteToRemote("",$brugerinfo[id],"Your are must contain <b>at least</b> 3 letters");
        $deni = 2;
    }
    elseif (strlen($newnick) > 20) {
        WriteToRemote("",$brugerinfo[id],"Your nick must contain <b>less</b> than 20 letters");
        $deni = 2;
    }

    if ($deni == 1){
        mysql_query("UPDATE chatuser_sessions SET nick='$newnick' where id='$id'");
        WriteToChat($brugerinfo[room],"System","","<b>".$brugerinfo[nick]."</b> has changed nick to <b>".$newnick."</b>");
    }
    return 1;
}
function ChangeColor($id,$thing,$newcolor){
    $brugerinfo = brugerinfo($id);
    if ($thing == "name_color"){
        mysql_query("UPDATE chatuser_sessions SET name_color='$newcolor' where id='$id'") or die (mysql_error());
        WriteToRemote("",$brugerinfo[id],"You have changed your <b>NameColor</b> to: <font color=".$newcolor."><b>".$newcolor."</b></font>");
    }
    elseif ($thing == "text_color"){
        mysql_query("UPDATE chatuser_sessions SET text_color='$newcolor' where id='$id'") or die (mysql_error());
        WriteToRemote("",$brugerinfo[id],"You have changed your <b>TextColor</b> to: <font color=".$newcolor."><b>".$newcolor."</b></font>");
    }
}
function RestartChat($id,$room){
    $brugerinfo = brugerinfo($id);
    $res_alle = mysql_query("SELECT * FROM chatuser_sessions where room='$room'");

    while ($row_alle = mysql_fetch_array($res_alle)){
        mysql_query("DELETE FROM chatuser_txt_".$row_alle[id]."");
    }
    mysql_query("DELETE FROM chatuser_txt_".$room) or die(mysql_error());
    WriteToChat($brugerinfo[room],"System","","The chat was reset by <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],"You are <b>no longer</b> ignoring <b>".$remote[nick]."</b>");
    }
    else {
        $new_list = $brugerinfo[ignore_list]."".$sendto.",";
        WriteToRemote("",$brugerinfo[id],"You are <b>now</b> ignoring <b>".$remote[nick]."</b>");
    }
    mysql_query("UPDATE chatuser_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 chatuser_rooms where id='$newroom'");
    if (mysql_num_rows($res_newroom) > 0){
        GetChatB4Login($id,$newroom);
        mysql_query("UPDATE chatuser_sessions SET room='$newroom' where id='$id'");
        WriteToChat($brugerinfo[room],"System","","<b>".$brugerinfo[nick]."</b> went to ".RoomNavn($newroom)."");
        WriteToChat($newroom,"System","","<b>".$brugerinfo[nick]."</b> came from ".RoomNavn($brugerinfo[room])."");
    }
    else {
        WriteToRemote("",$brugerinfo[id],"Room does not excist!");
    }
}
function CountOnlineUsers($room){
    $res = mysql_query("SELECT * FROM chatuser_sessions where room='$room' and kicktype='0'");
    $tal = mysql_num_rows($res);
    return $tal;
}
function brugerinfo($id){
    $res_bruger = mysql_query("SELECT * FROM chatuser_sessions where id='$id'");
    $row_bruger = mysql_fetch_array($res_bruger);
    return $row_bruger;
}
function StatusNavn($status){
    if ($status == 0){$navn = "Guest";}
    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 chatuser_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 sendtouser($id){
    $brugerinfo = brugerinfo($id);
    print "
        <select name=\"sendto\">
        <option>All users</option>
                ";
        $res_sendto = mysql_query("SELECT * FROM chatuser_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){
    $time = time();
    $check_session = mysql_query("SELECT * FROM chatuser_sessions where sesid='$sesid'");
    $check_row = mysql_fetch_array($check_session);
    if (mysql_num_rows($check_session) == "0"){
        Fejl("Your session died - please log on again");
    }
    else {
        $update_session = mysql_query("UPDATE chatuser_sessions SET lastaction='$time' where sesid='$sesid'");   
    }
    oldsession();
    oldkicks();
}
function oldsession(){
    $timeout = time() - 200;
    $check_alle_sessions = mysql_query("SELECT * FROM chatuser_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 session died. User kicked by server at ".date("H:i:s")."");
        mysql_query("DELETE FROM chatuser_sessions where id='$row_alle_sessions[id]'");
        mysql_query("DROP TABLE chatuser_txt_".$row_alle_sessions[id]."");
    }
}
function oldkicks(){
    $timeout = time() - 20;
    $check_alle_sessions = mysql_query("SELECT * FROM chatuser_sessions where kicktime<'$timeout' and kicktype>'0'");
    while ($row_alle_sessions = mysql_fetch_array($check_alle_sessions)){
        mysql_query("DELETE FROM chatuser_sessions where id='$row_alle_sessions[id]'");
    }
}
function Kick($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> was kicked by <b>".$brugerinfo[nick]."</b> [ ".$text." ]");
        $time = time();
        mysql_query("UPDATE chatuser_sessions SET kickby='$brugerinfo[nick]',kicktext='$text',kicktype='1',kicktime='$time' where id='$kickid'");
        // mysql_query("DELETE FROM chatuser_sessions where id='$kickid'");
        mysql_query("DROP TABLE chatuser_txt_".$kickid."");
    }
    elseif ($brugerinfo[status] == $kickinfo[status]){
        WriteToRemote("",$brugerinfo[id],"Sorry - You have the same status as <b>".$kickinfo[nick]."</b>");
        WriteToRemote("",$kickinfo[id],"ALERT! - <b>".$brugerinfo[nick]."</b> tried to kick you1!");
    }
    elseif ($brugerinfo[status] < $kickinfo[status]){
        WriteToRemote("",$brugerinfo[id],"Sorry - <b>".$kickinfo[nick]."</b>´s status is too high!");
        WriteToRemote("",$kickinfo[id],"ALERT! - <b>".$brugerinfo[nick]."</b> tried to kick you2!");
    }
    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> was banned by <b>".$brugerinfo[nick]."</b> [ ".$text." ]");
        mysql_query("INSERT INTO chatuser_banlist (nick,datetime,ip,banby) VALUES ('$kickinfo[nick]',now(),'$kickinfo[ip]','$brugerinfo[nick]')");
        $time = time();
        mysql_query("UPDATE chatuser_sessions SET kickby='$brugerinfo[nick]',kicktext='$text',kicktype='2',kicktime='$time' where id='$kickid'");
        // mysql_query("DELETE FROM chatuser_sessions where id='$kickid'");
        mysql_query("DROP TABLE chatuser_txt_".$kickid."");
    }
    elseif ($brugerinfo[status] == $kickinfo[status]){
        WriteToRemote("",$brugerinfo[id],"Sorry - You have the same status as <b>".$kickinfo[nick]."</b>");
        WriteToRemote("",$kickinfo[id],"ALERT! - <b>".$brugerinfo[nick]."</b> tried to kick you1!");
    }
    elseif ($brugerinfo[status] < $kickinfo[status]){
        WriteToRemote("",$brugerinfo[id],"Sorry - <b>".$kickinfo[nick]."</b>´s status is too high!");
        WriteToRemote("",$kickinfo[id],"ALERT! - <b>".$brugerinfo[nick]."</b> tried to kick you2!");
    }
    else {
        WriteToRemote("",$brugerinfo[id],"ERROR");
    }
}
function OnlineUsers($room){
    $roomnavn = RoomNavn($room);

    $res_alle = mysql_query("SELECT * FROM chatuser_sessions where room='$room'");
    $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 "No online users!";
    }
    elseif ($tal != "0") {
        print ".";
    }
}
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);
    $diff = $brugerinfo[lastaction] - $brugerinfo[logintime];
    // Fejl("$brugerinfo[lastaction] - $brugerinfo[logintime] = $diff");
    $res_online = mysql_query("SELECT * FROM chatuser where id='$brugerinfo[uid]'");
    $row_online = mysql_fetch_array($res_online);
    $onlinetid = $row_online[onlinetid] + $diff;
    mysql_query("UPDATE chatuser SET onlinetid='$onlinetid' where id='$brugerinfo[uid]'");
}
function skaer_txt($id){
    $vaelg_tabel = mysql_query("SELECT * FROM chatuser_txt_".$id."");
    $tal_tabel = @mysql_num_rows($vaelg_tabel);
    $limit = 22;
    $diff = $tal_tabel - $limit;
    if ($diff > 0){
        $vaelg_overfloedige = mysql_query("SELECT * FROM chatuser_txt_".$id." order by id ASC LIMIT 0,$diff");
        while ($row_overfloedige = mysql_fetch_array($vaelg_overfloedige)){
            $slet_overfloedige = mysql_query("DELETE FROM chatuser_txt_".$id." where id='$row_overfloedige[id]'");
        }
    }
}
function WriteToChat($room,$nick,$id,$msg){
    $brugerinfo = brugerinfo($id);
    $res = mysql_query("SELECT * FROM chatuser_sessions where room='$room'");
    while ($row = mysql_fetch_array($res)){
        mysql_query("INSERT INTO chatuser_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 chatuser_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 chatuser_sessions where room='$room'");
    while ($row = mysql_fetch_array($res)){
        mysql_query("INSERT INTO chatuser_txt_".$row[id]." (fra,fra_id,msg,type,time) values ('$nick','$id','$msg','2',now())");
    }
    mysql_query("INSERT INTO chatuser_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 chatuser_txt_".$remote." (fra,til,msg,type,time)
                values ('$sendername','$remoteinfo[nick]','$msg','1',now())");
    }
    elseif ($sender){
        mysql_query("INSERT INTO chatuser_txt_".$remote." (fra,til,msg,type,time)
                values ('$brugerinfo[nick]','$remoteinfo[nick]','$msg','1',now())");
        mysql_query("INSERT INTO chatuser_txt_".$sender." (fra,til,msg,type,time)
                values ('$brugerinfo[nick]','$remoteinfo[nick]','$msg','1',now())");
    }
}
function GetChatB4Login($id,$room){
    $hent_rum = mysql_query("SELECT * FROM chatuser_txt_".$room." ORDER BY id ASC");
    mysql_query("DELETE FROM chatuser_txt_".$id."");
    while ($row_beskeder = mysql_fetch_array($hent_rum)){
        mysql_query("INSERT INTO chatuser_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 chatuser 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!");
        }
    }


    $res = mysql_query("SELECT * FROM chatuser_sessions where nick='$nick' OR org_nick='$nick'");
    if (mysql_num_rows($res) == 0){
        mysql_query("INSERT INTO chatuser_sessions (id,sesid,nick,org_nick,status,room,ip,lastaction,logintime,uid)
                VALUES('$id','$sesid','$nick','$nick','$status','$room','$ip','$time','$time','$uid')");
        WriteToChat($room,"System","","<b>".$nick."</b> has logged into the chat at ".date("H:i:s")."");
        mysql_query("
CREATE TABLE chatuser_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);
    setcookie("minichat3_sesid",$sesid);
    GetChatB4Login($id,$room);
        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 chatuser_sessions where id='$id' and sesid='$sesid'");
    mysql_query("DROP TABLE chatuser_txt_".$id."");
    if ($brugerinfo[kicktype] == 0){
        WriteToChat($brugerinfo[room],"System","","<b>".$brugerinfo[nick]."</b> has left the chat at ".date("H:i:s")."");
    }
    setcookie("minichat3_id","0");
    setcookie("minichat3_sesid","0");
}
function Signup($nick,$pass,$email){
    $res = mysql_query("SELECT * FROM chatuser 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 chatuser (nick,pass,email) VALUES ('$nick','$pass','$email')");
    header("Location: new_user.php?msg=Weee");
}
?>
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester