Salve a tutti ho un problema: ho fatto una pagina di login e una di profilo, ma quando mi deve mostrare la $_SESSION mi visualizza, al posto del nome utente, Array, perché? Non riesco proprio a capire.
Ecco il codice del login:
Codice PHP:
<?php

    
include 'header.php';

?>
<html>
<head>
<title>Entra in ciao</title>
<style type="text/css">
label {color:#FFF; font-size:24px; margin-top:30px; font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif}
input {height:30px; width:200px}
</style>
</head>
<body style="background-color:#036">
<div id="barra" style="height: 50px; position: fixed; top: 0px; bottom: 0; left: 0; width: 10000px; background-color: #006699; border-bottom: 1px solid #133783; position:fixed !important">
<p style="margin-top:10px; margin-bottom:10px; margin-left:20px; color:#FFF; font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif; font-size:24px; font-weight:bold">ciao[url="home.php"]Home[/url][url="register2.php"]Registrati[/url]</p>
</div>
[img]partealta.png[/img]
<p style="color:#FFF; font-size:40px; text-align:center; margin-top:90px; font-family:'Palatino Linotype', 'Book Antiqua', Palatino, serif">Entra in ciao</p>
<div id="wrapper">
    
        <?php
        
            $p 
$_GET['azione'];
            
            
// login2.php?azione=login
            
if($p == "login"){
            
                if(!isset(
$_POST['invia'])){ ?>
                    
                    <center><form method="post" action="#" id="formlogin"style="alignment-adjust:center">
                    
                        <label for="username" style="margin-right:70px">Username:</label>

                        <input type="text" name="username" id="username" style="margin-left:20px"/>

                        <label for="password"style="margin-right:70px">Password:</label>

                        <input type="password" name="password" id="password" style="margin-left:20px"/>

                        <input type="submit" name="invia" id="login" value="Accedi" style="margin-left:20px; width:100px; margin-top:20px"/>
                    
                    </form></center>
                    
<?php             } else {

                    
$username mysql_real_escape_string($_POST['username']);
                    
$password mysql_real_escape_string($_POST['password']);
                    
                    if(
$username == "" || $password == ""){
                    
                        echo 
"Attenzione, devi compilare tutti i campi";
                    
                    } else {
                    
                        
$password_cript md5($password);
                        
                        
$recuperadati mysql_query("SELECT * FROM utenti WHERE username = '$username' AND password = '$password_cript'");
                        
                        
$verificadati mysql_num_rows($recuperadati);
                        
                        if(
$verificadati == 1){
                        
                            
$sessione mysql_fetch_array($recuperadati);
                            
$_SESSION['utente'] = $sessione['username'];
                            echo 
"Login effettuato con successo!";
                            
header("Refresh: 2; URL= profile2.php?id=$_SESSION");
                        
                        } else {
                        
                            echo 
"Dati non presenti nel database!";
                        
                        }
                    
                    }
                
                }
            
            
            
// login2.php?azione=logout
            
} elseif ($p == "logout"){
            
                
session_destroy();
                echo 
"Logout effettuato con successo!";
                
header("Refresh: 2; URL= home.php");
            
            }
        
        
        
        
?>
    
    
        [img]angolobassodestro.png[/img]
    </div>
</body>
</html>
Ecco quello del profilo:
Codice PHP:
<?php
include 'header.php';
$table="utenti";
session_start();
$recuperadati mysql_query("SELECT * FROM utenti WHERE username = '$username' AND password = '$password_cript'");
$_SESSION['utente'] = $sessione['username'];
print 
"

[b]Ciao[/b] 
$_SESSION</p>";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento senza titolo</title>
</head>
<body>
</body>
</html>
Grazie a tutti in anticipo per il vostro aiuto.