Buona sera a tutti,
ho strutturato queste due pagine per fare il login ma sembra andare in loop perchè ogni volta che inserisco user e pass corrette mi ripresenta la schermata di login.
questa è la pagina di index:
Codice PHP:
<html>
    <head>
        <link href="/css/style.index.css" rel="stylesheet" type="text/css"/>
    </head>

<?php
    
  
if (!isset($_SERVER['PHP_AUTH_USER'])) 
  {
    
header('WWW-Authenticate: Basic realm="localhost"');
    
header('HTTP/1.0 401 Unauthorized');
    echo 
'Autenticazione fallita!';
    exit;
  } 
  else 
  {
    
$user $_SERVER['PHP_AUTH_USER'];
    
$pass $_SERVER['PHP_AUTH_PW'];
    include_once(
"include/config.php");
    require_once(
"login.class.php");
    
$login = new login();    
    
$login->pulizia($user$pass);
    
$count1 $login->controllo();
    
    if (
$count1 == 1) {
        
session_start();        
        
$login->aggiornamento();
        
?>
        <div id="main">
            <div id="loading" align="middle">
            <table align="center">    
                <tr>
                    <td>
                        [b]Loading...[/b]    
                    </td>
                </tr>
                <tr>
                    <td>
                        [img]/img/indicator_bar.gif[/img]
                    </td>
                </tr>
            </table>
            </div>    
        </div>
        
        <body onload="finish()">
            <?php
                header
("Refresh: 5;URL=home.php");
            
?>
        </body>
        <?php  
    
} else {
        
header('WWW-Authenticate: Basic realm="localhost"');
        
header('HTTP/1.0 401 Unauthorized');
        echo 
'Autenticazione fallita!';
        exit;
    }

  } 
?>
</html>
e questa la pagina login.class.php:
Codice PHP:
<?php
    
    
class login{
        
        private 
$username;
        private 
$password;
        private 
$stringa1;
        private 
$stringa2;
        private 
$query;
        private 
$result;
        private 
$psw;
        
        public 
$count=0;
        public 
$row;
        
        public function 
pulizia($user$pass){
            
            if(!
get_magic_quotes_gpc()){
                
                
$this->username trim(addslashes($user));
                
$this->password trim(addslashes($pass));
                
$this->psw md5($this->password);
                
            }else{
                
                
$this->stringa1 stripslashes($user);
                
$this->stringa2 stripslashes($pass);
                
$this->username mysql_real_escape_string($this->stringa1);
                
$this->password mysql_real_escape_string($this->stringa2);
                
$this->psw md5($this->password);
                
            }
        }
//fine funzione pulizia
        
        
public function controllo(){
            include_once(
"include/config.php");
            
$this->query 'SELECT *
                        FORM login
                        WHERE username = "'
.$this->username.'" AND "'.$this->psw.'"';
            
$this->result mysql_query($this->query);
            
$this->count mysql_num_rows($this->result);
            
            return 
$this->count;
        
        }
//fine funzione controllo
        
        
public function assegnazione(){
            include_once(
"include/config.php");
            
$_SESSION['USER'] = $this->username;
            
$_SESSION['PASS'] = $this->password;
            
            while (
$this->row mysql_fetch_assoc($this->result)) {
                    
                
$_SESSION['cev'] = $this->row['cev'];
            
            }
//fine while
        
}
        
    }
//fine classe login
?>
qualcuno può illuminarmi please?
grazie mille a tutti