Visualizzazione dei risultati da 1 a 5 su 5
  1. #1
    Utente di HTML.it L'avatar di LA VALE
    Registrato dal
    Sep 2003
    Messaggi
    667

    Disattivare il codice html all'interno di una text area

    Ciao a tutti!
    Ho un semplice guestbook in php, che scrive le entry su un file .DAT
    Ultimamente è oggetto di molto spam, e per questo vorrei disabilitare l'uso di codice html all'interno dei campi di input e della text area..
    Come si può fare?
    Grazie!

  2. #2

  3. #3
    Utente di HTML.it L'avatar di LA VALE
    Registrato dal
    Sep 2003
    Messaggi
    667
    Grazie mille, appena avrò di nuovo il pc proverò!

  4. #4
    Utente di HTML.it L'avatar di LA VALE
    Registrato dal
    Sep 2003
    Messaggi
    667
    Non capendo io una cippa di php, ho fatto delle prove, ma non funziona.
    IL codice php che serve dovrebbe essere questo:

    Codice PHP:
    <?php



    class TSguestbook extends SupportFunctions {

      
    # EDIT THE NAME OF YOUR WEBPAGE #
      
    var $pageName "xxx.php";
      
      
    // define datafiles
      
    var $guestbook_dat "xxx.dat";
      var 
    $entry_html_code "xxx.php";

      
      
    // define variables
      
    var $name;
      var 
    $email;
      var 
    $spaziotempo;
      var 
    $homepage;
      var 
    $entry;
      var 
    $timestamp;
      var 
    $admin_mail "xxx@xxx.it";
      
      
      
    // add new entry
      
    function _addEntry($name$email$spaziotempo$homepage$entry) {
        
    $this->name stripslashes($name);
        
    $this->email $email;
        
    $this->spaziotempo $spaziotempo;
        
    $this->homepage $homepage;
        
    $this->entry stripslashes($this->_replace_nl($entry));
        
    $this->timestamp date('d.m.Y \a\l\l\e H:i');
        
    $line $this->name."|".$this->email."|".$this->spaziotempo."|".$this->homepage."|"
                
    .$this->entry."|".$this->timestamp."|\r\n";
        
    $this->_writeLine($this->guestbook_dat$line"a");
        
    $this->_sendMail();
        return 
    1;
      }


      
    // display entries
      
    function _displayEntry($start_entry$MAX_PER_PAGE) {
        
    $end FALSE;
        
    $guestbook_array file($this->guestbook_dat);
        for (
    $i sizeof($guestbook_array) - $start_entry$j $MAX_PER_PAGE$i >= && $j 0$i--, $j--) {
          
    $guestbook_line explode("|"$guestbook_array[$i]);

          
    # empty strings must be substituted by " " to display the HTML correctly
          
    for ($k 0$k sizeof($guestbook_line); $k++) {
            if (!
    strcmp($guestbook_line[$k], ""))
              
    $guestbook_line[$k] = " ";
          }

          
    $this->name $guestbook_line[0];
          
    $this->email $guestbook_line[1];
          
    $this->spaziotempo $guestbook_line[2];
          
    $this->homepage $guestbook_line[3];
          
    $this->entry $guestbook_line[4];
          
    $this->timestamp $guestbook_line[5];

          
    # check, if there are any older entries in the datafile
          
    if ($i 1)
            
    $end TRUE;

          include(
    $this->entry_html_code);
               
        }        
        return 
    $end;
      }
      


      
    // display links to browse the entries
      
    function _displayLinks($start_entry$end) {

        
    # this will add a link to newer entries, if there are some
        
    if (($back $start_entry 10) > 0) {
          
    $link "<a href=\"$this->pageName?start_entry=$back\">Indietro</a>   ";
        }

        
    # this will add a link to older entries, if there are some
        
    if (!$end) {
          
    $start_entry += 10;
          
    $link .= "<a href=\"$this->pageName?start_entry=$start_entry\">Avanti</a>";
        }

        return 
    $link;
      }



      
    // send email-notification
      
    function _sendMail() {
        
    $mail_string "Il guestbook di LV4ER è stato firmato.\n\nSent
                        by 
    $this->name ($this->email) on $this->timestamp:\n\n$this->entry";
        
    mail ($this->admin_mail"New guestbook entry on LV4ER"$mail_string"From: Sito LV4ER");
        return 
    1;
      }


      
    // check entry
      
    function _checkEntry($entry) {
        
    $this->entry $entry;
        if (
    $entry == "") {
          
    # user pressed the return key instead of the tabulator key, so the entry is empty
          
    return 0;
        } else return 
    1;
      }


    }



    ?>
    La textarea è identificata con ENTRY.
    Dove inserisco uno degli esempi della pagina che mi è stata suggerita?

    Ho provato ad inserirne uno in fondo al codice php, ma non funziona, il codice html non vien disabilitato, ovvero non viene trasformato in solo testo..

    grazie

  5. #5
    Utente di HTML.it L'avatar di LA VALE
    Registrato dal
    Sep 2003
    Messaggi
    667
    Anybody help?


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.