Visualizzazione dei risultati da 1 a 6 su 6

Discussione: Cartella temp

  1. #1

    Cartella temp

    Mi serviva una minichat. Ho trovato questa in php (codice sotto)
    Funziona tutto benissimo. L'unico problema è che non ho capito dove vanno a finire i due file "/temp/minichat.latest" "/temp/minichat.archive". Questa cartella temporanea non la vedo da nessuna parte. In teoria dovrei metterli in una mia cartella dandogli come permessi in scrittura il 777 (che però credo non si possa su aruba). A me andrebbe bene anche tenerli in questa cartella "temp", ma vorrei poterli modificare. Ad esempio non posso cancallare i post che avevo usato di prova...
    Qualcuno sa aiutarmi?
    Si è capito il problema?

    Codice PHP:
    codice PHP:<? 
        $latest 
    $DOCUMENT_ROOT "/temp/minichat.latest"
        
    $archive $DOCUMENT_ROOT "/temp/minichat.archive"
        
    $size 20
        
    $nick_size 20
        
    $message_size 256
        
    $max_word_size 20
         
    ?><body text="#CA0000" link="#CA0000" vlink="#CA0000" alink="#CA0000"> 

    <table width="113" align="center" border="0"> 
    <tr> 
      <td width="107"> 
        
       <form name="minichat_form" method="POST" action="<? echo $_SERVER['file:///C|/DOCUME~1/Enzo/IMPOST~1/Temp/Directory temporanea 1 per minichat2[1].zip/PHP_SELF']; ?>"> 
         <font face="arial,sans-serif" size="2"> 
          <input type="hidden" name="minichat_md5" value="<? if (isset($minichat_message)) {echo md5($minichat_message);} ?>"> 
          Name:
     
          <input type="text" name="minichat_nick" maxlength="<? echo $nick_size?>" size="15" style="font-family: Verdana, Arial, Helvetica, Sans-serif; font-size: 10px">
     
          Message:
     
          <textarea name="minichat_message" cols="18" rows="4" style="font-family: Verdana, Arial, Helvetica, Sans-serif; font-size: 10px"></textarea> 
          <input type="submit" name="minichat_submit" value="Submit"> 
         </font> 
        </form> 
       </p> 
       

     
        <font face="arial,sans-serif" size="1"> 

    <? 
         
        
    // Check to see if the user is trying to post something. 
        
    if (isset($minichat_md5) && isset($minichat_nick) && isset($minichat_message)) { 
             
            
    // Replace any new line stuff with a space. 
            
    $nick strtr($nick"\r\n""  "); 
            
    $message strtr($message"\r\n""  "); 

            
    // Trim leading and trailing whitespace where necessary and remove slashes. 
            
    $nick trim(stripslashes($minichat_nick)); 
            
    $message trim(stripslashes($minichat_message)); 
             
            
    // Only proceed if the md5 hash of message is not repeated. 
            
    if (md5($message) != $minichat_md5) { 
             
                
    // Only proceed if the user actually filled in both fields. 
                
    if (strlen($nick) > && strlen($message) > 0) { 
                     
                    
    // If the fields are too long, then chop them to the limits. 
                    
    if (strlen($nick) > $nick_size) { 
                        
    $nick substr($nick0$nick_size); 
                    } 
                    if (
    strlen($message) > $message_size) { 
                        
    $message substr($message0$message_size); 
                    } 
                     
                    
    // Remove new line characters from the input. 
                    
    $nick str_replace("\n"" "$nick); 
                    
    $message str_replace("\n"" "$message); 
                     
                    
    // Enforce the maximum word size by breaking up $message into lines. 
                    
    $message preg_replace("/([^s]{20})/""$1\n"$message); 
                     
                    
    // Now we can encode the nick and message into HTML. 
                
    $nick htmlentities($nick); 
                    
    $message htmlentities($message); 
                     
                    
    // Now replace the new line characters in $message. 
                    
    $message str_replace("\n""
    "
    $message); 
                     
                    
    // The IP address of the poster, web cache or whatever. 
                    
    $ip $_SERVER['REMOTE_ADDR']; 
                    
    $time date("j M Y - G:i:s"); 
                     
                    
    // Check to see if the 'latest' and 'archive' files exist and can be written to. 
                    
    if (!is_writable($latest) || !is_writable($archive)) { 
                        
    // Touch both files. 
                        
    touch($latest); 
                        
    touch($archive); 
                        if (!
    is_writable($latest) || !is_writable($archive)) { 
                            exit(
    "$latest or $archive is not writable. Please check your permissions and try again."); 
                        } 
                    } 
                     
                    
    // Read every line of the 'latest' file into an array. 
                    
    $lines file($latest); 
                    
    $bottom_index count($lines); 
                     
                    
    // Note that each entry takes up 4 lines. 
                    
    $line_ip "\n"
                    
    $line_nick "<font color=\"#9999ff\">Posted by $nick\n"
                    
    $line_time "on $time</font>
    \n"

                    
    $line_message "$message

    \n"


                    
    $entry $line_ip $line_nick $line_time$line_message

                    
    $already_posted 0
                    for (
    $i 3$i $bottom_index$i += 4) { 
                        if (
    $lines[$i] == $line_message) { 
                            
    $already_posted 1
                            break; 
                        } 
                    } 
                     
                    if (
    $already_posted == 0) { 
                        
    // Now rebuild the 'latest' file. 
                        // Start by entering the new entry at the top. 
                        
    $out fopen($latest"w"); 
                        
    fwrite($out$entry); 
                         
                        
    // Then write all other entries except the oldest. 
                        
    if ($bottom_index >= $size 4) { 
                            
    $bottom_index $size 4
                        } 
                        for (
    $i 0$i $bottom_index$i++) { 
                            
    fwrite($out$lines[$i]); 
                        } 
                        
    fclose($out); 
                         
                        
    // Also append the entry to the archive file. 
                        
    $out fopen($archive"a"); 
                        
    fwrite($out$entry); 
                        
    fclose($out); 
                    } 
                    else { 
                        
    // This avoided a "probably accidental" repost. 
                    

                     
                } 
                else { 
                    echo 
    "<font color=\"red\">You must fill in both fields</font>

    "

                } 
            } 
            else { 
                
    // This avoided a deliberate repost, maybe we should say something? 
            

        } 
         
        
    // include the latest comments on the page. 
        
    if (file_exists($latest)) { 
            include(
    $latest); 
        }  
    ?> 

        </font> 
       </p> 
      </td> 
    </tr> 
    </table>

  2. #2
    Utente di HTML.it L'avatar di chris
    Registrato dal
    Sep 1999
    Messaggi
    1,568
    Niente riferimenti agli hoster, grazie.

  3. #3
    Originariamente inviato da chris
    Niente riferimenti agli hoster, grazie.
    Ah, ok, scusa...ma l'ho indicato perchè da quel che ho capito è l'unico che non permtte i permessi 777 sulle sue cartelle...
    Però nessuno da risolvere il mio problema?? Che fine fa quella cartella Temp??

  4. #4

  5. #5

  6. #6

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.