<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[accesso utente]]></title><description><![CDATA[<p dir="auto">salve  non riesco a capire perchè se un utente non registrato prova a effettuare l'accesso da pagina bianca come posso risolvere? chiedo aiuto posto i codici</p>
<pre><code>&lt;form method="post" 
			action="app/http/auth.php"&gt;
            &lt;div class="d-flex
			justify-content-center
			align-items-center
			flex-column"&gt;
			&lt;h3 class="display-4 fs-1 
			text-center"&gt;
			&lt;/h3&gt;   

			&lt;/div&gt;
			&lt;?php if (isset($_GET['error'])) { ?&gt;
			&lt;div class="alert alert-warning" role="alert"&gt;
			&lt;?php echo htmlspecialchars($_GET['error']);?&gt;
			&lt;/div&gt;
			&lt;?php } ?&gt;
										
			&lt;?php if (isset($_GET['success'])) { ?&gt;
			&lt;div class="alert alert-success" role="alert"&gt;
			&lt;?php echo htmlspecialchars($_GET['success']);?&gt;
			&lt;/div&gt;
			&lt;?php } ?&gt;
			&lt;div class="mb-3"&gt;
			&lt;label class="form-label"&gt;
			Nome utente&lt;/label&gt;
			&lt;input type="text" 
			class="form-login"
			name="username"&gt;
			&lt;/div&gt;

			&lt;div class="mb-3"&gt;
			&lt;label class="form-label"&gt;
			Password&lt;/label&gt;
			&lt;input type="password" 
			class="form-login"
			name="password"&gt;
			&lt;/div&gt;
									  
			 &lt;button type="submit" 
			 class="btn btn-outline-secondary"&gt;
			 Accedi&lt;/button&gt;
			 &lt;a class="btn btn-outline-secondary" href="signup.php" role="button"&gt;Registrati&lt;/a&gt;
			 &lt;hr&gt;
			 &lt;br&gt;
			 &lt;a class="btn btn-outline-secondary" href="recupero.php" role="button"&gt;Password dimenticata?&lt;/a&gt;
			 &lt;/form&gt;  
----------------------------------------------

&lt;?php  
session_start();

# check if username &amp; password  submitted
if(isset($_POST['username']) &amp;&amp;
   isset($_POST['password'])){

   # database connection file
   include '../db.conn.php';
   
   # get data from POST request and store them in var
   $password = $_POST['password'];
   $username = $_POST['username'];
   
   $data = "username=".$username;
   
   #simple form Validation
   if(empty($username)){
      # error message
      $em = "inserisci il nome utente";

      # redirect to 'index.php' and passing error message
      header("Location: ../../index.php?error=$em&amp;$data");
   }else if(empty($password)){
      # error message
      $em = "inserisci la password";

      # redirect to 'index.php' and passing error message
      header("Location: ../../index.php?error=$em&amp;$data");
   }else {
      $sql  = "SELECT * FROM 
               users WHERE username=?";
      $stmt = $conn-&gt;prepare($sql);
      $stmt-&gt;execute([$username]);

      # if the username is exist
      if($stmt-&gt;rowCount() === 1){
        # fetching user data
        $user = $stmt-&gt;fetch();
		
        # if both username's are strictly equal
        if ($user['username'] === $username) {
           
           # verifying the encrypted password
          if (password_verify($password, $user['password'])) {
			  

            # successfully logged in
            # creating the SESSION
            $_SESSION['username'] = $user['username'];
            $_SESSION['name'] = $user['name'];
            $_SESSION['user_id'] = $user['user_id'];

            # redirect to 'home.php'
            header("Location: ../../home.php");

          }else {
            # error message
            $em = "Nome utente o password errati";

            # redirect to 'index.php' and passing error message
            header("Location: ../../index.php?error=$em&amp;$data");
          }
        }else {
          # error message
          $em = "Nome utente o password errati";

          # redirect to 'index.php' and passing error message
          header("Location: ../../index.php?error=$em&amp;$data");
        }
      }
   }
}else {
  header("Location: ../../index.php");
  exit;
}




</code></pre>
]]></description><link>https://dev.connect.gt/topic/250807/accesso-utente</link><generator>RSS for Node</generator><lastBuildDate>Wed, 25 Nov 2026 08:44:49 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/250807.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 18 Sep 2023 13:31:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to accesso utente on Sun, 24 Sep 2023 06:08:51 GMT]]></title><description><![CDATA[<p dir="auto">Buongiorno sono riuscito a risolvere certo non è un gran che ma va bene e funziona <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=f1cecb658d8" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:1.4em;width:auto;vertical-align:middle" title=":)" alt="🙂" />  posto il codice</p>
<pre><code>&lt;?php
    session_start();
    include('../db.conn.php');
    if (isset($_POST['username'])) {
        $username = $_POST['username'];
        $password = $_POST['password'];
        $query = $conn-&gt;prepare("SELECT * FROM users WHERE username=:username");
        $query-&gt;bindParam("username", $username, PDO::PARAM_STR);
        $query-&gt;execute();
        $result = $query-&gt;fetch(PDO::FETCH_ASSOC);
        if (!$result) {
           
		$em = "Il nome utente non risulta registrato!";
    	header("Location: ../../index.php?error=$em");
			
        } else {
            if (password_verify($password, $result['password'])) {
                $_SESSION['user_id'] = $result['user_id'];
				$_SESSION['username'] = $result['username'];
				$_SESSION['name'] = $result['name'];
				
				header("Location: ../../home.php");
				
                echo '&lt;p class="success"&gt;Accesso eseguito con successo!&lt;/p&gt;';
            } else {
                $em = "Nome utente o password errata!";
    	    header("Location: ../../index.php?error=$em");
            }
        }
    }
?&gt;
</code></pre>
]]></description><link>https://dev.connect.gt/post/1310666</link><guid isPermaLink="true">https://dev.connect.gt/post/1310666</guid><dc:creator><![CDATA[imperor]]></dc:creator><pubDate>Sun, 24 Sep 2023 06:08:51 GMT</pubDate></item></channel></rss>