Jump to content

[SOLVED] What does this mean?


fred12ned

Recommended Posts

The code is:
[code]<?php
class conn{
var $db;
var $tert;
function connect($dbname){
$this->db = new COM("ADODB.Connection");
$connstr = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=". realpath("./".$dbname.".accdb").";";
$this->db->open($connstr);
}
function clear(){
$this->db->Execute('DELETE FROM `User`');
$this->db->Execute('DELETE FROM Chat');
}
function checkusers(){
$rs = $this->db->Execute("SELECT * FROM `User`");
while(!$rs->EOF){
if(date('dHi')-$rs->Fields(3) > 5){
$this->db->Execute('DELETE FROM `User` WHERE Username = "'.$rs->Fields(1).'"');
$this->db->Execute("INSERT INTO Chat (Username,Message) VALUES('Xbgh54tr','<b>".$rs->Fields(1)."</b> has left the chat')");
$rs->MoveNext();
}
}
}
function getmsg($user){
$this->db->Execute("UPDATE `User` SET Tim = '".date('dHi')."' WHERE Username='".$user."'");
$result = $this->db->Execute("SELECT * FROM Chat");
$msg='';
while(!$result->EOF){
if ($result->Fields(1)!='Xbgh54tr'){
$rs = $this->db->Execute("SELECT Color FROM `User` WHERE Username='".$user."'");
$bob = $rs->Fields(0);
echo $result->Fields(1).' - <font color="#00FF00">'. $this->smilie($result->Fields(2)).'</font><br>'; }
else{
echo '<font color="#FF00FF">'.$result->Fields(2).'</font><br>'; }
$result->MoveNext();
}
$this->checkusers();
}
function sendmsg($user, $text){
$this->db->Execute("INSERT INTO Chat (Username, Message) VALUES('".$user."','".$text."')");
}
function smilie($text){
$rs = $this->db->Execute("SELECT * FROM Smilies");
while(!$rs->EOF) {
$smilies[] = $rs->Fields(1);
$images[] = "<img src='smilies/" . $rs->Fields(2) . ".gif'>";
$rs->MoveNext();
}
$text=str_replace($smilies, $images, $text);
return $text;
}
function newuser($user, $color){
$this->db->Execute("INSERT INTO Chat (Username, Message) VALUES('Xbgh54tr','<b>".$user."</b> has joined the chat')");
$date=date('dHi');
$this->db->Execute("INSERT INTO `User` (Username, Color, Tim) VALUES('".$user."','".$color."','".$date."')");
}
function changeuser($old, $new){
$this->db->Execute("UPDATE User SET user = '".$new."' WHERE user='".$old."'");
$this->db->Execute("INSERT INTO Chat VALUES('Xbgh54tr','<b>".$old."</b> has changed thier name to <b>".$new."</b>')");
}
function query(){
$this->db->Execute("INSERT INTO `Smilies` (`Smilies`, `Image`) VALUES (':|', 's1')");
$this->db->Execute("INSERT INTO `Smilies` (`Smilies`, `Image`) VALUES (':S', 's4')");
$this->db->Execute("INSERT INTO `Smilies` (`Smilies`, `Image`) VALUES ('8)', 's2')");
$this->db->Execute("INSERT INTO `Smilies` (`Smilies`, `Image`) VALUES (':(', 's5')");
$this->db->Execute("INSERT INTO `Smilies` (`Smilies`, `Image`) VALUES (':@', 's6')");
$this->db->Execute("INSERT INTO `Smilies` (`Smilies`, `Image`) VALUES (':O', 's7')");
$this->db->Execute("INSERT INTO `Smilies` (`Smilies`, `Image`) VALUES (':)', 's8')");
$this->db->Execute("INSERT INTO `Smilies` (`Smilies`, `Image`) VALUES (':D', 's9')");
$this->db->Execute("INSERT INTO `Smilies` (`Smilies`, `Image`) VALUES (';)', 's11')");
$this->db->Execute("INSERT INTO `Smilies` (`Smilies`, `Image`) VALUES (':P', 's10')");
}
}
?>[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.