Ciao belli, sto realizzando un applicazione, abbastanza complessa in realtà, ebbene si trattasi di un "social network" tempo permettendo, fino ad ora ho usato solo librerie di funzioni, ma per la gestione del profilo utente ho scelto di utilizzare questa classe
Codice PHP:
class account{
    
/*
    @packages profilefunction.php
    Mario d'errico
    prorpietà nome cogome etc
    */
    
    
public $nome;
    public 
$cognome;
    public 
$live;
    public 
$interessi;
    public 
$biobreve;
    public 
$profile;
   
    
/* cambia il nome   */ 
    
public function changename($nome){
        if (empty (
$nome)){
            return 
true;
            
            }
            else{ 
            
$profile $_SESSION['mail'];    
            
$this->nome $nome;
            
$query mysql_query ("
            update utenti 
            set nome = '
$nome
            where mail = '
$profile'
            "
);  
         
           
           }
           
       }
       
      
/* cambia il cognome*/
    
public function changesurname($surname){
         if (empty(
$surname)){
             return 
true;
             }else{
             
$profile $_SESSION['mail'];
             
$this->cognome $surname;
             
$query mysql_query ("
             update utenti 
             set cognome = '
$surname'
             where mail = '
$profile'
             
             "
);
            
             }
         }
     
/*cambia dove vivi*/
     
public function updatelive($location){
         if (empty (
$location)){
            return 
true
            }else{
            
$profile $_SESSION['mail'];
            
$this->live $location;
            
$query mysql_query ("
            update utenti 
            set live = '
$location'
            where mail = '
$profile'
            "
);    
                
            }
         
         }
    
/*cambia l'hobby */
    
public  function updatehobby($hobby){
          if (empty (
$hobby)){
              return 
true;
          }
          if (
strlen ($hobby)> 20){
              print 
"Non superare i 20 caratteri nella sessione interessi";
              
          }else{
           
$profile $_SESSION['mail'];
            
$this->interessi $hobby;
            
$query mysql_query ("
            update utenti 
            set hobby = '
$hobby
            where mail = '
$profile'
            "
);      
              
          }
          
      }
      
/*cambia bio breve*/
  
public function updatesmallbio($smallbio){
         if (empty (
$smallbio)){
             return 
true;        
          }
          if (
strlen ($smallbio) > 260){
            echo 
"Superato limite 260 caratteri";  
              
          } else{
            
$profile $_SESSION['mail'];
            
$this->biobreve $smallbio;
            
$query mysql_query ("
            update utenti 
            set bio = '
$smallbio'
            where mail = '
$profile'
            "
);  
              
          } 
         
      }
 
     
    }
    
/*istanze e ogetti creati*/
 
$newprofile = new account();
$newprofile->changename($nome =htmlspecialchars (mysql_real_escape_string(stripslashes ($_GET['nome']))));
$newprofile->changesurname($surname htmlspecialchars (mysql_real_escape_string(stripslashes($_GET['cognome']))));
 
$newprofile->updatelive($location htmlspecialchars (mysql_real_escape_string (stripslashes ($_GET['live']))));
$newprofile->updatehobby($hobby =htmlspecialchars (mysql_real_escape_string (stripslashes ($_GET['interessi']))));
$newprofile->updatesmallbio($smallbio htmlspecialchars (mysql_real_escape_string (stripslashes ($_GET['bio'])))); 
Credo che sia abbastanza semplice da capire in più e parzialmente commentata;
la domanda è la seguente:"E' utile , è un modo di programmare corretto, avreste qualche altro metodo da incrementare, cambiereste qualcosa?."


Ciauzz