Questo è il file controlla.php

<?
ob_start();
include("config.inc.PHP");
include("selezione.inc.PHP");
include("ricerca.php");


$val=ricerca('profilo',$select,'lgin',$log,'pass', $passwd,'abilitato');
switch($val){
case -2:
echo "utente non registrato";
break;
case -1:
echo"utente registrato ma non abilitato";
break;

case 0:
session_start();
$logged=0;
session_register("logged");
header("Location: http://localhost/videoteca/admin.php");
break;
case 1:
session_start();
$logged=1;
session_register("logged");
header("Location: http://localhost/videoteca/clienti/clienti.php");
break;
case 2:
session_start();
$logged=2;
session_register("logged");
header("Location: http://localhost/videoteca/tesserati/tesserati.php");
break;
}
?>


<html>
<head>
<title>Documento senza titolo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

</body>
</html>

file ricerca.PHP
<?
function ricerca($arg,$chiave,$arg2,$chiave2,$arg3,$chiave3 ){
$dati=mysql_query("SELECT * FROM autenticazione WHERE $arg='$chiave'AND $arg2='$chiave2' AND $arg3='$chiave3'");
$num_righe=mysql_num_rows($dati);
if(!$num_righe){
return -2;
}

$array=mysql_fetch_array($dati);
$abil=$array['abilitato'];
if($abil==1){
return $chiave;
}
else{
return -1;
}


}
?>

file index.PHP
<html>
<head>
<title>Documento senza titolo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="stile.css" rel="stylesheet" type="text/css">
</head>


<?
$select=$log=$passwd="";
?>
<body>
<div align="center">
<table width="75%" border="0">
<tr>
<td colspan="4"><div align="center" class="unnamed1"><font size="3" face="Arial, Helvetica, sans-serif">Modalit&agrave;
di Navigazione</font></div></td>
</tr>
<tr>
<td height="21" colspan="4">
<div align="center">
<form name="form1" method="post" action="controlla.php">
<table width="93%" border="0">
<tr>
<td width="40%" class="unnamed1"><div align="right"><font face="Arial, Helvetica, sans-serif">Scegli
il tuo profilo di navigazione</font></div></td>
<td width="38%" class="unnamed1"> <select name="select" size="1">
<option value="0">Amministratore</option>
<option value="1">Cliente</option>
<option value="2">Tesserato</option>
</select></td>
</tr>
<tr>
<td class="unnamed1"><div align="right"><font face="Arial, Helvetica, sans-serif">Inserisci
la tua Login</font></div></td>
<td class="unnamed1"> <input type="text" name="log"></td>
</tr>
<tr>
<td class="unnamed1"><div align="right"><font face="Arial, Helvetica, sans-serif">Inserisci
la tua password</font></div></td>
<td class="unnamed1"> <input type="password" name="passwd"></td>
</tr>
<tr>
<td class="unnamed1"></td>
<td class="unnamed1"></td>
</tr>
<tr>
<td class="unnamed1"></td>
<td class="unnamed1"> <input type="submit" name="Submit" value="Invia">
<input type="reset" name="Submit2" value="Cancella"></td>
</tr>
<tr>
<td colspan="2" class="unnamed1"><div align="center">Se
non sei un utente registrato clicca qui
</div></td>
</tr>
</table>
</form>
</div></td>
</tr>
</table>
</div>
</body>
</html>

L'ordine di esecuzione è il seguente:
index.PHP invia le variabili select, log, passwd al file controlla.PHP che chiama a sua volta la funzione ricerca.

Ti ringrazio per l'aiuto che mi stai dando, sto riprendendo del copdice che ho fatto dopo molto tempo. Queste sono le tre funzioni interessate come devo procedere ?