Ciao a tutti, ho un login così:
	
	
	
		
Ma anche se metto l'username giusto, mi esce l'errore "Attenzione, username non corretto!", mi potete aiutare?
grazie anticipatamente! :byebye:
				
			
		PHP:
	
	<?php
session_start();
if( isset($_POST['submit_x']) && (trim($_POST['submit_x'])))
{ 
  if((!isset($_POST['username'])) || ($_POST['username'] == "") || (!preg_match("/^[a-z0-9]+$/i", $_POST['username'])))
  {
    echo "Attenzione, username non corretto!";
  }
  elseif((!isset($_POST['password'])) || ($_POST['password'] == "") || (!preg_match("/^[a-z0-9]+$/i", $_POST['password'])))
  {
    echo "Attenzione, password non corretta.";
  }else{
    $username = $_POST['username'];
    $password = $_POST['password'];
    @include "config.php";
    $ctrl_login = @mysql_query("SELECT id FROM iscrizioni WHERE username='$username' AND password='$password'") or die (mysql_error());
    if(@mysql_num_rows($ctrl_login)==0)
    {
      echo "Login incorretto.";
    }else{
      $obj = @mysql_fetch_object($ctrl_login) or die (mysql_error());
      $_SESSION['id'] = $obj->id;
      $_SESSION['username'] = $username;
      
      @header("Location: iscritti.php");
    }
  } 
}else{
  ?>
	Ma anche se metto l'username giusto, mi esce l'errore "Attenzione, username non corretto!", mi potete aiutare?
grazie anticipatamente! :byebye: