403Webshell
Server IP : 80.241.246.6  /  Your IP : 216.73.216.188
Web Server : Apache/2.4.25 (Debian)
System : Linux kharagauli 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64
User : www-data ( 33)
PHP Version : 7.0.33-0+deb9u12
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/kharagauli1/moduls/video_gallery_big_2/site/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/kharagauli1/moduls/video_gallery_big_2/site/post.php
<?php
/*
@author suxoza <suxoza@gmail.com>
*/
if(realpath(__FILE__) == realpath($_SERVER['SCRIPT_FILENAME']))die("__main__ ".__FILE__);
      try{
        if(!isset($url[2]) || !is_numeric($url[2]))throw new Exception("bad uri format!!!");    
      }catch(Exception $exc) {
        die($exc->getMessage());
      }
     
         echo "<body style='width: 100%;height: 100%;background:url(/img/ajax-loader.gif) no-repeat;background-position:50% 50%;background-size:200px 200px'><script>";

   
       $dir_name = explode('/',realpath(__FILE__));
       array_pop($dir_name);
       $python = join('/',$dir_name);
       define("PYTHON",((file_exists($python.'/screen_video.py'))?$python.'/screen_video.py':''));
       
        $youtube_bool = FALSE;
        if(file_exists($python.'/youtube/maines.php')){
           require $python.'/youtube/maines.php'; 
           $youtube_bool = TRUE;                     

         }
         

        
        if(in_array('new', $url)){
                $insert = ['page_id','page_count','date'];
                $value  = [$select_menu['id'],$_->clier($_POST['page_count']),time()];
                for($i = 0; $i < count($_->language_config); $i++){
                     $insert[] = "name_".$_->language_config[$i];
                     $value[] = $_->clier($_POST['alboum_name_'.$_->language_config[$i]]);
                }
                if($_->insert("body",[$insert,$value]))$for_def = $_->con->lastInsertId();  
                else die("error while insert!!!");  
                _inserts($_,$for_def,$youtube_bool,$url);
            
        }elseif(in_array('more', $url)){
            if(!isset($url[4]) || !is_numeric($url[4]))die("bad uri format!!!");  
            $for_def = $url[4];
            $select_body = $_->select("*","body","big",["page_id",$for_def]);  
            $select_body = (isset($select_body['body']) && count($select_body['body']))?$select_body['body']:FALSE;   
            deletes($_);
            
            
            

            saves($_,$for_def,$select_body,$youtube_bool,$url);
        }
        
        define('FOR_DEF',$for_def);
       
    $navig_name = '/'.$url[1].'/'.$url[2];

    function location($a,$navig_name,$_){
         if(!$a)return $_SERVER['HTTP_REFERER'];
         elseif($a == 1)return $navig_name;
         elseif($a == 2)return $navig_name.'/more/'.FOR_DEF;
     }  
    
   $A_CH = in_array('new', $url)?'added':'changed';  
     
    header("Location:".location($_POST['added_params'],$navig_name,$_,FOR_DEF).$_COOKIE['location_href_menu']."/".$A_CH."/");
     ///echo "location.href='".."';</script></body>";
    exit;
    
    
  
   
  function saves($_,$for_def,$select_body,$youtube_bool,$url){ 
   if(count($_FILES)){

       foreach($_FILES as $key => $value){
           
           $_file = '';
           $_attribute = '';
           $_unikal = '';
           $post_key = substr($key,0,-2);
           $iterator = ($key != 'file')?explode('_', $key)[1]:'';
           

           
           if($key == 'file'){
              big_file($_FILES['file'],$for_def,$_);
           }else{

               if($_FILES[$key]['name']){
                $file_name = str_replace(' ','_',$key).'_'.time().'_';
                $end = explode('.',$_FILES[$key]['name'])[count(explode('.',$_FILES[$key]['name'])) - 1]; 
                 $saved_image = save_images($_FILES[$key],$file_name,$end,$_); 
                 if($saved_image){
                     $_attribute = $saved_image;
                     $saved_image = json_decode($saved_image);
                     $_file = $saved_image->file_name;
                 }    
                 if(isset($_POST['id_'.$iterator])){
                     $f = finder($select_body,'id',$_POST['id_'.$iterator],'logo',$_);
                     if(!$_->startsWith($f,'http'))delete_old_file($f,$_);   
                 }             
               }else{
                   $f = false;
                   if(isset($_POST[$post_key]) && $_POST[$post_key]){
                     if(isset($_POST['id_'.$iterator]))   
                        $f = finder($select_body,'id',$_POST['id_'.$iterator],'logo',$_);
                       
                       
                       if($_->startsWith($_POST[$post_key],'file_')){
                          $_file = $_POST[$post_key]; 
                          $_attribute = finder($select_body,'id',$_POST['id_'.$iterator],'attributes',$_);
                       }elseif($_->startsWith($_POST[$post_key],'http')){
                                $_file = $_POST[$post_key]; 
                                $_attribute = finder($select_body,'id',$_POST['id_'.$iterator],'attributes',$_);
                                $_unikal    = finder($select_body,'id',$_POST['id_'.$iterator],'unikal_key',$_);
                                if($f)delete_old_file($f,$_);
                          
                       }else{
                            if($f)delete_old_file($f,$_);
                            if($youtube_bool){
                                     $youtube_class = new vv($_POST[$post_key]);
                                     $youtube_best = $youtube_class->getbest('mp4');
                                     $_file = $youtube_best->image?$youtube_best->image:$youtube_best->thumb;
                                     $_unikal = $youtube_best->videoid;
                                     $_attribute = Central::_json_encode($youtube_best);
                            }
                       } 
                   }
               }
               insert_update($_,$key,$url,$_file,$_attribute,$_unikal,$iterator,$for_def);
           }
           
       }
      
   $insert_big = ['page_count'];
   $value_big  = [$_->select("id","body","count",["page_id",$for_def])];
    for($i = 0; $i < count($_->language_config); $i++){
      $insert_big[] = "name_".$_->language_config[$i];
      $value_big[]  = $_->clier($_POST['alboum_name_'.$_->language_config[$i]]);
    } 
    $_->update("body",[$insert_big,$value_big,["id",$for_def]]);       
       
      
   }
 } 
 
 
function _inserts($_,$for_def,$youtube_bool,$url){ 
   if(count($_FILES)){
//$_->pre($_POST);
//$_->pre($_FILES);
       foreach($_FILES as $key => $value){
           
           $_file = '';
           $_attribute = '';
           $_unikal = '';
           $post_key = substr($key,0,-2);
           $iterator = ($key != 'file')?explode('_', $key)[1]:'';
           

           
           if($key == 'file'){
              big_file($_FILES['file'],$for_def,$_);
           }else{

               if($_FILES[$key]['name']){
                $file_name = str_replace(' ','_',$key).'_'.time().'_';
                $end = explode('.',$_FILES[$key]['name'])[count(explode('.',$_FILES[$key]['name'])) - 1]; 
                 $saved_image = save_images($_FILES[$key],$file_name,$end,$_); 
                 if($saved_image){
                     $_attribute = $saved_image;
                     $saved_image = json_decode($saved_image);
                     $_file = $saved_image->file_name;
                 }            
               }else{
                   if(isset($_POST[$post_key]) && $_POST[$post_key]){
                    
                            if($youtube_bool){
                                     $youtube_class = new vv($_POST[$post_key]);
                                     $youtube_best = $youtube_class->getbest('mp4');
                                     $_file = $youtube_best->image?$youtube_best->image:$youtube_best->thumb;
                                     $_unikal = $youtube_best->videoid;
                                     $_attribute = Central::_json_encode($youtube_best);
                            }
                     
                   }
               }
               insert_update($_,$key,$url,$_file,$_attribute,$_unikal,$iterator,$for_def);
           }
           
       }    
            $insert_big = ['page_count'];
            $value_big  = [$_->select("id","body","count",["page_id",$for_def])];
             for($i = 0; $i < count($_->language_config); $i++){
               $insert_big[] = "name_".$_->language_config[$i];
               $value_big[]  = $_->clier($_POST['alboum_name_'.$_->language_config[$i]]);
             } 
             $_->update("body",[$insert_big,$value_big,["id",$for_def]]);   
      
   }
 }  
 
 
 
  function big_file($files,$url,$_){
      $length = count($files['name']);
      if(!isset($files['name'][0]) || !$files['name'][0])return;
      if(!$length)return;
      $insert = ['page_id','attributes','logo','page_date','date_modify','date'];
      
      for($i = 0; $i < $length; $i++){
        $_file = '';
        $file_name = 'file_'.time().'_'.$i;
        $end = explode('.',$files['name'][$i])[count(explode('.',$files['name'][$i])) - 1];    
        $saved_image = save_images($files['tmp_name'][$i],$file_name,$end,$_,0); 
        //$_->pre($saved_image);
        if($saved_image)$_file = json_decode($saved_image); 
         $value  = [$url,Central::_json_encode($_file),$_file->file_name,time(),time(),time()];
         $_->insert("body",[$insert,$value]);     
      }
  } 
   
  function insert_update($_,$key,$url,$_file,$_attribute,$_unikal,$iterator,$for_def){
       $value = insert_values($_,$_file,$_attribute,$_unikal,$iterator);
       if(isset($_POST['id_'.$iterator])){
           $value[2] = ["id",$_POST['id_'.$iterator]];
           $_->update("body",$value);
       }else{
           array_push($value[0],'page_id','date');
           array_push($value[1],$for_def,time()); 
           $_->insert("body",$value);
       }
       
   }  
   
  function insert_values($_,$_file,$_attribute,$_unikal,$iterator){
         $insert = ['logo','attributes','unikal_key','page_date','date_modify'];
         $value  = [$_file,$_attribute,$_unikal,time(),time()];
         for($i = 0; $i < count($_->language_config); $i++){
              $insert[] = "body_".$_->language_config[$i];
              $value[] = $_->clier($_POST['title_'.$_->language_config[$i].'_'.$iterator]);
         }
         return [$insert,$value];
   }
   
   
   
   
   function finder($array,$key,$value,$needed,$_){
       $length = count($array);
       if(!$length)return '';
       for($i = 0; $i < $length; $i++){
           if($array[$i][$key] == $value){
               return $array[$i][$needed];
           }     
       }
   }
   

   function getid($url){
      preg_match("#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=v\/)[^&\n]+(?=\?)|(?<=v=)[^&\n]+|(?<=youtu.be/)[^&\n]+#", $url, $matches);
      return $matches[0];  
   }

   function save_images($image,$file_name,$end,$_,$bool = 1){
       $upl = ($bool)?$image['tmp_name']:$image;
       if(move_uploaded_file($upl, $_->_dir.'img/banners/video/'.$file_name.'.'.$end)){
           if(PYTHON){
               $command = 'python '.PYTHON.' '.$_->_dir.'img/banners/video/'.$file_name.'.'.$end.' '.$_->_dir.'img/banners/video/img/'.$file_name.'.jpg';
                if(function_exists('popen')){
                    $handle = popen($command,"r");
                    $read = fread($handle, 1024);
                    pclose($handle);
                    if(trim($read) && strpos($read, 'duration') !== false){
                        $_->main_images($file_name.'.jpg',$_->_dir.'img/banners/video/img',$_->_dir.'img/banners/video/img/small',$file_name,240,2);      
                         $json = json_decode($read);
                         $json->file_name = $file_name.'.'.$end;
                         return Central::_json_encode($json);
                    }
                }else echo 'alert("popen disabled");';
             return $file_name.'.'.$end;   
           }
           
       }
       return false;
    }
   
  function deletes($_){   
    if($_POST['deletes']){
        $delete = substr($_POST['deletes'], 0, -1);
        $delete = explode('|', $delete);
        $obj = new stdClass();
        $obj->c_type = "big";
        $obj->sql = " and id in(".join(",",$delete).")";
        $sel = $_->select("*","body",$obj)['body'];
        for($i = 0; $i < count($sel); $i++){
            $file = $sel[$i]['logo'];
            if(!$_->startsWith($file,'http'))
               delete_old_file($file,$_);
        }
        $sql = "delete from body where id in(".join(",",$delete).")";
        $_->con->exec($sql);
        //echo $sql;
    }
 }  
 
 function delete_old_file(&$file,$_){
        if($file){
            $image = str_replace('mp4', 'jpg', $file);
            if(file_exists($_->_dir.'img/banners/video/'.$file))@unlink($_->_dir.'img/banners/video/'.$file);
            if(file_exists($_->_dir.'img/banners/video/img/'.$image))@unlink($_->_dir.'img/banners/video/img/'.$image);
            if(file_exists($_->_dir.'img/banners/video/img/small/'.$image))@unlink($_->_dir.'img/banners/video/img/small/'.$image);
            $file = '';
        }
 }

   
   
   
    die();

    
    $iterator = 1;
    $_array = [];
    
    
   
  

    foreach($_POST as $key => $value){
        if($_->startsWith($key,'file_')){
          if(isset($_POST['title_'.$_->language_config[0].'_'.$iterator])){  
            $bool = (isset($_POST['id_'.$iterator]))?$_POST['id_'.$iterator]:'';
            $file = ($bool)?find_in_array($select_body,$bool):'';
            //echo $file."<br/>";
            //echo  ($bool)?'id_exists '.$iterator.'<br/>':'id_not_exists '.$iterator.'<br/>';
            if($value){
                
                delete_old_file($file,$_);
                
             if($_->startsWith($value,'http'))
                 copy_file($key,$value,$iterator,$_,$file);
              else if($_->startsWith($value,'data:'))
                 move_uploaded($key,$value,$iterator,$_,$file); 
            }
            
                $insert = ['logo','attributes','page_date','date_modify'];
                $value  = [$file,'',time(),time()];
                for($i = 0; $i < count($_->language_config); $i++){
                     $insert[] = "body_".$_->language_config[$i];
                     $value[] = $_->clier($_POST['title_'.$_->language_config[$i].'_'.$iterator]);
                }
                if(!$bool){
                   array_push($insert,'page_id','date');
                   array_push($value,$select_menu['id'],time());
                   $_->insert("body",[$insert,$value]);
                }else{ 
                   $_->update("body",[$insert,$value,["page_id",$select_menu['id'],"id",$bool]]);               
                }
            }
            $iterator++;    
        }
        
        
    }

 
    
   
 function copy_file($key,$file,$iterator,$_,&$_array){
     $masiv = explode('.',$file);
     $end = end($masiv);
     $file_name = str_replace(' ','_',$key).'_'.time().'_'.$iterator;
     if(copy($file,$_->_dir.'img/banners/'.$file_name.'.'.$end)){
         $_->main_images($file_name.'.'.$end,$_->_dir.'img/banners',$_->_dir.'img/banners/small',$file_name,240,2);
                 $_array = $file_name.'.'.$end;
     }
 }  
 
 function move_uploaded($key,$file,$iterator,$_,&$_array){   
    $file_name = str_replace(' ','_',$key).'_'.time().'_'.$iterator;
     if(substr($file,0,5) == 'data:'){
         $dat = explode(';',$file);
         $dat = explode('/',$dat[0]);
         $dat = str_replace('e','',$dat[1]);
         $data = base64_decode(str_replace(' ','+',explode(',', $file)[1]));
//        if(substr($file,5,5) == 'video'){
//            if(file_put_contents('img/video/'.$file_name.'.'.$dat,$data)){
//                  $file = 'img/video/'.$file_name.'.'.$dat;
//             }    
//         }
//         else
           if(substr($file,5,5) == 'image'){
             if(file_put_contents($_->_dir.'img/banners/'.$file_name.'.'.$dat,$data)){
                 $_->main_images($file_name.'.'.$dat,$_->_dir.'img/banners',$_->_dir.'img/banners/small',$file_name,240,2);
                 $_array = $file_name.'.'.$dat;
               }
            }
         }
 }
 

 
 function find_in_array($array,$id){
     if(!count($array))return '';
     $length = count($array);
     for($i = 0; $i < $length; $i++){
         if($array[$i]['id'] == $id)
             return $array[$i]['logo'];
     }return '';
 }
    
    
    header("Location:".$_SERVER['HTTP_REFERER'].$_COOKIE['location_href_menu']."/changed/");
    exit;
    
    
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    
    
    
    

