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

    Aggiungere commenti a un sito (tipo guestbook)

    Ciao a tutti!
    E' molto tempo che seguo questo sito, ma non mi ero mai iscritto al forum...
    Ho bisogno di chiedervi una cosa...
    Per passione mi sono costruito un piccolo sito personale con un po' di foto ecc... (per chi volesse darmi qualche consiglio http://enzoorsi.interfree.it)
    Tutto fatto in html (+ flash e vari javascript preimpostati).
    Volevo aggiungere una specie di mini guestbook dove ogni utente che passa può lasciare un commento nella prima pagina...
    Ho guardato i vari guestbook (di cui ne ho uno), ma nessuno è semplice semplice come voglio io...
    Mi bastava una cosa tipo: inserisci nick e commento, e sotto la lista dei commenti...
    Volevo usare un iframe...
    Però credo che il mio dominio gratuito (interfree) non mi permetta di usare php...
    Qualcuno mi può aiutare?
    Posso usare dhtml??
    O qualcos'altro di semplice?
    O se c'è già qualcosa di preimpostato in giro...
    Grazie mille!!
    Ciao ciao!

  2. #2
    Ma nessuno sa rispondere al mio problema?
    Please...

  3. #3
    codice:
    Però credo che il mio dominio gratuito (interfree) non mi permetta di usare php...
    dovresti verificare quali linguaggi hai a disposizione (php, asp, niente ecc)

    poi decidiamo la strada da percorrere

    ciaux

  4. #4
    Ho appena controllato e la versione free del mio provider (interfree) non mi permette di utilizzare asp e php...dicono per ragioni di sicurezza...
    In html non credo si possa fare nulla...per il dhtml? Che mi dite? Mi basta una cosa semplicissima...tipo nick e commento...
    Grazie in anticipo...

  5. #5

  6. #6
    Beh, in php o asp qualcuno sa come posso risolvere??
    Al massimo metto in iframe che va su un altro dominio che supporta php e asp...
    Qualcosa di semplice che usa un normale txt invece di un database...

  7. #7

  8. #8
    Utente di HTML.it
    Registrato dal
    Feb 2006
    Messaggi
    2,620
    e ColdFusion lo lasciano usare?

  9. #9
    Ok, alla fine ho utilizzato questo codice in php
    Funziona tutto benissimo. Lo spazio è su aruba. 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:
    <?
        $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>

  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.