allora veniamo a noi

ho un problema con un include

il codice postato sotto funziona perfettamente, solo se l'include nn sta dentro la funzione (che è commentata)

appena levo i commenti mi da questo errore

Fatal error: Call to a member function on a non-object in c:\programmi\easyphp1-8\www\occ_lepihost\stogame\autoreg.php on line 27

facendo varie prove ho notato ke l'incude nn gradisce stare dentro la funzione...

come faccio a risolvere ??? avete suggerimenti ?

p.s.

il file session.php contiene una classe

Codice PHP:
<?
/**
 * autoreg.php (stogame project)
 *
 * Ogame Commercial Center (OCC)
 * Written by: Crazy Scientist
 *
 */
    
//registrazione
//function autoreg()
//{     
    
if(isset($_POST['user']) && isset($_POST['ogame_id']) && isset($_POST['universo']) && isset($_POST['coor']) && isset($_POST['email']))
    {        
        
//generazione password
        
$pass generateRandStr(8);
                    
        
//recupero paese ed universo
        
$pieces explode("."$_POST['universo']); //separazione stringa
        
$universo $pieces[0]; //universo
        
$paese $pieces[1]; // paese
                    
        
include($paese."/session.php"); //include session.php del paese selezionato
                    
        
global $session;        
                    
        
$retval $session->registerStogamePj($_POST['user'], $_POST['ogame_id'], $pass$universo$_POST['coor'], $_POST['email']);
                    
        if(
$retval == 0) return $pass;
            else return 
0;
         
    }
    else return 
0;        
//}

/**
* generateRandStr - Generates a string made up of randomized
* letters (lower and upper case) and digits, the length
* is a specified parameter.
*/
function generateRandStr($length){
  
$randstr "";
  for(
$i=0$i<$length$i++){
     
$randnum mt_rand(0,61);
     if(
$randnum 10){
        
$randstr .= chr($randnum+48);
     }else if(
$randnum 36){
        
$randstr .= chr($randnum+55);
     }else{
        
$randstr .= chr($randnum+61);
     }
  }
  return 
$randstr;
}

//chiamata x prova
//$val = autoreg();
//echo $val;

?>