Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 16

Discussione: Rand()

  1. #1

    Rand()

    Salve a tutto oggi Super Savio mi ha aiuto a cerca di fare un rand()
    però non và perche mi combina tutto il css:
    ecco il php, mi dite come è l'errore grazie
    Codice PHP:
    <?php
    /*
    By using this script you will be able to upload as many files as you want.
    The code will check if file existes, limited extensions, file size, file selected ..etc.
    For Q. E-mail/MSN: m(at)maaking.com.
    */
    ###########################################
    #----------Upload Multiple Files----------#
    #----------Multi-files Uploader-----------#
    #-------------Multi-Uploader -------------#
    ###########################################
    /*=========================================\
    Author      :  Mohammed Ahmed(M@@king)    \\
    Version     :  1.0                        \\
    Date Created:  Aug 20  2005               \\
    ----------------------------              \\
    Last Update:   Aug 31 2005                \\
    ----------------------------              \\
    Country    :   Palestine                  \\
    City       :   Gaza                       \\
    E-mail     :   [email]m@maaking.com[/email]              \\
    MSN        :   [email]m@maaking.com[/email]              \\
    AOL-IM     :   maa2pal                    \\
    WWW        :   [url]http://www.maaking.com[/url]     \\
    Mobile/SMS :   00972-599-622235           \\
                                              \\
    ===========================================\
    ------------------------------------------*/

    // EDIT SUPERSAVIO.NET //

    //upload directory.
    //change to fit your need eg. files, upload .... etc.
    $upload_dir "upload/";
    //number of files to upload.
    $num_files 5;
    //the file size in bytes.
    $size_bytes =51200000//51200000 bytes = 50000KB.
    //Extensions you want files uploaded limited to.
    $limitedext = array(".gif",".jpg",".psd",".psp",".jpeg",".png",".txt",".nfo",".doc",".rtf",".dmg",".zip",".rar",".bmp",".gz",".mp3");


       
    //check if the directory exists or not.
       
    if (!is_dir("$upload_dir")) {
          die (
    "Error: The directory [b]($upload_dir)[/b] doesn't exist");
       }
       
    //check if the directory is writable.
       
    if (!is_writeable("$upload_dir")){
          die (
    "Error: The directory [b]($upload_dir)[/b] is NOT writable, Please CHMOD (777)");
       }


    //if the form has been submitted, then do the upload process
    //infact, if you clicked on (Upload Now!) button.
    if (isset($_POST['upload_form'])){

           echo 
    "<h3>Upload results:</h3>";

           
    //do a loop for uploading files based on ($num_files) number of files.
           
    for ($i 1$i <= $num_files$i++) {

               
    //define variables to hold the values.
               
    $new_file $_FILES['file'.$i];
               
    $file_name $new_file['name'];
               
    //to remove spaces from file name we have to replace it with "_".
               
    $file_name str_replace(' ''_'$file_name);
               
    $file_tmp $new_file['tmp_name'];
               
    $file_size $new_file['size'];
               
    $file_name_finale $file_name.rad(0100);

               
    #-----------------------------------------------------------#
               # this code will check if the files was selected or not.    #
               #-----------------------------------------------------------#

               
    if (!is_uploaded_file($file_tmp)) {
                  
    //print error message and file number.
                  
    echo "File $i: Not selected.
    "
    ;
               }else{
                     
    #-----------------------------------------------------------#
                     # this code will check file extension                       #
                     #-----------------------------------------------------------#

                     
    $ext strrchr($file_name,'.');
                     if (!
    in_array(strtolower($ext),$limitedext)) {
                        echo 
    "File $i: ($file_name) Wrong file extension. 
    "
    ;
                     }else{
                           
    #-----------------------------------------------------------#
                           # this code will check file size is correct                 #
                           #-----------------------------------------------------------#

                           
    if ($file_size $size_bytes){
                               echo 
    "File $i: ($file_name) Faild to upload. File must be [b]"$size_bytes 1024 ."[/b] KB. 
    "
    ;
                           }else{
                                 
    #-----------------------------------------------------------#
                                 # this code check if file is Already EXISTS.                #
                                 #-----------------------------------------------------------#

                                /* if(file_exists($upload_dir.$file_name)){
                                     echo "File $i: ($file_name) already exists.
    ";
                                 }else{*/
                                       #-----------------------------------------------------------#
                                       # this function will upload the files.  :) ;) cool          #
                                       #-----------------------------------------------------------#
                                       
    if (move_uploaded_file($file_tmp,$upload_dir.$file_name_final)) {
                                           echo 
    "File $i: [url='http://webhost.webarrivo.com/upload/$file_name_final']$file_name_final[/url] è stato uppato correttamente.
    "
    ;
    echo 
    "<img src=\"upload/$file_name_final\" witdh=\"80px\" height=\"80px\" />
    "
    ;
    list(
    $width$height$type$attr) = getimagesize("upload/$file_name_final");
    echo 
    "Larghezza: " .$width"
    "
    ;
    echo 
    "Altezza: " .$height"
    "
    ;
    echo 
    "Dimensione: " .filesize("upload/$file_name_final")."
    "
    ;
    echo 
    "link: <input type=\"text\" value=\"[url='http://webhost.webarrivo.com/upload/$file_name_final']$file_name_final[/url]\" width=\"500\" />
    "
    ;
    echo 
    "BBcode: <input type=\"text\" value=\"[IMG]http://webhost.webarrivo.com/upload/".$file_name_final."[/IMG]\" width=\"500\" />
    "
    ;
    echo 
    "BBcode 2: <input type=\"text\" value=\"[IMG src='http://webhost.webarrivo.com/upload/".$file_name_final."']".$file_name_final."[/IMG]\" width=\"500\" />
    "
    ;                                   }else{
                                            echo 
    "File $i: upload fallito.
    "
    ;
                                       }
    #end of (move_uploaded_file).

                                 #}#end of (file_exists).

                           
    }#end of (file_size).

                     
    }#end of (limitedext).

               
    }#end of (!is_uploaded_file).

           
    }#end of (for loop).
           # print back button.
           
    echo "»<a href=\"$_SERVER[PHP_SELF]\">back</a>";
    ////////////////////////////////////////////////////////////////////////////////
    //else if the form didn't submitted then show it.
    }else{
        echo 
    " <h3>Seleziona il file da uppare.</h3>
               Grandezza massima = "
    $size_bytes 1024 ." KB";
        echo 
    " <form method=\"post\" action=\"$_SERVER[PHP_SELF]\" enctype=\"multipart/form-data\">";
               
    // show the file input field based on($num_files).
               
    for ($i 1$i <= $num_files$i++) {
                   echo 
    "File $i: <input type=\"file\" name=\"file"$i ."\">
    "
    ;
               }
        echo 
    " <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"$size_bytes\">
               <input type=\"submit\" name=\"upload_form\" value=\"Upload Now!\">
               </form>"
    ;
    }

    //print copyright ;-)


    echo"<p align=\"left\">
    Sono stati hostati: "
    ;
    $dir "upload/"//La barra in fondo lasciala.


    foreach (glob($dir "*.*") as $filename)
    {
    $count++;
    }
    if (
    $count == 0) {
    echo 
    "Non c'è nessun file nella cartella: " $dir;
    } else {
    echo 
    $count;
    }
    echo 
    "</p>";


    echo
    "<p align=\"right\">Collaborazione di SuperSavio.net
    </p>"
    ;
    ?>

  2. #2
    Aiuto! HELP ME :P

  3. #3
    ti ho passato la pagina modificata tramite messenger...però secondo me è il server chiedi se hanno disabilitato qualcosa...

  4. #4
    Utente di HTML.it
    Registrato dal
    Jan 2004
    Messaggi
    378
    codice:
     $file_name_finale = $file_name.rad(0, 100);
    non pensate che manchi qualcosa?

  5. #5

    NON VA'

    Originariamente inviato da XvOg1
    codice:
     $file_name_finale = $file_name.rad(0, 100);
    non pensate che manchi qualcosa?
    o messo

    Codice PHP:
    $file_name_finale $file_name.rand(0100); 
    ma non và mi dà 'File 1: upload fallito.'

    Ecco la pagina, http://webhost.webarrivo.com/host.php

  6. #6
    se controlli bene nel codice che ti ho passato tramite messenger quella riga lo modificata

    $file_name_finale = $file_name.rad(0, 100).$ext;

  7. #7
    questo è il codice attualmente utilizzato
    Codice PHP:
     <?php
    /*
    By using this script you will be able to upload as many files as you want.
    The code will check if file existes, limited extensions, file size, file selected ..etc.
    For Q. E-mail/MSN: m(at)maaking.com.
    */
    ###########################################
    #----------Upload Multiple Files----------#
    #----------Multi-files Uploader-----------#
    #-------------Multi-Uploader -------------#
    ###########################################
    /*=========================================\
    Author      :  Mohammed Ahmed(M@@king)    \\
    Version     :  1.0                        \\
    Date Created:  Aug 20  2005               \\
    ----------------------------              \\
    Last Update:   Aug 31 2005                \\
    ----------------------------              \\
    Country    :   Palestine                  \\
    City       :   Gaza                       \\
    E-mail     :   [email]m@maaking.com[/email]              \\
    MSN        :   [email]m@maaking.com[/email]              \\
    AOL-IM     :   maa2pal                    \\
    WWW        :   [url]http://www.maaking.com[/url]     \\
    Mobile/SMS :   00972-599-622235           \\
                                              \\
    ===========================================\
    ------------------------------------------*/

    // EDIT SUPERSAVIO.NET //

    //upload directory.
    //change to fit your need eg. files, upload .... etc.
    $upload_dir "upload/";
    //number of files to upload.
    $num_files 5;
    //the file size in bytes.
    $size_bytes =51200000//51200000 bytes = 50000KB.
    //Extensions you want files uploaded limited to.
    $limitedext = array(".gif",".jpg",".psd",".psp",".jpeg",".png",".txt",".nfo",".doc",".rtf",".dmg",".zip",".rar",".bmp",".gz",".mp3");


       
    //check if the directory exists or not.
       
    if (!is_dir("$upload_dir")) {
          die (
    "Error: The directory [b]($upload_dir)[/b] doesn't exist");
       }
       
    //check if the directory is writable.
       
    if (!is_writeable("$upload_dir")){
          die (
    "Error: The directory [b]($upload_dir)[/b] is NOT writable, Please CHMOD (777)");
       }


    //if the form has been submitted, then do the upload process
    //infact, if you clicked on (Upload Now!) button.
    if (isset($_POST['upload_form'])){

           echo 
    "<h3>Upload results:</h3>";

           
    //do a loop for uploading files based on ($num_files) number of files.
           
    for ($i 1$i <= $num_files$i++) {

               
    //define variables to hold the values.
               
    $new_file $_FILES['file'.$i];
               
    $file_name $new_file['name'];
               
    //to remove spaces from file name we have to replace it with "_".
               
    $file_name str_replace(' ''_'$file_name);
               
    $file_tmp $new_file['tmp_name'];
               
    $file_size $new_file['size'];
               

               
    #-----------------------------------------------------------#
               # this code will check if the files was selected or not.    #
               #-----------------------------------------------------------#

               
    if (!is_uploaded_file($file_tmp)) {
                  
    //print error message and file number.
                  
    echo "File $i: Not selected.
    "
    ;
               }else{
                     
    #-----------------------------------------------------------#
                     # this code will check file extension                       #
                     #-----------------------------------------------------------#

                     
    $ext strrchr($file_name,'.');
                     if (!
    in_array(strtolower($ext),$limitedext)) {
                        echo 
    "File $i: ($file_name) Wrong file extension. 
    "
    ;
                     }else{
                           
    #-----------------------------------------------------------#
                           # this code will check file size is correct                 #
                           #-----------------------------------------------------------#

                           
    if ($file_size $size_bytes){
                               echo 
    "File $i: ($file_name) Faild to upload. File must be [b]"$size_bytes 1024 ."[/b] KB. 
    "
    ;
                           }else{
                                 
    #-----------------------------------------------------------#
                                 # this code check if file is Already EXISTS.                #
                                 #-----------------------------------------------------------#

                                /* if(file_exists($upload_dir.$file_name)){
                                     echo "File $i: ($file_name) already exists.
    ";
                                 }else{*/
                                       #-----------------------------------------------------------#
                                       # this function will upload the files.  :) ;) cool          #
                                       #-----------------------------------------------------------#
                                       
    $file_name_finale $file_name.rad(0100).$ext;
    echo 
    $file_name_finale;
                                       if (
    move_uploaded_file($file_tmp,$upload_dir.$file_name_finale)) {
                                           echo 
    "File $i: [url='http://webhost.webarrivo.com/upload/$file_name_final']$file_name_final[/url] è stato uppato correttamente.
    "
    ;
    echo 
    "<img src=\"upload/$file_name_final\" witdh=\"80px\" height=\"80px\" />
    "
    ;
    list(
    $width$height$type$attr) = getimagesize("upload/$file_name_final");
    echo 
    "Larghezza: " .$width"
    "
    ;
    echo 
    "Altezza: " .$height"
    "
    ;
    echo 
    "Dimensione: " .filesize("upload/$file_name_final")."
    "
    ;
    echo 
    "link: <input type=\"text\" value=\"[url='http://webhost.webarrivo.com/upload/$file_name_final']$file_name_final[/url]\" width=\"500\" />
    "
    ;
    echo 
    "BBcode: <input type=\"text\" value=\"[IMG]http://webhost.webarrivo.com/upload/".$file_name_final."[/IMG]\" width=\"500\" />
    "
    ;
    echo 
    "BBcode 2: <input type=\"text\" value=\"[IMG src='http://webhost.webarrivo.com/upload/".$file_name_final."']".$file_name_final."[/IMG]\" width=\"500\" />
    "
    ;                                   }else{
                                            echo 
    "File $i: upload fallito.
    "
    ;
                                       }
    #end of (move_uploaded_file).

                                 #}#end of (file_exists).

                           
    }#end of (file_size).

                     
    }#end of (limitedext).

               
    }#end of (!is_uploaded_file).

           
    }#end of (for loop).
           # print back button.
           
    echo "»<a href=\"$_SERVER[PHP_SELF]\">back</a>";
    ////////////////////////////////////////////////////////////////////////////////
    //else if the form didn't submitted then show it.
    }else{
        echo 
    " <h3>Seleziona il file da uppare.</h3>
               Grandezza massima = "
    $size_bytes 1024 ." KB";
        echo 
    " <form method=\"post\" action=\"$_SERVER[PHP_SELF]\" enctype=\"multipart/form-data\">";
               
    // show the file input field based on($num_files).
               
    for ($i 1$i <= $num_files$i++) {
                   echo 
    "File $i: <input type=\"file\" name=\"file"$i ."\">
    "
    ;
               }
        echo 
    " <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"$size_bytes\">
               <input type=\"submit\" name=\"upload_form\" value=\"Upload Now!\">
               </form>"
    ;
    }

    //print copyright ;-)


    echo"<p align=\"left\">
    Sono stati hostati: "
    ;
    $dir "upload/"//La barra in fondo lasciala.


    foreach (glob($dir "*.*") as $filename)
    {
    $count++;
    }
    if (
    $count == 0) {
    echo 
    "Non c'è nessun file nella cartella: " $dir;
    } else {
    echo 
    $count;
    }
    echo 
    "</p>";


    echo
    "<p align=\"right\">Collaborazione di SuperSavio.net
    </p>"
    ;
    ?>

  8. #8
    Ecco come ho messo ma non vò lo stesso:

    Codice PHP:
    <?php
    /*
    By using this script you will be able to upload as many files as you want.
    The code will check if file existes, limited extensions, file size, file selected ..etc.
    For Q. E-mail/MSN: m(at)maaking.com.
    */
    ###########################################
    #----------Upload Multiple Files----------#
    #----------Multi-files Uploader-----------#
    #-------------Multi-Uploader -------------#
    ###########################################
    /*=========================================
    Author      :  Mohammed Ahmed(M@@king)    \
    Version     :  1.0                        \
    Date Created:  Aug 20  2005               \
    ----------------------------              \
    Last Update:   Aug 31 2005                \
    ----------------------------              \
    Country    :   Palestine                  \
    City       :   Gaza                       \
    E-mail     :   [email]m@maaking.com[/email]              \
    MSN        :   [email]m@maaking.com[/email]              \
    AOL-IM     :   maa2pal                    \
    WWW        :   [url="http://www.maaking.com"][url]http://www.maaking.com[/url][/url]     \
    Mobile/SMS :   00972-599-622235           \
                                              \
    ===========================================
    ------------------------------------------*/

    // EDIT SUPERSAVIO.NET //

    //upload directory.
    //change to fit your need eg. files, upload .... etc.
    $upload_dir "upload/";
    //number of files to upload.
    $num_files 5;
    //the file size in bytes.
    $size_bytes =51200000//51200000 bytes = 50000KB.
    //Extensions you want files uploaded limited to.
    $limitedext = array(".gif",".jpg",".psd",".psp",".jpeg",".png",".txt",".nfo",".doc",".rtf",".dmg",".zip",".rar",".bmp",".gz",".mp3");


       
    //check if the directory exists or not.
       
    if (!is_dir("$upload_dir")) {
          die (
    "Error: The directory [b]($upload_dir)[/b] doesn't exist");
       }
       
    //check if the directory is writable.
       
    if (!is_writeable("$upload_dir")){
          die (
    "Error: The directory [b]($upload_dir)[/b] is NOT writable, Please CHMOD (777)");
       }


    //if the form has been submitted, then do the upload process
    //infact, if you clicked on (Upload Now!) button.
    if (isset($_POST['upload_form'])){

           echo 
    "<h3>Upload results:</h3>";

           
    //do a loop for uploading files based on ($num_files) number of files.
           
    for ($i 1$i <= $num_files$i++) {

               
    //define variables to hold the values.
               
    $new_file $_FILES['file'.$i];
               
    $file_name $new_file['name'];
               
    //to remove spaces from file name we have to replace it with "_".
               
    $file_name str_replace(' ''_'$file_name);
               
    $file_tmp $new_file['tmp_name'];
               
    $file_size $new_file['size'];
               
    $file_name_finale $file_name.rad(0100).$ext;

               
    #-----------------------------------------------------------#
               # this code will check if the files was selected or not.    #
               #-----------------------------------------------------------#

               
    if (!is_uploaded_file($file_tmp)) {
                  
    //print error message and file number.
                  
    echo "File $i: Not selected.
    "
    ;
               }else{
                     
    #-----------------------------------------------------------#
                     # this code will check file extension                       #
                     #-----------------------------------------------------------#

                     
    $ext strrchr($file_name,'.');
                     if (!
    in_array(strtolower($ext),$limitedext)) {
                        echo 
    "File $i: ($file_name) Wrong file extension. 
    "
    ;
                     }else{
                           
    #-----------------------------------------------------------#
                           # this code will check file size is correct                 #
                           #-----------------------------------------------------------#

                           
    if ($file_size $size_bytes){
                               echo 
    "File $i: ($file_name) Faild to upload. File must be [b]"$size_bytes 1024 ."[/b] KB. 
    "
    ;
                           }else{
                                 
    #-----------------------------------------------------------#
                                 # this code check if file is Already EXISTS.                #
                                 #-----------------------------------------------------------#

                                /* if(file_exists($upload_dir.$file_name)){
                                     echo "File $i: ($file_name) already exists.
    ";
                                 }else{*/
                                       #-----------------------------------------------------------#
                                       # this function will upload the files.  [img]images/smilies/smile.gif[/img] ;) cool          #
                                       #-----------------------------------------------------------#
                                       
    if (move_uploaded_file($file_tmp,$upload_dir.$file_name_final)) {
                                           echo 
    "File $i: [url='http://webhost.webarrivo.com/upload/$file_name_final']$file_name_final[/url] è stato uppato correttamente.
    "
    ;
    echo 
    "<img src=\"upload/$file_name_final\" witdh=\"80px\" height=\"80px\" />
    "
    ;
    list(
    $width$height$type$attr) = getimagesize("upload/$file_name_final");
    echo 
    "Larghezza: " .$width"
    "
    ;
    echo 
    "Altezza: " .$height"
    "
    ;
    echo 
    "Dimensione: " .filesize("upload/$file_name_final")."
    "
    ;
    echo 
    "link: <input type=\"text\" value=\"[url='http://webhost.webarrivo.com/upload/$file_name_final']$file_name_final[/url]\" width=\"500\" />
    "
    ;
    echo 
    "BBcode: <input type=\"text\" value=\"[IMG]http://webhost.webarrivo.com/upload/".$file_name_final."[/IMG]\" width=\"500\" />
    "
    ;
    echo 
    "BBcode 2: <input type=\"text\" value=\"[IMG src='http://webhost.webarrivo.com/upload/".$file_name_final."']".$file_name_final."[/IMG]\" width=\"500\" />
    "
    ;                                   }else{
                                            echo 
    "File $i: upload fallito.
    "
    ;
                                       }
    #end of (move_uploaded_file).

                                 #}#end of (file_exists).

                           
    }#end of (file_size).

                     
    }#end of (limitedext).

               
    }#end of (!is_uploaded_file).

           
    }#end of (for loop).
           # print back button.
           
    echo "»<a href=\"$_SERVER[PHP_SELF]\">back</a>";
    ////////////////////////////////////////////////////////////////////////////////
    //else if the form didn't submitted then show it.
    }else{
        echo 
    " <h3>Seleziona il file da uppare.</h3>
               Grandezza massima = "
    $size_bytes 1024 ." KB";
        echo 
    " <form method=\"post\" action=\"$_SERVER[PHP_SELF]\" enctype=\"multipart/form-data\">";
               
    // show the file input field based on($num_files).
               
    for ($i 1$i <= $num_files$i++) {
                   echo 
    "File $i: <input type=\"file\" name=\"file"$i ."\">
    "
    ;
               }
        echo 
    " <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"$size_bytes\">
               <input type=\"submit\" name=\"upload_form\" value=\"Upload Now!\">
               </form>"
    ;
    }

    //print copyright ;-)


    echo"<p align=\"left\">
    Sono stati hostati: "
    ;
    $dir "upload/"//La barra in fondo lasciala.


    foreach (glob($dir "*.*") as $filename)
    {
    $count++;
    }
    if (
    $count == 0) {
    echo 
    "Non c'è nessun file nella cartella: " $dir;
    } else {
    echo 
    $count;
    }
    echo 
    "</p>";


    echo
    "<p align=\"right\">Collaborazione di SuperSavio.net
    </p>"
    ;
    ?>

  9. #9
    Utente di HTML.it L'avatar di mariox
    Registrato dal
    Nov 2006
    Messaggi
    837
    Che tipo di problema hai?
    Ti restituisce un errore?

  10. #10

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.