Problema conferma registrazione
Ho un problema con il mio sito web: Ho creato un file per la registrazione che richiede la conferma, e fin qui funziona bene ma dopo aver confermato con l'email mi dice che non ho ancora confermato con l'email eppure sul file utenti.txt mi dice che l'email è stata confermata. allego il file di login
Codice PHP:
<span class="style9"><em>
<marquee style="font-family: Arial Black; text-decoration: blink" width="505" height="23" class="style13">Il login in questa area è riservato agli Utenti che hanno effettuato la registrazione tramite email. La registrazione è gratuita. </marquee></em></span>
<br>
<br>
<div class="style1">
<?php
session_start();
if(@$_SESSION['log'] == '1') {//se l'utente ha gia effetuato il login
header("Location: http://".$_SERVER['HTTP_HOST']."/area_riservata.php");//lo mando all' area riserva
} else {
if(isset($_POST['submit'])) {//se il form è stato submistato il form
$username=htmlentities($_POST['username']);//raccolgo i dati inviati via post
$password=htmlentities($_POST['password']);
$file='utenti.txt';
$utenti=file($file);
$crypt_pass = md5($password);
$log = false;
$error = false;
foreach($utenti as $valore) {
$valore = @substr($valore, 0, strlen($valore)-1);
@list($username_file, $password_file, $email, $codice, $attivo)=@explode(',', $valore);//listo i dati dell utente
if($username_file == $username && $password_file == $crypt_pass) {//verifico se l'utente corisponde a quello scelto
if($attivo != '1') {//se l'utente non attivato l'user
$error = "active";
} else {
$log=true;
$_SESSION['log'] = '1';//setto le sessioni
$_SESSION['username'] = $username;
$_SESSION['email'] = $email;
}
} else {
$error = "usrpsw";
}
}
if($log == true) {
if ($_POST["txt_captcha"] == $_SESSION["session_captchaText"])
{
echo "<script type=\"text/Javascript\">
window.location = 'area_riservata.php';
</script>"; ;
}
else
{
switch($error) {
case false:
echo "Login fallito";
echo "<script type=\"text/Javascript\">
window.location = 'area_riservata.php';
</script>";
break;
}
$retry = true;
}
} else {
switch($error) {
case 'active':
echo "Non hai ancora confermato tramite e-mail";
break;
case 'usrpsw':
echo "Combinazione username e password sbagliati";
break;
case false:
echo "Login fallito";
break;
}
$retry = true;
}
}
if(!isset($_POST["submit"]) || isset($retry)) {
?></div>
<body style="background-image: url('images/acqua.gif')"><br>
<form method="post" action="">
<div align="center">
<table border="0" style="width: 550px; height: 135px;">
<tr>
<td class="style5" style="height: 68px;" colspan="3">
<img src="captcha.php" alt="captcha codice" name="captcha" width="233" height="49" id="captcha" /></td>
</tr>
<tr>
<td class="style5" style="width: 57%; height: 68px;"><em><strong>*Inserisci il testo che vedi nell'immagine:</strong></em></td>
<td style="height: 68px;" class="style1" colspan="2">
<input name="txt_captcha" type="text" id="txt_captcha" style="width: 190px; height: 23px" class="style5" /><br>
<br>
</td>
<td>
<a href="login3.php">
<img alt="" src="images/Refresh.png" width="25" height="19" class="style11">refresh</a></td>
<a href="login3.php">
</tr>
<tr>
<td class="style5" style="width: 57%; height: 68px;"><strong><em>Utente:</em></strong></td>
<td style="width: 32%; height: 68px;" class="style1">
<input name="username" type="text" style="width: 155px" /></td>
<td class="style5" style="width: 16%; height: 68px;"> </td>
</tr>
<tr>
<td class="style5" style="width: 57%"><strong><em>Password:</em></strong></td>
<td style="width: 32%" class="style1">
<input name="password" type="password" style="width: 158px" /></td>
</tr>
<tr>
<td style="width: 57%" class="style1"> </td>
<td style="width: 32%" class="style10"><input type="submit" value="Invia" name="submit" /></td>
</tr>
</table>
</div>
</form>