Go to main page.

"; function strip($var) { $allowed = ''; return strip_tags($var, $allowed); } function closetags ( $html ) { preg_match_all ( "#<([a-z]+)( .*)?(?!/)>#iU", $html, $result ); $openedtags = $result[1]; preg_match_all ( "##iU", $html, $result ); $closedtags = $result[1]; $len_opened = count ( $openedtags ); if( count ( $closedtags ) == $len_opened ) { return $html; } $openedtags = array_reverse ( $openedtags ); for( $i = 0; $i < $len_opened; $i++ ) { if ( !in_array ( $openedtags[$i], $closedtags ) ) { $html .= ""; } else { unset ( $closedtags[array_search ( $openedtags[$i], $closedtags)] ); } } return $html; } include("dbref.php"); class Msg extends Dbobj{ var $text; } class User extends Dbobj{ var $name; var $time; } $mydb=new Easyphpdb(); $msg=new Msg(); $name1 = strip_tags($_POST['text0']); if($name1!="") { $name1=substr($name1,0, 20); } $addline=true; $mydb->loadobjecttables(); $user=null; $tabls=$mydb->getvalue(); $user=array(); $utidx=-1; if($tabls!=null) { for($i=0; $igetNameOfClass(); if ($oc=="User") { $user=$tabls[$i]; $utidx=$i; } } } $utime=$_POST['utime']; $utime2=$mydb->gettime(); if($utime==""||$utime==null) { $utime=$mydb->gettime(); } $currentuser=null; $nameexists=false; for($i=0; $itime==$utime) { $currentuser=$user[$i]; } } for($i=0; $iname==$name1) { $nameexists=true; } } if(count($user)>0) { if($name1!=""&&$currentuser==null&&$nameexists==false) { $curuser=new User(); $curuser->name=$name1; $curuser->time=$utime; $user[]=$curuser; $tabls[$utidx]=$user; $mydb->setvalue($tabls); $mydb->saveobjecttable("User"); $currentuser=$curuser; } if($name1!=""&&$currentuser==null&&$nameexists==true) { $name1=""; $addline=false; } else if($name1!=""&&$currentuser->name!=""&&$name1!=$currentuser->name&&$nameexists==false) { $currentuser->name=$name1; $currentuser->time=$utime2; $utime=$utime2; $mydb->setvalue($tabls); $mydb->saveobjecttable("User"); } else if($name1!=""&&$currentuser->name!=""&&$name1!=$currentuser->name&&$nameexists==true) { $name1=$currentuser->name; $addline=false; } else if($name1!=""&&$currentuser->name!=""&&$name1==$currentuser->name) { $currentuser->time=$utime2; $utime=$utime2; $mydb->setvalue($tabls); $mydb->saveobjecttable("User"); } else { $addline=false; } } else { if($name1!=""&&$nameexists==false&&$currentuser!=null) { $curuser=new User(); $curuser->name=$name1; $curuser->time=$utime2; $utime=$utime2; $users12=array(); $users12[]=$curuser; $tabls[]=$users12; $mydb->setvalue($tabls); $mydb->saveobjecttables(); } if($name1!=""&&$nameexists==false&&$currentuser==null) { $curuser=new User(); $curuser->name=$name1; $curuser->time=$utime2; $utime=$curuser->time; $users12=array(); $users12[]=$curuser; $tabls[]=$users12; $mydb->setvalue($tabls); $mydb->saveobjecttables(); } else if($name1!=""&&$nameexists==true) { $name1=""; $addline=false; } else { $addline=false; } } $msg1=strip($_POST['text1']); $msg1 = preg_replace('#(.*?)#is', '', $msg1); $msg->text=date("d.m.Y H:i:s")." ".$name1.": ".$msg1; $msg->text=substr($msg->text,0, 200); $msg->text=closetags($msg->text); $texists=false; $msgtidx=0; $t1=$mydb->getvalue(); for($i=0; $igetNameOfClass()=="Msg") { $msgtidx=$i; $texists=true; if(count($t1[$i])>165) { $arr12 = array_slice($t1[$i], -165); $t1[$i]=$arr12; $mydb->setvalue($t1); $mydb->saveobjecttable("Msg"); break; } break; } } $oput=""; $tabls=$mydb->getvalue(); if(!empty($_POST['text1'])&&$addline==true) { if (strlen(trim($msg1)) != 0) { if($texists==false) { $aone=array(); $aone[]=$msg; $tabls[]=$aone; $mydb->setvalue($tabls); $mydb->saveobjecttable("Msg"); } else { $tabls[$msgtidx][]=$msg; $mydb->setvalue($tabls); $mydb->saveobjecttable("Msg"); } } $t2=$mydb->query("select text from Msg;"); for($i=0; $i

"; } } else { if($texists==true) { $t2=$mydb->query("select text from Msg;"); for($i=0; $i

"; } } } ?>

Name:

Text:

Users: