Visualizzazione dei risultati da 1 a 9 su 9
  1. #1
    Utente di HTML.it
    Registrato dal
    Nov 2006
    Messaggi
    656

    script per upload e exec

    ciauz!!

    ho trovato questo script su internet, ma siccome era tutto attacato, ho dovuto darli una sitemata.
    ora non so se a causa mia o per è scritto male non va.

    potreste darmi un occhiata?
    inoltre visto che esegue un comando exec potete darmi qualche dritta??

    Codice PHP:
    <?php ini_set"max_execution_time""3600" ); // sets the maximum execution time of this script to 1 hour. 
    $fileName $_FILES['message']['name']; // get client side file name 
    if( $fileName ) { // Check File Type
     
    $fileNameParts explode"."$fileName ); // seperate the name from the ext
      
    $fileExtension end$fileNameParts ); // part behind last dot 
      
    $fileExtension strtolower$fileExtension ); // reduce to lower case 
      
    if( !$fileExtension == "mp3" ) { die( "$fileName is not an mp3 file." ); } // Check File Size 
      
    $fileSize $_FILES['message']['size']; // size of uploaded file 
      
    if( $fileSize == ) { die( "Sorry. The upload of $fileName has failed. The file size is 0." ); } else if( $fileSize 10240000 ) { //10 MB
       
    die( "Sorry. The file $fileName is larger than 10MB. Advice: reduce the file quality and upload again." ); } else { $uploadDir '/var/www/vhosts/yourdomain.com/httpdocs/audio/audio_to_encode/'// Where the temp file will go 
       
    $uploadFile str_replace" """$uploadDir $_FILES['message']['name'] ); // Get rid of spaces in the filename 
       
    $finalDir '/var/www/vhosts/yourdomain.com/httpdocs/audio/flv_files/'// Where the final file will go
        
    $finalFile str_replace" """$finalDir $fileNameParts[0] . ".flv" ); // Get rid of spaces in the filename 
        
    if ( !move_uploaded_file$_FILES['message']['tmp_name'], $uploadFile ) ) { echo "Possible file upload attack! Here's some debugging info:\n"; echo( $_FILES ); } $encode_cmd "/usr/bin/ffmpeg -i $uploadFile -f flv -acodec mp3 -ab 64 -ac 1 -title \"Clip Title\" -author \"Clip Author\" -copyright \"Clip Copyright\" $finalFile"exec$encode_cmd ); unlink$uploadFile ); chmod$finalFile0644 ); } } ?>

  2. #2
    che errore restituisce?

  3. #3
    Utente di HTML.it
    Registrato dal
    Nov 2006
    Messaggi
    656
    ovvimante prima lo tutto settato.

    comunque niente da pagina bianca.

  4. #4
    prova così
    Codice PHP:
    <?php
     ini_set
    "max_execution_time""3600" ); // sets the maximum execution time of this script to 1 hour.
    $fileName $_FILES['message']['name']; // get client side file name
    if( $fileName ) { // Check File Type
      
    $fileNameParts explode"."$fileName ); // seperate the name from the ext
      
    $fileExtension end$fileNameParts ); // part behind last dot
      
    $fileExtension strtolower$fileExtension ); // reduce to lower case
      
    if( $fileExtension != "mp3" ) { die( "$fileName is not an mp3 file." ); } // Check File Size
      
    $fileSize $_FILES['message']['size']; // size of uploaded file
      
    if( $fileSize == ) { die( "Sorry. The upload of $fileName has failed. The file size is 0." ); } else if( $fileSize 10240000 ) { //10 MB
       
    die( "Sorry. The file $fileName is larger than 10MB. Advice: reduce the file quality and upload again." ); } else { $uploadDir '/var/www/vhosts/yourdomain.com/httpdocs/audio/audio_to_encode/'// Where the temp file will go
       
    $uploadFile str_replace" """$uploadDir $_FILES['message']['name'] ); // Get rid of spaces in the filename
       
    $finalDir '/var/www/vhosts/yourdomain.com/httpdocs/audio/flv_files/'// Where the final file will go
        
    $finalFile str_replace" """$finalDir $fileNameParts[0] . ".flv" ); // Get rid of spaces in the filename
        
    if ( !move_uploaded_file$_FILES['message']['tmp_name'], $finalFile ) ) { echo "Possible file upload attack! Here's some debugging info:\n"; echo( $_FILES ); } 
        
    $encode_cmd "/usr/bin/ffmpeg -i $uploadFile -f flv -acodec mp3 -ab 64 -ac 1 -title \"Clip Title\" -author \"Clip Author\" -copyright \"Clip Copyright\" $finalFile";
         
    exec$encode_cmd );
         
    unlink$uploadFile );
         
    chmod$finalFile0644 ); } } ?>
    il form comè?

  5. #5
    Utente di HTML.it
    Registrato dal
    Nov 2006
    Messaggi
    656
    adesso provo

    codice:
    <form action="upload2.php" method="post" enctype="multipart/form-data"> <input type="file" name="miofile" size="42"> <input type="submit" name="submit" value="Submit"> </form>

  6. #6
    Utente di HTML.it
    Registrato dal
    Nov 2006
    Messaggi
    656
    ok,

    almeno adesso mi rstituisce qualcosa.

    andiamo per passi.

    io devo far caricare video, quindi dovrei far caricare file avi o mpeg o asf.

    quindi devo cambiare questa riga in cosa?

    Codice PHP:
    if( $fileExtension != "mp3" ) { die( "$fileName is not an mp3 file." ); } // Check File Size 
    poi vedremo altro.

  7. #7
    if( $fileExtension != "avi" AND $fileExtension != "mpeg" AND $fileExtension != "asf" ) { die( "L'estensione nn corrisponde con quelli ammessi" ); } // Check File Size

  8. #8
    Utente di HTML.it
    Registrato dal
    Nov 2006
    Messaggi
    656
    ultimissima cosa:

    dove piazzo un header(location

    per reidirizzare a operazione completata??

    grazie mille!

  9. #9
    fai così
    if ( !move_uploaded_file( $_FILES['message']['tmp_name'], $finalFile ) ) { echo "Possible file upload attack! Here's some debugging info:\n"; echo( $_FILES ); } else{ header() ; }

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.