Jututubade lehekülg.......
We <[email protected]> Wed, 24 Nov 2021 01:16:17 -0800 (PST)
| Newsgroups | alt.comp.lang.php |
|---|---|
| Message-ID | <[email protected]> |
ilist.php
<?php
include("../data.php");
class Msg extends Dobj{
var $text;
}
class Inimene extends Dobj{
var $name;
var $time;
var $dpic;
}
$myd=3Dnew Data();
$myd->loadobjecttables();
$texists=3Dfalse;
$t1=3D$myd->dtables;
$ilist=3Darray();
$itidx=3D-1;
for($i=3D0; $i<count($t1);$i++) {
if($t1[$i][0]->getNameOfClass()=3D=3D"Inimene") {
$texists=3Dtrue;
$itidx=3D$i;
break;
}
}
$newi=3Darray();
if($itidx>-1) {
for($i=3D0; $i<count($t1[$itidx]);$i++) {
$date12=3Ddate("d.m.Y H:i:s", strtotime($t1[$itidx][$i]->time));
$dtime =3D new DateTime($date12);
$datenow=3Ddate( 'd.m.Y H:i:s', strtotime( '+3 hour' , strtotime("now") ));
$dtimenow =3D new DateTime($datenow);
$diff =3D $dtimenow->getTimestamp() - $dtime->getTimestamp();
if($diff<60*15) {
$newi[]=3D$t1[$itidx][$i];
} else {
}
}
if(count($newi)=3D=3D0) {
unset($t1[$itidx]);
unlink("Inimene.dat");
} else {
$t1[$itidx]=3D$newi;
$myd->dtables=3D$t1;
$myd->saveobjecttable("Inimene");
}
}
if($texists=3D=3Dtrue) {
$t2=3D$myd->query("get name from Inimene;");
for($i=3D0; $i<count($t2);$i++) {
$ilist[]=3D$t2[$i];
}
} else {
}
$result =3D array_unique($ilist);
$List =3D implode(', ', $result);
if(substr($List,strlen($List)-2, 2)=3D=3D", ") {
$List=3Dsubstr($List, 0, strlen($List)-2);
}
echo $List;
?>
index.php
<!DOCTYPE html>
<html>
<head>
<link rel=3D"icon" style=3D"width:15px; height=3D15px; background-color: #7=
6FEFF; color: #76FEFF;"/>
<style>
input {
color: #76FEFF;
}
body {
/*
background-image: url("img.jpg");
background-repeat: repeat;
background-size: 100%;
*/
background-color: #76FEFF;
}
.main12 {
text-decoration:none;
color: #76FEFF;
font-weight: bold;
background-color: white;
border: 1px solid white;
border-radius: 10px 10px;
padding: 5px;
font-weight:bold;
}
.main1 {
text-decoration:none;
color: white;
border-radius: 5px 5px;
padding: 5px;
font-weight:bold;
width:775px;
}
.main12 {
text-decoration:none;
color: #76FEFF;
border-radius: 5px 5px;
padding: 5px;
font-weight:bold;
vertical-align: middle;
width:535px;
}
.main2 {
color: white;
}
.main3 {
text-decoration:none;
color: #76FEFF;
font-weight: bold;
background-color: white;
border: 1px solid white;
border-radius: 5px 5px;
padding: 5px;
font-weight:bold;
width:100px;
display:block;
}
.w1 {
color: white;
}
.w2 {
color: white;
display:inline-block;
}
.pwd {
color: #76FEFF;
display:inline-block;
}
.w21 {
color: white;
display:block;
}
</style>
</head>
<body>
<h1 class=3D"main1">
</h1>
<h1 class=3D"main12" style=3D"line-height: 45px;">W e l c o m e . T e r e t=
u l e m a s t .</h1>
<h1 class=3D"main1">
</h1>
<?php
include("func.php");
include("data.php");
class Password extends Dobj{
var $content;
}
$dirs =3D array_filter(glob('*'), 'is_dir');
$cannotcreate=3Dfalse;
if(count($dirs)>60) {
$cannotcreate=3Dtrue;
}
if(!empty($_POST['rname'])&&($_POST['rname']!=3D" ")&&!empty($_POST['rname'=
])&$cannotcreate=3D=3Dfalse) {
$_POST['rname'] =3D strip_tags($_POST['rname']);
$_POST['rname']=3Dsubstr($_POST['rname'],0, 100);
$_POST['rname'] =3D str_replace(' ', 'space21326', $_POST['rname']);
$_POST['rname'] =3D str_replace(',', 'comma21326', $_POST['rname']);
$_POST['rname'] =3D str_replace('?', 'q21326', $_POST['rname']);
$_POST['rname'] =3D str_replace('\'', 'ukom21326', $_POST['rname']);
mkdir($_POST['rname'], 0755);
if(!empty($_POST['password'])&&$_POST['password']!=3D"") {
$myd=3Dnew Data();
$tabls=3Darray();
$pwd1=3Dnew Password();
$pwd1->content=3D$_POST['password'];
$pwdt=3Darray();
$pwdt[]=3D$pwd1;
$tabls[]=3D$pwdt;
$myd->dtables=3D$tabls;
$myd->saveobjecttable("Password");
$file =3D 'Password.dat';
$newfile =3D 'Password.dat';
if (!copy($file, $_POST['rname'].'/'.$newfile)) {
echo "Error\n";
}
chmod($_POST['rname'].'/'.$newfile, 0700);
unlink("Password.dat");
}
$file =3D 'index2.php';
$newfile =3D 'index.php';
if (!copy($file, $_POST['rname'].'/'.$newfile)) {
echo "Error\n";
}
chmod($_POST['rname'].'/'.$newfile, 0744);
$file =3D 'renewing.php';
$newfile =3D 'renewing.php';
if (!copy($file, $_POST['rname'].'/'.$newfile)) {
echo "Error\n";
}
chmod($_POST['rname'].'/'.$newfile, 0744);
$file =3D 'ilist.php';
$newfile =3D 'ilist.php';
if (!copy($file, $_POST['rname'].'/'.$newfile)) {
echo "Error\n";
}
chmod($_POST['rname'].'/'.$newfile, 0744);
$file =3D 'findlastmdate.php';
$newfile =3D 'findlastmdate.php';
if (!copy($file, $_POST['rname'].'/'.$newfile)) {
echo "Error\n";
}
chmod($_POST['rname'].'/'.$newfile, 0744);
$file =3D 'func.php';
$newfile =3D 'func.php';
if (!copy($file, $_POST['rname'].'/'.$newfile)) {
echo "Error\n";
}
chmod($_POST['rname'].'/'.$newfile, 0744);
}
$dirs =3D array_filter(glob('*'), 'is_dir');
if(count($dirs)>0) {
echo "<h2 class=3D'main2'>Topics</h2>";
}
$dirs =3D array_filter(glob('*'), 'is_dir');
foreach ($dirs as $file) {
$file2=3D str_replace('space21326', ' ', $file);
$file2=3D str_replace('comma21326', ',', $file2);
$file2=3D str_replace('q21326', '?', $file2);
$file2=3D str_replace('ukom21326', '\'', $file2);
if($file=3D=3D"files") continue;
$dir1=3D'//'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);
$output =3D file_get_contents('http:'.$dir1.$file.'/findlastmdate.php');
if($output!=3D"") {
$date12=3Ddate("d.m.Y H:i:s", strtotime($output));
$d_start =3D new DateTime($date12);
$currentdate =3D date('d.m.Y H:i:s', time());
$d_end =3D new DateTime($currentdate);
$diff =3D $d_start->diff($d_end);
$delete1=3Dfalse;
if(!($diff->format('%d')<1000||$diff->format('%d')=3D=3D1000&&$diff->format=
('%h')<1))
$delete1=3Dtrue;
if($delete1) {
rrmdir('/'.$file);
continue;
}
}
echo '<a class=3D"main12" href=3D\'http:'.$dir1.$file.'\'>'.$file2.'</a>';
echo "<p></p>";
$path_parts =3D pathinfo($file.'/Msg.dat');
if(!class_exists($path_parts['filename'])) {
continue;
}
}
?>
<p style=3D"height:50px;"> </p>
<form method=3D"POST">
<p class=3D"w2">
Topic:
</p>
<input name=3D"rname"/>
<p class=3D"w21">
Password(optional)
</p>
<input class=3D"pwd" name=3D"password" type=3D"password"/>
<p class=3D"w">
</p>
<input type=3D"submit" class=3D"main3" value=3D"Create"/>
</form>
<p class=3D"w1" style=3D"color: #j3k4f8; font-weight: bold;">
To access password protected topic: /index.php?code=3DPassword</p>
<p class=3D"w1" style=3D"color: #j3k4f8; font-weight: bold;">Attention: Ple=
ase try to behave, while in talkrooms.....</p>
<p></p>
<p></p>
<p> </p>
<p> </p>
<p class=3D"w1"></p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</body>
</html>
index2.php
<!DOCTYPE html>
<html>
<head>
<link rel=3D"icon" style=3D"width:15px; height=3D15px; background-color: #7=
6FEFF; color: #76FEFF;"/>
<style>
input {
color: #76FEFF;
}
body {
background-color: #76FEFF;
}
.file1 {
text-decoration: none;
color: #76FEFF;
}
.main1 {
text-decoration:none;
color: #76FEFF;
background-color: white;
border: 1px solid white;
border-radius: 5px 5px;
padding: 5px;
font-weight:bold;
width:100px;
}
.main2 {
color: white;
margin-top:-15px;
}
.main3 {
text-decoration:none;
color: #76FEFF;
background-color: white;
border: 1px solid white;
border-radius: 5px 5px;
padding: 5px;
font-weight:bold;
width:100px;
}
.main4 {
color: white;
width: 140px;
}
.main5 {
color: white;
margin-top:-15px;
margin-bottom:1px;
}
.main6 {
color: white;
margin-top:15px;
width:600px;
overflow-wrap: break-word;
}
.main7 {
margin-bottom:1px;
}
.text1 {
color: #76FEFF;
width: 538px;
height: 29px;
margin-top:-15px;
overflow-wrap: break-word;
}
textarea {
color: black;
}
form {
line-height: 1.4;
}
.a1 {
line-height: 1.4;
width: 561px;
height: 357px;
overflow-y: auto;
overflow-x: hidden;
background-color: white;
overflow-wrap: break-word;
color: #76FEFF;
}
.a1 p {
height:0.001%;
margin-bottom:-15px;
}
.nameslist {
margin-bottom:15px;
}
</style>
<script>
function imgError(image) {
image.onerror =3D "";
image.src =3D "../noimage.jpg";
image.style=3D"background-color: #848587;";
image.width=3D"40px";
image.height=3D"40px";
return true;
}
</script>
</head>
<body onload=3D"a00000()">
<?php
include("func.php");
$size =3D 0;
$files =3D glob('uploads/*.*');
usort($files, function($a, $b) {
return filemtime($a) < filemtime($b);
});
$idx=3D0;
$files =3D array_reverse($files, true);
if(is_dir("uploads")) {
foreach($files as $file) {
if($idx=3D=3Dcount($files)-1) break;
$filesize =3D filesize($file);
$size+=3D$filesize;
$idx++;
}
$idx=3D0;
if($size>5000000) {
foreach($files as $file) {
if($idx=3D=3Dcount($files)-1) break;
unlink($file);
$idx++;
}
}
}
$size =3D 0;
$files =3D glob('dpic/*.*');
usort($files, function($a, $b) {
return filemtime($a) < filemtime($b);
});
$idx=3D0;
$files =3D array_reverse($files, true);
if(is_dir("dpic")) {
foreach($files as $file) {
if($idx=3D=3Dcount($files)-1) break;
$filesize =3D filesize($file);
$size+=3D$filesize;
$idx++;
}
$idx=3D0;
if($size>5000000) {
foreach($files as $file) {
if($idx=3D=3Dcount($files)-1) break;
unlink($file);
$idx++;
}
}
}
include("../data.php");
class Password extends Dobj{
var $content;
}
class Msg extends Dobj{
var $text;
var $messagenumber;
}
class Inimene extends Dobj{
var $name;
var $time;
var $dpic;
var $inr;
}
class Picture extends Dobj{
var $name;
var $time;
}
$myd=3Dnew Data();
$myd->loadobjecttables();
$itime2=3D$myd->gettime();
$itime2=3Ddate( 'd.m.Y H:i:s', strtotime( '+3 hour' , strtotime($itime2) ) =
);
if(!is_dir("uploads")) {
mkdir("uploads", 0777);
}
if(!is_dir("dpic")) {
mkdir("dpic", 0777);
}
$files1 =3D scandir("uploads");
if(count($files1)>270) {
rrmdir("uploads");
mkdir("uploads", 0777);
}
$msg=3Dnew Msg();
$name1 =3D strip_tags($_POST['text0']);
if($name1!=3D"") {
$name1=3Dsubstr($name1,0, 646);
}
$addline=3Dtrue;
$tabls=3D$myd->dtables;
$time=3Dnull;
$tidx=3D-1;
$nooutput=3Dfalse;
$oput=3D"";
$pwd1=3D"";
if($tabls!=3Dnull) {
for($i=3D0; $i<count($tabls); $i++) {
$oc=3D$tabls[$i][0]->getNameOfClass();
if ($oc=3D=3D"Password") {
$pwd1=3D$tabls[$i][0]->content;
}
}
}
$pwdactive=3D0;
if($pwd1!=3D"") {
$pwdactive=3D1;
if($pwd1!=3D$_GET['code']) exit(0);
}
$pic_uploaded=3Dfalse;
$newpic1=3Dnull;
if(isset($_POST["submit"])&&$_FILES["fileToUpload"]['error']=3D=3D0) {
$target_dir =3D "uploads/";
$target_file =3D $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk =3D 1;
$imageFileType =3D strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
if (file_exists($target_file)) {
$uploadOk =3D 0;
}
if ($_FILES["fileToUpload"]["size"] > 5000000) {
$uploadOk =3D 0;
}
if($imageFileType=3D=3D"php") {
$uploadOk =3D 0;
}
$time1212=3Dtime();
if ($uploadOk =3D=3D 0) {
} else {
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], str_replace('.'=
, $time1212.'.', $target_file))) {
$pic_uploaded=3Dtrue;
} else {
}
}
$newpic=3Dnull;
$tabls0=3Dnull;
if($pic_uploaded=3D=3Dtrue) {
$tabls0=3D$myd->dtables;
$picstidx=3D-1;
if($tabls0!=3Dnull) {
for($i=3D0; $i<count($tabls0); $i++) {
$oc0=3D$tabls0[$i][0]->getNameOfClass();
if ($oc0=3D=3D"Picture") {
$picstidx=3D$i;
}
}
if($picstidx=3D=3D-1) {
$picstidx=3Dcount($tabls0);
$tabls0[]=3Darray();
}
} else {
$tabls0=3Darray();
$tabls0[]=3Darray();
$picstidx=3D0;
}
$newpic=3Dnew Picture();
$newpic->name=3Dbasename(str_replace('.', $time1212.'.', $_FILES["fileToUpl=
oad"]["name"]));
$newpic->time=3D$itime2;
$newpic1=3D$newpic;
$tabls0[$picstidx][]=3D$newpic;
$myd->dtables=3D$tabls0;
$myd->saveobjecttable("Picture");
}
}
$url =3D isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
$url .=3D $_SERVER['SERVER_NAME'];
$url .=3D $_SERVER['REQUEST_URI'];
$info =3D parse_url($url);
$info["path"]=3Ddirname($info["path"]);
$new_url =3D $info["scheme"]."://".$info["host"];
$new_url =3D str_replace(' ', '', $new_url);
echo "<a class=3D'main1' href=3D'".$new_url."'>Avalehele</a><p></p>";
function strip($var) {
$allowed =3D '<font>';
return strip_tags($var, $allowed);
}
function closetags ( $html )
{
preg_match_all ( "#<([a-z]+)( .*)?(?!/)>#iU", $html, $result );
$openedtags =3D $result[1];
preg_match_all ( "#</([a-z]+)>#iU", $html, $result );
$closedtags =3D $result[1];
$len_opened =3D count ( $openedtags );
if( count ( $closedtags ) =3D=3D $len_opened )
{
return $html;
}
$openedtags =3D array_reverse ( $openedtags );
for( $i =3D 0; $i < $len_opened; $i++ )
{
if ( !in_array ( $openedtags[$i], $closedtags ) )
{
$html .=3D "</" . $openedtags[$i] . ">";
}
else
{
unset ( $closedtags[array_search ( $openedtags[$i],
$closedtags)] );
}
}
return $html;
}
$ind=3Darray();
$itidx=3D-1;
if($tabls!=3Dnull) {
for($i=3D0; $i<count($tabls); $i++) {
$oc=3D$tabls[$i][0]->getNameOfClass();
if ($oc=3D=3D"Inimene") {
$ind=3D$tabls[$i];
$itidx=3D$i;
}
}
}
if($ind!=3Dnull) {
if(count($ind)>2499) {
echo "Topic full(2500).";
exit(0);
}
}
$iexists=3Dfalse;
$currenti=3Dnull;
for($i=3D0; $i<count($ind); $i++) {
if($ind[$i]->name=3D=3D$name1) {
$iexists=3Dtrue;
$currenti=3D$ind[$i];
}
}
$havewritten=3Dfalse;
$myname =3D strip_tags($_POST['myname']);
if($myname!=3D"") {
$myname=3Dsubstr($myname,0, 646);
}
if($myname!=3D"") {
$havewritten=3Dtrue;
}
if(count($ind)>0) {
if($name1!=3D""&&$havewritten=3D=3Dfalse&&$iexists=3D=3Dfalse) {
$curi=3Dnew Inimene();
$curi->name=3D$name1;
$myname=3D$name1;
$curi->time=3D$itime2;
$ind[]=3D$curi;
$tabls[$itidx]=3D$ind;
$myd->dtables=3D$tabls;
$myd->saveobjecttable("Inimene");
$currenti=3D$curi;
} else if($name1!=3D""&&$havewritten=3D=3Dtrue&&$iexists=3D=3Dfalse) {
for($i=3D0; $i<count($ind); $i++) {
if($ind[$i]->name=3D=3D$myname) {
$currenti=3D$ind[$i];
}
}
$currenti->name=3D$name1;
$myname=3D$name1;
$currenti->time=3D$itime2;
$myd->dtables=3D$tabls;
$myd->saveobjecttable("Inimene");
}
else if($name1!=3D""&&$currenti->name=3D=3D$name1&&$iexists=3D=3Dtrue) {
$currenti->time=3D$itime2;
$itime=3D$itime2;
$myd->dtables=3D$tabls;
$myd->saveobjecttable("Inimene");
}
} else {
if($name1!=3D""&&$iexists=3D=3Dfalse) {
$curi=3Dnew Inimene();
$curi->name=3D$name1;
$curi->time=3D$itime2;
$myname=3D$name1;
$ind12=3Darray();
$ind12[]=3D$curi;
$tabls[]=3D$ind12;
$myd->dtables=3D$tabls;
$myd->saveobjecttables();
$currenti=3D$curi;
}
else if($name1!=3D""&&$iexists=3D=3Dtrue) {
echo "User exists.";
exit(0);
}
}
$pic_uploaded2=3Dfalse;
if(isset($_POST["submit"])&&$_FILES["fileToUpload2"]['error']=3D=3D0) {
$target_dir =3D "dpic/";
$target_file =3D $target_dir . basename($_FILES["fileToUpload2"]["name"]);
$uploadOk =3D 1;
$imageFileType =3D strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
if (file_exists($target_file)) {
$uploadOk =3D 0;
}
if ($_FILES["fileToUpload2"]["size"] > 5000000) {
$uploadOk =3D 0;
}
if($imageFileType=3D=3D"php"||!($imageFileType=3D=3D"jpg"||$imageFileType=
=3D=3D"png"||$imageFileType=3D=3D"gif"||$imageFileType=3D=3D"jpeg")) {
$uploadOk =3D 0;
}
$time1212=3Dtime();
if ($uploadOk =3D=3D 0) {
} else {
if (move_uploaded_file($_FILES["fileToUpload2"]["tmp_name"], str_replace('.=
', $time1212.'.', $target_file))) {
chmod(str_replace('.', $time1212.'.', $target_file), 0744);
$pic_uploaded2=3Dtrue;
}
}
$newpic2=3Dnull;
$tabls0=3Dnull;
if($pic_uploaded2=3D=3Dtrue) {
$tabls0=3D$myd->dtables;
$picstidx=3D-1;
if($tabls0!=3Dnull) {
for($i=3D0; $i<count($tabls0); $i++) {
$oc0=3D$tabls0[$i][0]->getNameOfClass();
if ($oc0=3D=3D"Picture") {
$picstidx=3D$i;
}
}
if($picstidx=3D=3D-1) {
$picstidx=3Dcount($tabls0);
$tabls0[]=3Darray();
}
} else {
$tabls0=3Darray();
$tabls0[]=3Darray();
$picstidx=3D0;
}
$newpic2=3Dnew Picture();
$newpic2->name=3Dbasename(str_replace('.', $time1212.'.', $_FILES["fileToUp=
load2"]["name"]));
$newpic2->time=3D$itime2;
$tabls0[$picstidx][]=3D$newpic2;
$myd->dtables=3D$tabls0;
$myd->saveobjecttable("Picture");
$currenti->dpic=3D$newpic2->name;
$myd->saveobjecttable("Inimene");
}
}
$msg1=3Dstrip($_POST['text1']);
$msg1 =3D preg_replace('#<script(.*?)>(.*?)</script>#is', '', $msg1);
$msg12=3D$msg1;
if($currenti->dpic!=3D""||$currenti->dpic!=3Dnull) {
$msg->text=3D$itime2." ".$name1." <img src=3D'dpic/".$currenti->dpic."' one=
rror=3D'imgError(this);' style=3D'width: 50px;' > : ".$msg1;
} else {
$msg->text=3D$itime2." ".$name1." : ".$msg1;
}
$msg->text=3Dsubstr($msg->text,0, 216345);
$msg->text=3Dclosetags($msg->text);
$texists=3Dfalse;
$msgtidx=3D0;
$t1=3D$myd->dtables;
for($i=3D0; $i<count($t1);$i++) {
if($t1[$i][0]->getNameOfClass()=3D=3D"Msg") {
$msgtidx=3D$i;
$texists=3Dtrue;
if(count($t1[$i])>165) {
$arr12 =3D array_slice($t1[$i], -165);
$t1[$i]=3D$arr12;
$myd->dtables=3D$t1;
$myd->saveobjecttable("Msg");
break;
}
break;
}
}
$tabls=3D$myd->dtables;
if(!empty($_POST['text1'])&&$addline=3D=3Dtrue) {
if (strlen(trim($msg1)) !=3D 0&&$pic_uploaded=3D=3Dtrue) {
if($texists=3D=3Dfalse) {
$aone=3Darray();
$ftype =3D strtolower(pathinfo("uploads/".$newpic1->name,PATHINFO_EXTENSION=
));
if($ftype=3D=3D"jpg"||$ftype=3D=3D"png"||$ftype=3D=3D"jpeg"||$ftype=3D=3D"g=
if") {
$imgsize =3D getimagesize("uploads/".$newpic1->name);
$width=3D$imgsize[0];
$height=3D$imgsize[1];
if($width>450) {
$width=3D450;
}
$msg->text.=3D"<p></p><img src=3D'uploads/".$newpic1->name."' onerror=3D'im=
gError(this);' style=3D'width: ".$width."px;' >";
} else {
$msg->text.=3D"<p></p><a class=3D'file1' href=3D'uploads/".$newpic1->name."=
'>File: ".$newpic1->name."</a>";
}
$aone[]=3D$msg;
$tabls[]=3D$aone;
$myd->dtables=3D$tabls;
$myd->saveobjecttable("Msg");
} else {
$ftype =3D strtolower(pathinfo("uploads/".$newpic1->name,PATHINFO_EXTENSION=
));
if($ftype=3D=3D"jpg"||$ftype=3D=3D"png"||$ftype=3D=3D"jpeg"||$ftype=3D=3D"g=
if") {
$imgsize =3D getimagesize("uploads/".$newpic1->name);
$width=3D$imgsize[0];
$height=3D$imgsize[1];
if($width>450) {
$width=3D450;
}
$msg->text.=3D"<p></p><img src=3D'uploads/".$newpic1->name."' onerror=3D'im=
gError(this);' style=3D'width: ".$width."px;'/>";
} else {
$msg->text.=3D"<p></p><a class=3D'file1' href=3D'uploads/".$newpic1->name."=
'>File: ".$newpic1->name."</a>";
}
$tabls[$msgtidx][]=3D$msg;
$myd->dtables=3D$tabls;
$myd->saveobjecttable("Msg");
}
} else if (strlen(trim($msg1)) !=3D 0&&$pic_uploaded=3D=3Dfalse) {
if($texists=3D=3Dfalse) {
$aone=3Darray();
$aone[]=3D$msg;
$tabls[]=3D$aone;
$myd->dtables=3D$tabls;
$myd->saveobjecttable("Msg");
} else {
$tabls[$msgtidx][]=3D$msg;
$myd->dtables=3D$tabls;
$myd->saveobjecttable("Msg");
}
}
$t2=3D$myd->query("get text from Msg;");
for($i=3D0; $i<count($t2); $i++) {
$oput.=3D$t2[$i]."<p></p>";
}
} else {
if($texists=3D=3Dtrue) {
$t2=3D$myd->query("get text from Msg;");
for($i=3D0; $i<count($t2); $i++) {
$oput.=3D$t2[$i]."<p></p>";
}
}
}
?>
<div class=3D"a1" spellcheck=3D"false">
<?php echo $oput;
?>
</div>
<p></p>
<form method=3D"POST" enctype=3D"multipart/form-data">
<input name=3D"myname" id=3D"myname" type=3D"hidden" value=3D"<?php echo $m=
yname; ?>"/>
<p class=3D"main2">Nimi: <input name=3D"text0" id=3D"text0" type=3D"text"
style=3D"width: 114px;" value=3D"<?php echo $name1; ?>"> </p>
<p class=3D"main2">S=C4=81=E2=80=9D=C2=9C=C3=84=E2=80=9Enum:</p>
<textarea class=3D"text1" name=3D"text1" id=3D"text1" type=3D"text">
</textarea>
<p></p>
<p class=3D"main5">Pilt v=C4=81=E2=80=9D=C2=9C=C3=84=E2=80=9Ei muud t=C4=81=
=E2=80=9D=C2=9C=C4=81=E2=80=A2=C2=AF=C4=81=E2=80=9D=C2=9C=C4=81=E2=80=A2=C2=
=AFpi fail (kuni 5 mb'd):</p>
<input type=3D"file" class=3D"main4" name=3D"fileToUpload" id=3D"fileToUplo=
ad"/>
<p></p>
<p></p>
<p></p>
<p class=3D"main5">Mini pilt (kuni 5 mb'd):</p>
<input type=3D"file" class=3D"main4" name=3D"fileToUpload2" id=3D"fileToUpl=
oad2"/>
<input type=3D"submit" name=3D"submit" class=3D"main3" value=3D"Saada"/>
</form>
<p></p>
<p class=3D"main2">Aktiivsed:</p>
<div class=3D"main2" id=3D"ilist">
</div>
<script>
function nl2br (str, is_xhtml) {
if (typeof str =3D=3D=3D 'undefined' || str =3D=3D=3D null) {
return '';
}
var breakTag =3D (is_xhtml || typeof is_xhtml =3D=3D=3D 'undefined') ? '<br=
/>'
: '<br>';
return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' +
breakTag + '$2');
}
if (!String.prototype.unescapeHTML) {
String.prototype.unescapeHTML =3D function() {
return this.replace(/&[#\w]+;/g, function (s) {
var entityMap =3D {
"&": "&",
"<": "<",
">": ">",
'"': '"',
''': "'",
'/': "/",
' ': " "
};
return entityMap[s];
});
};
}
var prevr=3D"";
var r0=3D"";
function renewing() {
var xmlhttp =3D new XMLHttpRequest();
xmlhttp.onreadystatechange =3D function() {
if (xmlhttp.readyState =3D=3D XMLHttpRequest.DONE) {
if (xmlhttp.status =3D=3D 200) {
xmlhttp.responseText=3Dnl2br(xmlhttp.responseText);
var a111=3Dxmlhttp.responseText;
r0=3Da111;
a111=3Da111.unescapeHTML();
document.getElementsByClassName("a1")[0].innerHTML =3D a111;
}
else if (xmlhttp.status =3D=3D 400) {
alert('Error 400');
}
else {
alert('Not 200 returned');
}
}
};
var d765=3Dnew Date();
xmlhttp.open("GET", "renewing.php?d=3D"+d765, false);
xmlhttp.setRequestHeader('Cache-Control', 'no-cache');
xmlhttp.send();
if(prevr!=3Dr0) {
a00000();
}
prevr=3Dr0;
}
function renewingilist() {
var xmlhttp =3D new XMLHttpRequest();
xmlhttp.onreadystatechange =3D function() {
if (xmlhttp.readyState =3D=3D XMLHttpRequest.DONE) {
if (xmlhttp.status =3D=3D 200) {
document.getElementById("ilist").innerHTML =3D xmlhttp.responseText;
}
else if (xmlhttp.status =3D=3D 400) {
alert('Error 400');
}
else {
alert('Not 200 returned');
}
}
};
var d765=3Dnew Date();
xmlhttp.open("GET", "ilist.php?d=3D"+d765, false);
xmlhttp.setRequestHeader('Cache-Control', 'no-cache');
xmlhttp.send();
}
function a00000() {
var textarea =3D document.getElementsByClassName("a1")[0];
textarea.scrollTop =3D 50000000;
}
setInterval(function(){
renewing();
}, 1578);
setInterval(function(){
renewingilist();
}, 3953);
setInterval(function(){
var namearea =3D document.getElementById("text0");
var isFocused =3D (document.activeElement =3D=3D=3D namearea);
if(isFocused) {
} else {
document.getElementById('text1').focus();
}
}, 6871);
</script>
</body>
</html>
renewing.php
<?php
include("../data.php");
class Msg extends Dobj{
var $text;
}
$myd=3Dnew Data();
$myd->loadobjecttables();
$texists=3Dfalse;
$t1=3D$myd->dtables;
for($i=3D0; $i<count($t1);$i++) {
if($t1[$i][0]->getNameOfClass()=3D=3D"Msg") {
$texists=3Dtrue;
break;
}
}
if($texists=3D=3Dtrue) {
$t2=3D$myd->query("get text from Msg;");
for($i=3D0; $i<count($t2);$i++) {
echo $t2[$i]."<p></p>";
}
} else {
}
?>
data.php
<?php
class Dobj {
function getNameOfClass()
{
return static::class;
}
}
class Data {
var $dtables;
function gettime() {
return date("d.m.Y H:i:s");
}
function loadobjecttables() {
$dtables =3D array();
foreach (glob("*.dat") as $file) {
$path_parts =3D pathinfo($file);
if(!class_exists($path_parts['filename'])) {
continue;
}
$file1 =3D file_get_contents($file, true);
$dtables[] =3D unserialize($file1);
}
$this->dtables=3D$dtables;
}
function deleteotable($otabname) {
if (file_exists($otabname.".dat")) {
unlink($otabname.".dat");
}
$this->loadobjecttables();
}
function insertobject($obj) {
$this->loadobjecttables();
$oclass=3D$obj->getNameOfClass();
$tabls=3D$this->dtables;
$oarridx=3D-1;
for($i=3D0; $i<count($tabls); $i++) {
if($tabls[$i][0]->getNameOfClass()=3D=3D$oclass) {
$oarridx=3D$i;
}
}
if($oarridx=3D=3D-1) return false;
$tabls[$oarridx][]=3D$obj;
unlink($oclass.".dat");
$b=3Dserialize($tabls[$oarridx]);
$fh =3D fopen($oclass.".dat", "a");
fwrite($fh, $b);
fclose($fh);
chmod($oclass.".dat", 0700);
}
function saveobjecttables() {
$tabls=3D$this->dtables;
for($i=3D0; $i<count($tabls); $i++) {
$oc=3D$tabls[$i][0]->getNameOfClass();
if (file_exists($oc.".dat")) {
unlink($oc.".dat");
}
$b=3Dserialize($tabls[$i]);
$fh =3D fopen($oc.".dat", "a");
fwrite($fh, $b);
fclose($fh);
chmod($oc.".dat", 0700);
}
return true;
}
function saveobjecttable($objcl) {
$tabls=3D$this->dtables;
$obclindex=3D-1;
for($i=3D0; $i<count($tabls); $i++) {
if($tabls[$i][0]->getNameOfClass()=3D=3D$objcl) {
$obclindex=3D$i;
break;
}
}
if (file_exists($objcl.".dat")) {
unlink($objcl.".dat");
}
$b=3Dserialize($tabls[$obclindex]);
$fh =3D fopen($objcl.".dat", "a");
fwrite($fh, $b);
fclose($fh);
chmod($objcl.".dat", 0700);
return true;
}
function makearrayunique($array){
$duplicate_keys =3D array();
$tmp =3D array();
foreach ($array as $key =3D> $val){
if (is_object($val))
$val =3D (array)$val;
if (!in_array($val, $tmp))
$tmp[] =3D $val;
else $duplicate_keys[] =3D $key;
}
foreach ($duplicate_keys as $key)
unset($array[$key]);
return $array;
}
function deleteduplicates() {
$ob=3D$this->dtables;
for($i=3D0; $i<count($ob); $i++) {
$o12=3D$this->makearrayunique($ob[$i]);
$ob[$i]=3D$o12;
}
$this->saveobjecttables();
}
function deleteduplicatescl($objcl) {
$ob=3D$this->dtables;
$obclindex=3D-1;
for($i=3D0; $i<count($ob); $i++) {
if($ob[$i][0]->getNameOfClass()=3D=3D$objcl) {
$obclindex=3D$i;
break;
}
}
$o12=3D$this->makearrayunique($ob[$obclindex]);
$ob[$obclindex]=3D$o12;
$this->dtables=3D$ob;
$this->saveobjecttable($objcl);
}
function objectClassestoarray($objectA,
$objectB) {
$new_object =3D array();
foreach($objectA as $property =3D> $value) {
$new_object[$property]=3D$value;
}
foreach($objectB as $property =3D> $value) {
$new_object[$property]=3D$value;
}
return $new_object;
}
function query($query) {
$this->loadobjecttables();
$ovars=3Darray();
$objects=3D$this->dtables;
for($i=3D0; $i<count($objects); $i++) {
$ovars[]=3Darray_keys(get_object_vars($objects[$i][0]));
}
$mches=3Darray();
$results=3Dnull;
$exitf=3Dfalse;
for($i=3D0; $i<count($objects); $i++) {
if($exitf) break;
for($j=3D0; $j<count($ovars); $j++) {
if($exitf) break;
if(!class_exists($objects[$i][0]->getNameOfClass())) continue;
if(preg_match("/^get \* from ".$objects[$i][0]->getNameOfClass().";$/",$que=
ry)) {
$objectsList =3D [];
foreach ($objects[$i] as $obj) {
$objectsList[] =3D (array)$obj;
}
return $objectsList;
$exitf=3Dtrue;
}
}
}
for($i=3D0; $i<count($objects); $i++) {
if($exitf) break;
for($j=3D0; $j<count($ovars); $j++) {
if($exitf) break;
if(!class_exists($objects[$i][0]->getNameOfClass())) continue;
if(preg_match("/^get ".$ovars[$i][$j]." from ".$objects[$i][0]->getNameOfCl=
ass().";$/",$query)) {
return array_column($objects[$i], $ovars[$i][$j]);
$exitf=3Dtrue;
}
}
}
$outp=3Darray();
for($i=3D0; $i<count($objects); $i++) {
if($exitf) break;
for($j=3D0; $j<count($ovars[$i]); $j++) {
if($exitf) break;
for($k=3D0; $k<count($objects); $k++) {
if($exitf) break;
for($l=3D0; $l<count($ovars[$k]); $l++) {
if($exitf) break;
if(!class_exists($objects[$i][0]->getNameOfClass())) continue;
if(!class_exists($objects[$k][0]->getNameOfClass())) continue;
if(preg_match("/^get \* from ".$objects[$i][0]->getNameOfClass()." join ".$=
objects[$k][0]->getNameOfClass().
" on \(".$objects[$i][0]->getNameOfClass()."\.".$ovars[$i][$j]."\=3D".$obje=
cts[$k][0]->getNameOfClass().
"\.".$ovars[$k][$l]."\);$/",$query)) {
for($ii=3D0; $ii<count($objects[$i]); $ii++) {
for($ii2=3D0; $ii2<count($objects[$k]);$ii2++) {
if($objects[$i][$ii]->{$ovars[$i][$j]}=3D=3D$objects[$k][$ii2]->{$ovars[$k]=
[$l]}) {
$oobj =3D $this->objectClassestoarray($objects[$i][$ii], $objects[$k][$ii2]=
);
$outp[]=3D$oobj;
}
}
}
$exitf=3Dtrue;
}
}
}
}
}
for($k=3D0; $k<count($objects); $k++) {
if($exitf) break;
for($l=3D0; $l<count($ovars[$k]); $l++) {
if($exitf) break;
for($l2=3D0; $l2<count($ovars[$k]); $l2++) {
if($exitf) break;
if(!class_exists($objects[$k][0]->getNameOfClass()))
continue;
if(preg_match("/^get \* from ".$objects[$k][0]->getNameOfClass()." where ".=
$ovars[$k][$l]."\=3D(.*) and ".$ovars[$k][$l2]."\=3D(.*);$/",$query, $match=
es)) {
for($ii2=3D0;
$ii2<count($objects[$k]); $ii2++) {
if($objects[$k][$ii2]->{$ovars[$k][$l]}=3D=3D$matches[1]&&$objects[$k][$ii2=
]->{$ovars[$k][$l2]}=3D=3D$matches[2]) {
$oobj =3D (array)$objects[$k][$ii2];
$outp[]=3D$oobj;
}
}
$exitf=3Dtrue;
}
}
}
}
for($k=3D0; $k<count($objects); $k++) {
if($exitf) break;
for($l=3D0; $l<count($ovars[$k]); $l++) {
if($exitf) break;
if(!class_exists($objects[$k][0]->getNameOfClass())) continue;
if(preg_match("/^get \* from ".$objects[$k][0]->getNameOfClass()." where ".=
$ovars[$k][$l]."\=3D(.*);$/",$query, $matches)) {
for($ii2=3D0; $ii2<count($objects[$k]); $ii2++) {
if($objects[$k][$ii2]->{$ovars[$k][$l]}=3D=3D$matches[1]) {
$oobj =3D (array)$objects[$k][$ii2];
$outp[]=3D$oobj;
}
}
$exitf=3Dtrue;
}
}
}
if(count($outp)>0) {
return $outp;
}
return $mches;
}
}
?>
findlastmdate.php
<?php
include("../data.php");
class Msg extends Dbobj{
var $text;
}
$myd=3Dnew Data();
$myd->loadobjecttables();
$texists=3Dfalse;
$t1=3D$myd->dtables;
$mdates=3Darray();
for($i=3D0; $i<count($t1);$i++) {
if($t1[$i][0]->getNameOfClass()=3D=3D"Msg") {
$texists=3Dtrue;
break;
}
}
if($texists=3D=3Dtrue) {
$t2=3D$mydb->query("get text from Msg;");
for($i=3D0; $i<count($t2);$i++) {
$date12=3Ddate("d.m.Y H:i:s", strtotime(substr($t2[$i], 0, 19)));
$d_start =3D new DateTime($date12);
$mdates[]=3D$d_start;
}
echo $mdates[count($mdates)-1]->format('d.m.Y H:i:s');;
} else {
echo "";
}
?>
func.php
<?php
function rrmdir($dir) {
$files =3D array_diff(scandir($dir), array('.','..'));
foreach ($files as $file) {
(is_dir("$dir/$file")) ? rrmdir("$dir/$file") : unlink("$dir/$file");
}
return rmdir($dir);
}
?>