Comments!


fghfgh
- fghfgh


wuby wivkujmh bfezwdrg viuqm smbvqdpf fkzpe soytbu
- cidr fpnjaydm



-


enter YOU user name? mrrhm
- al


this chat room would be interesting if there were people in it!
-


Jokes relating to coding?
- Danetrix -


Having a comments section on a chat room may be redundant, but what else would i put on the left side of the page
- furgle


Name

Comments:

PHP Code

Through out the code there are links that go to the specific function or php file.

Passwords have been replaced with PASSWORD
Usernames have been replaced with USER
and the database name with DB

addUser.php

<?
include "functions.php";
$name = $_GET['name'];
echo "&Username=".addUser($name);
?>

addMsg.php

<?
include ("functions.php");
$Username = $_POST['User'];
$Message = $_POST['Msg'];
if ($Message != "") {
            addMsg($Username,$Message);
}
echo "&done=true";
?>

getMsg.php

<?
include ( "functions.php" );
$user = $_GET['Username'];
$lm = $_GET['BS'];
if ($lm == "" || $lm=="undefined") {
            $lm = getLastMsgTime();
};
$res = getMsgs($user,$lm);
$User = "";
$Time = "";
$Message = "";

for ($i = 0 ; $i < count($res) ; $i++) {
            $User .= $res[$i]['Username']."///";
            $Time .= $res[$i]['postdate']."///";
            $Message .= $res[$i]['Message']."///";
};
echo "&User=$User&MsgTime=$Time&Msg=$Message";
?>

getUsers.php

<?
include("functions.php");
$str = "";
$res = getUsers();
for ( $i = 0; $i < count($res);$i ++) {
            $str .= $res[$i]['Username']."///";
}
echo "&Names=$str";
?>

functions.php

 

<?
function getSQL($sql) {
           
             $link = mysql_connect('localhost',USER,PASSWORD);
              if (!$link) {
                         die('Could not connect: ' . mysql_error());
              }
              $db = mysql_select_db(DB);
              $res = mysql_query($sql);
              $i = 0;
              while ($row = mysql_fetch_array($res)) {
                                    $results[$i] = $row;
                                    $i ++ ;
              }
             
              mysql_close($link);    
           
              return $results;
}

function addSQL($sql) {
              $link = mysql_connect('localhost',USER,PASSWORD);
              if (!$link) {
                         die('Could not connect: ' . mysql_error());
              }
              $db = mysql_select_db(DB);
              $res = mysql_query($sql,$link);

              mysql_close($link);
};

function checkName($name,$i) {
            $search = "$name";
            if ($i !=0 ) {
                        $search = "$name($i)";
            }
            $sql = "Select Id from cr_Users where Username = \"$search\"";
            $res = getSQL($sql);
            if (count($res) > 0 ) {
                        $i++;
                        return checkName($name,$i);
            } else {
                        return $search;
            }
}
function addUser( $name ) {
            $name = checkName($name, 0);
            $sql = "Insert into cr_Users(Username,lastpost) values(\"$name\",Now())";
            addSQL($sql);
            return $name;
}

function getUsers() {
            $sql = "Delete from cr_Users where TimeDiff(Now(),lastpost) > '00:00:10'";
            addSQL($sql);
            $sql = "Select * from cr_Users";
            return   getSQL($sql);
}

function getLastMsgTime() {
            $sql = "Select postdate from cr_Messages  Order by postdate DESC Limit 2,1";
            $res = getSQL($sql);
            return $res[0][0];
}

function getMsgs($u,$time) {
            $sql = "Update cr_Users Set lastpost=Now() where Username =\"$u\"";
            addSQL($sql);
            $sql = "Select * from cr_Messages where postdate > \"$time\" Order by postdate ASC";

            return getSQL($sql);

}

function addMsg($u,$m) {
            $sql = "Insert into cr_Messages(Username, Message,postdate) values(\"$u\",\"$m\",Now())";
            addSQL($sql);
}

?>

Login
Username

Password

Fogotten Password ?
Register


User List


New Stuff

The farce 32

Holyshit a comic AHRAHEHZFBFLHFKLB
fukshfukshfhalsfs
dvbsffklsf
dsfjhksfhukshfuef
- Joeyjoejoe


Dead On The Job

3 Flash Games Including: Dead on the Job, Tribes, Paint
- furgle


The Farce 32

I know it has been up for a month but now it is in sexy HD color!!
- Joeyjoejoe


The farce 31

Another comic up on time, killing the old Joey and taking his job was the best idea ever!
- Joeyjoejoe


Comic Update 26/03/08

Comic 30 is done...only took about 3 years -_-
- Joeyjoejoe