//    $select_body = $_->select("logo","body","small",["page_id",$select_menu['id']]);
//    $_logo = $select_body;  
//    
//    if($_FILES['file']['name'] && preg_match('/[.](jpg)|(JPG)|(jpeg)|(JPEG)|(gif)|(GIF)|(png)|(PNG)$/',$_FILES['file']['name']))
//           $_logo = $_->upload_image($_FILES['file'],$_logo);
//    else{
//
//
//
//        if($_POST['delete_logo']){
//                if($_logo){
//                    if(file_exists($_->_dir.'img/banners/'.$_logo))@unlink($_->_dir.'img/banners/'.$_logo);
//                    if(file_exists($_->_dir.'img/banners/small/'.$_logo))@unlink($_->_dir.'img/banners/small/'.$_logo);
//                    $_logo = '';
//               }            
//        }
//    }   
//    $_time = 0;
//    if($_POST['time']){
//        list($day,$month,$year) = explode('/',$_->clier($_POST['time']));
//        $_time = mktime(0, 0, 0, $month, $day, $year);
//    }
//    
//    $insert = ['page_id','logo','attributes','page_date','date_modify'];
//    $value = [$select_menu['id'],$_logo,'',$_time,time()];
//    for($i = 0; $i < count($_->language_config); $i++){
//           $insert[] = "name_".$_->language_config[$i];
//           $insert[] = "body_".$_->language_config[$i];
//           $value[] = $_->clier($_POST['name_'.$_->language_config[$i]]);
//           $value[] = $_->clier($_POST['body_'.$_->language_config[$i]]);
//    }
//
//    
//    if($_->update("body",[$insert,$value,["page_id",$select_menu['id']]]))
//        header("Location:".$_SERVER['HTTP_REFERER'].$_COOKIE['location_href_menu']."/changed/");
//    else
//        die("insert error!!!!!");
    



?>

Youez - 2016 - github.com/yon3zu
LinuXploit