Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 12
  1. #1

    [Parse error: syntax error, unexpected $end] non riesco a trovare l'errore

    mi dà questo errore all'ultima riga

    [Parse error: syntax error, unexpected $end]

    dov'è il problema?

    Codice PHP:
    <?
    $password_hash
    =md5($password);
    $error="";$success="";
    $display_message="";
    $file_ext=array();
    $password_form="";
    // Function to get the extension a file.
    function get_ext($key
    {     
    $key=strtolower(substr(strrchr($key"."), 1));    $key=str_replace("jpeg","jpg",$key);
        return 
    $key;}
        
    // Filename security cleaning. Do not modify.
        
    function cln_file_name($string) {    
        
    $cln_filename_find=array("/\.[^\.]+$/""/[^\d\w\s-]/""/\s\s+/""/[-]+/""/[_]+/");    
        
    $cln_filename_repl=array(""""," ""-""_");
        
    $string=preg_replace($cln_filename_find$cln_filename_repl$string);    return trim($string);}
        
    // If a password is set, they must login to upload files.
        
    If($password) {        
        
    //Verify the credentials.    
        
    If($_POST['verify_password']==true) {        
        If(
    md5($_POST['check_password'])==$password_hash) {        
        
    setcookie("phUploader",$password_hash);    sleep(1);
         
    //seems to help some people.            
         
    header("Location: [url]http://[/url]".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']);        
         exit;        }    
         }    
         
    //Show the authentication form    
         
    If($_COOKIE['phUploader']!=$password_hash) {        
         
    $password_form="<form method=\"POST\" action=\"".$_SERVER['PHP_SELF']."\">\n";        
         
    $password_form.="<table align=\"center\" class=\"table\">\n";    
         
    $password_form.="<tr>\n";        
         
    $password_form.="<td width=\"100%\" class=\"table_header\" colspan=\"2\">Password Required</td>\n";        
         
    $password_form.="</tr>\n";        
         
    $password_form.="<tr>\n";        
         
    $password_form.="<td width=\"35%\" class=\"table_body\">Enter Password:</td>\n";        
         
    $password_form.="<td width=\"65%\" class=\"table_body\"><input type=\"password\" name=\"check_password\" /></td>\n";
         
    $password_form.="</tr>\n";        
         
    $password_form.="<td colspan=\"2\" align=\"center\" class=\"table_body\">\n";        
         
    $password_form.="<input type=\"hidden\" name=\"verify_password\" value=\"true\">\n";        
         
    $password_form.="<input type=\"submit\" value=\" Verify Password \" />\n";        
         
    $password_form.="</td>\n";        
         
    $password_form.="</tr>\n";        
         
    $password_form.="</table>\n";        
         
    $password_form.="</form>\n";    }    
         } 
         
    // If Password
         // Dont allow submit if $password_form has been populated
         
    If(($_POST['submit']==true) AND ($password_form=="")) {    
         
    //Tally the size of all the files uploaded, check if it's over the ammount.        
         
    If(array_sum($_FILES['file']['size']) > $max_combined_size*1024) {                
         
    $error.="[b]FAILED:[/b] All Files [b]REASON:[/b] Combined file size is to large.
    "
    ;            
         
    // Loop though, verify and upload files.    
         
    } Else {        
         
    // Loop through all the files.        
         
    For($i=0$i <= $file_uploads-1$i++) {                        
         
    // If a file actually exists in this key            
         
    If($_FILES['file']['name'][$i]) {                
         
    //Get the file extension                
         
    $file_ext[$i]=get_ext($_FILES['file']['name'][$i]);                                
         
    // Incremento del numero                    
         
    $counterfile 'counter.txt';
         If(
    $random_name){ $counter file_get_contents($counterfile); file_put_contents($counterfile, ++$counter); $file_name[$i]=$counter; } Else { $file_name[$i]=cln_file_name($_FILES['file']['name'][$i]); }                    
         
    // Check for blank file name                
         
    If(str_replace(" """$file_name[$i])=="") {                                        
         
    $error.= "[b]FAILED:[/b] ".$_FILES['file']['name'][$i]." [b]REASON:[/b] Blank file name detected.
    "
    ;
         
    //Check if the file type uploaded is a valid file type.                 
         
    }    ElseIf(!in_array($file_ext[$i], $allow_types)) {                                                    
         
    $error.= "[b]FAILED:[/b] ".$_FILES['file']['name'][$i]." [b]REASON:[/b] Invalide file type.
    "
    ;
         
    //Check the size of each file            
         
    } Elseif($_FILES['file']['size'][$i] > ($max_file_size*1024)) {                                        
         
    $error.= "[b]FAILED:[/b] ".$_FILES['file']['name'][$i]." [b]REASON:[/b] File to large.
    "
    ;    
         
    // Check if the file already exists on the server..                
         
    } Elseif(file_exists($folder.$file_name[$i].".".$file_ext[$i])) {                        
         
    $error.="Errore Lasslo";                                    
         } Else {                                        
         If(
    move_uploaded_file($_FILES['file']['tmp_name'][$i],$folder.$file_name[$i].".".$file_ext[$i])) {        
         
    $success.="[b]SUCCESS:[/b] ".$_FILES['file']['name'][$i]."
    "
    ;                        
         
    $success.="[b]URL:[/b] <a href=\"".$full_url.$file_name[$i].".".$file_ext[$i]."\" target=\"_blank\">".$full_url.$file_name[$i].".".$file_ext[$i]."</a>

    "
    ;
         } Else {                        
        
    $error.="[b]FAILED:[/b] ".$_FILES['file']['name'][$i]." [b]REASON:[/b] General upload failure.
    "
    ;                
        }                                    }                                        
        } 
    // If Files                
        
    // For            
        
    // Else Total Size        
        
    If(($error=="") AND ($success=="")) {        
        
    $error.="[b]FAILED:[/b] No files selected
    "
    ;    }    
        
    $display_message=$success.$error;} 
        
    // $_POST AND !$password_form/*//================================================================================* Start the form layout//================================================================================:- Please know what your doing before editing below. Sorry for the stop and start php.. people requested that I use only html for the form..*/
        // where ffmpeg is located, such as /usr/sbin/ffmpeg
        
    $ffmpeg 'ffmpeg';
        
    // the input video file
        
    $video  dirname(__FILE__) . "./uploads/".$file_name[$i].".".$file_ext[$i];    
        
    // where you'll save the image    
        
    $image  dirname(__FILE__) . "./thumbs/".$file_name[$i].".jpg";         
        
    // default time to get the image    
        
    $second 1;         
        
    // get the duration and a random place within that    
        
    $cmd "$ffmpeg -i $video 2>&1";    
        if (
    preg_match('/Duration: ((\d+):(\d+):(\d+))/s'"$cmd"
        
    $time)) {        
        
    $total = ($time[2] * 3600) + ($time[3] * 60) + $time[4];        
        
    $second rand(1, ($total 1));    
        }         
        
    // get the screenshot    
        
    $cmd "$ffmpeg -i $video -deinterlace -an -ss $second -t 00:00:01 -r 1 -y -vcodec mjpeg -f mjpeg $image 2>&1";    
        
    $return = `"$cmd";
        // done! [img]http://blog.amnuts.com/wp-includes/images/smilies/icon_wink.gif[/img]    
        ?>
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
        <head><meta http-equiv="Content-Language" content="en-us" /><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title><?php echo 
    $websitename; ?></title>
        <style type="text/css">    
        body{        background-color:#FFFFFF;        
        font-family: Verdana, Arial, sans-serif;        
        font-size: 12pt;        color: #000000;    }        
        .message {        
        font-family: Verdana, Arial, sans-serif;        
        font-size: 11pt;        
        color: #000000;        
        background-color:#EBEBEB;    }    
        a:link, a:visited {        
        text-decoration:none;        
        color: #000000;    }        
        a:hover {        
        text-decoration:none;        
        color: #000000;    }    
        .table {        
        border-collapse:collapse;        
        border:1px solid #000000;        
        width:450px;    }        
        .table_header {        
        border:1px solid #000000;        
        background-color:#C03738;        
        font-family: Verdana, Arial, sans-serif;        
        font-size: 11pt;        
        font-weight:bold;        
        color: #FFFFFF;        
        text-align:center;        
        padding:2px;    }        
        .upload_info {        
        border:1px solid #000000;        
        background-color:#EBEBEB;        
        font-family: Verdana, Arial, sans-serif;        
        font-size: 8pt;        
        color: #000000;        
        padding:4px;    }    
        .table_body {        
        border:1px solid #000000;        
        background-color:#EBEBEB;        
        font-family: Verdana, Arial, sans-serif;        
        font-size: 10pt;        
        color: #000000;        
        padding:2px;    }    
        .table_footer {        
        border:1px solid #000000;        
        background-color:#C03738;        
        text-align:center;        
        padding:2px;    }    
        input,select,textarea {        
        font-family: Verdana, Arial, sans-serif;        
        font-size: 10pt;        
        color: #000000;        
        background-color:#AFAEAE;        
        border:1px solid #000000;    }        
        .copyright {        
        border:0px;        
        font-family: Verdana, Arial, sans-serif;        
        font-size: 9pt;        
        color: #000000;        
        text-align:right;    }        
        form {        
        padding:0px;        
        margin:0px;    }
        </style>
        <?
        If(
    $password_form) {        
        Echo 
    $password_form;} 
        Else {?>
        <form action="<?
        
    $_SERVER = ['PHP_SELF'];
        ?>" method="post" enctype="multipart/form-data" name="phuploader">
        <table align="center" class="table">    
        <tr>
        <td class="table_header" colspan="2">[b]<?=
    $websitename;?>[/b] </td>
        </tr>    
        <?
        If(
    $display_message){?>
        <tr>
        <td colspan="2" class="message">        
                
        <?=
    $display_message;?>        
            </td>
        </tr><?
        }?>        
        <tr>
        <td colspan="2" class="upload_info">            [b]Allowed Types:[/b] <?=implode(
    $allow_types, ", ");?>
    [b]Max size per file:[/b]
         <?=
    $max_file_size?>kb.
                [b]Max size for all files combined:[/b] <?=
    $max_combined_size?>kb.
            </td>    
         </tr>    
         <?
         For(
    $i=0;$i <= $file_uploads-1;$i++) {
         ?>    
         <tr><td class="table_body" width="20%">[b]Select File:[/b] </td>
         <td class="table_body" width="80%"><input type="file" name="file[]" size="30" /></td>
         </tr>
         <?
         }?>
         <tr><td colspan="2" align="center" class="table_footer">
         <input type="hidden" name="submit" value="true" />
         <input type="submit" value=" Upload File(s) " />             
         <input type="reset" name="reset" value=" Reset Form " onclick="window.location.reload(true);" /></td>
         </tr></table></form>
        <?
        }
        //Please leave this here.. it really dosen't make people hate you or make your site look bad.. 
        ?>
    <table class="table" style="border:0px;" align="center">
        <tr>
            <td><div class="copyright">&copy;[url="http://www.phphq.net?script=phUploader"]phUploader[/url]</div></td>
        </tr>
    </table>
    </body>
    </html>

  2. #2
    Utente di HTML.it L'avatar di luca200
    Registrato dal
    Apr 2002
    Messaggi
    4,120
    Francamente non ho voglia di guardarlo tutto , ma quasi sicuramente ti manca una graffa di chiusura. Controllale

  3. #3
    ma può essere solamente un errore di parentesi?

    non riesco a trovarla! uff...

  4. #4
    Utente di HTML.it
    Registrato dal
    Oct 2007
    Messaggi
    157
    Fai l'indentazione del codice, vedrai che la trovi: anche io concordo, manca una o più graffe di chiusura.

  5. #5
    come si fa l'identazione? scusate la "nobbaggine" XD

  6. #6
    Utente di HTML.it L'avatar di blekm
    Registrato dal
    Jun 2004
    Messaggi
    8,310
    prova ad usare questo

    <?php

    al posto di

    <?
    Il portale sul turismo a Lucca

    Siti web Lucca

    Vendo Tex a colori di Repubblica (primi 100 numeri) - info in pvt.

  7. #7
    Originariamente inviato da blekm
    prova ad usare questo

    <?php

    al posto di

    <?
    non funziona

  8. #8
    Utente di HTML.it L'avatar di blekm
    Registrato dal
    Jun 2004
    Messaggi
    8,310
    a me dava quell'errore quando usavo <? al posto di <?php

    magari nel tuo caso è altro, prova a indentare il codice e controlla per bene le parentesi di apertura/chiusura
    Il portale sul turismo a Lucca

    Siti web Lucca

    Vendo Tex a colori di Repubblica (primi 100 numeri) - info in pvt.

  9. #9

  10. #10
    Originariamente inviato da MauMTS1000
    http://it.wikipedia.org/wiki/Indentazione
    si, l'avevo appena cercato XD

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 © 2024 vBulletin Solutions, Inc. All rights reserved.