Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #14080

Re: Interaction with pictures or files and with self photo, made with php(programming language)

Newsgroups comp.programming
From Branimir Maksimovic <branimir.maksimovic@icloud.com>
Subject Re: Interaction with pictures or files and with self photo, made with php(programming language)
References <fd80e4b4-f405-4827-adeb-6e260be17f39n@googlegroups.com> <e9db8746-e24d-473c-bf2a-1ac02990c50cn@googlegroups.com>
Message-ID <c2xcJ.7325$LZ1.987@fx40.iad> (permalink)
Organization usenet-news.net
Date 2021-10-22 11:14 +0000

Show all headers | View raw


On 2021-10-22, Rich and beautiful man <ya12983@mail.com> wrote:
> Update of index2.php:
>
><?php
>
> include("func.php");
>
>
> $size = 0;
>
> $files = glob('uploads/*.*');
> usort($files, function($a, $b) {
> return filemtime($a) < filemtime($b);
> });
> $idx=0;
>
> $files = array_reverse($files, true);
>
> if(is_dir("uploads")) {
> foreach($files as $file) {
> if($idx==count($files)-1) break;
> $filesize = filesize($file);
> $size+=$filesize;
> $idx++;
> }
> $idx=0;
> if($size>5000000) {
> foreach($files as $file) {
> if($idx==count($files)-1) break;
> unlink($file);
> $idx++;
> }
> }
> }
Not nice.

>
>
> $size = 0;
>
> $files = glob('dpic/*.*');
> usort($files, function($a, $b) {
> return filemtime($a) < filemtime($b);
> });
> $idx=0;
>
> $files = array_reverse($files, true);
>
> if(is_dir("dpic")) {
> foreach($files as $file) {
> if($idx==count($files)-1) break;
> $filesize = filesize($file);
> $size+=$filesize;
> $idx++;
> }
> $idx=0;
> if($size>5000000) {
> foreach($files as $file) {
> if($idx==count($files)-1) break;
> unlink($file);
> $idx++;
> }
> }
> }
>

Why?

> 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=new Data();
>
> $myd->loadobjecttables();
>
>
> $itime2=$myd->gettime();
> $itime2=date( '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 = scandir("uploads");
>
> if(count($files1)>270) {
> rrmdir("uploads");
> mkdir("uploads", 0777);
> }
>
Ahahahahahahahhaha :P

>
>
> $msg=new Msg();
> $name1 = strip_tags($_POST['text0']);
>
> if($name1!="") {
> $name1=substr($name1,0, 646);
> }
>
> $addline=true;
>
> $tabls=$myd->dtables;
>
> $time=null;
> $tidx=-1;
> $nooutput=false;
> $oput="";
>
> $pwd1="";
>
> $newmessagenr=1;
> $newinumber=1;
>
>
> if($tabls!=null) {
> for($i=0; $i<count($tabls); $i++) {

stupid php programmer error.
Don't call count in a loop :P

> $oc=$tabls[$i][0]->getNameOfClass();
> if($oc=="Msg") {
>     $biggestnr=0;
>     for($j=0; $j<count($tabls[$i]); $j++) { 

ditto

>         if($tabls[$i][$j]->messagenumber>$biggestnr) $biggestnr=$tabls[$i][$j]->messagenumber;
>     }
>     $newmessagenr=$biggestnr+1;
> }
> }
> }

Awfully inefficient ...
don't want to look further :P
LOV|E&PEACE!


-- 

7-77-777
Evil Sinner!
with software, you repeat same experiment, expecting different results...

Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Interaction with pictures or files and with self photo, made with php(programming language) He <ya12983@mail.com> - 2021-10-15 00:16 -0700
  Re: Interaction with pictures or files and with self photo, made with php(programming language) Rich and beautiful man <ya12983@mail.com> - 2021-10-22 01:40 -0700
    Re: Interaction with pictures or files and with self photo, made with php(programming language) Branimir Maksimovic <branimir.maksimovic@icloud.com> - 2021-10-22 11:14 +0000
      Re: Interaction with pictures or files and with self photo, made with php(programming language) Ro Bam <uavyuayve@hotmail.com> - 2021-10-25 01:16 -0700
        Re: Interaction with pictures or files and with self photo, made with php(programming language) Roppam <ya12983@mail.com> - 2021-11-01 01:26 -0700
  Re: Interaction with pictures or files and with self photo, made with php(programming language) V <vvvvvvvvvvvvvv@mail.ee> - 2023-08-14 20:14 -0700

csiph-web