Questa è la pagina che controlla il login:
Codice PHP:
<?php session_start(); include("dbclass.php"); include("functions.php"); ?>
<html>
<head>
<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
<title>pannello di controllo</title>
<body>
<div id="container">
<?php
$q = "SELECT * FROM utenti WHERE username = '$_POST[username]' AND password ='$_POST[password]'";
$res = $db->query($q);
if(mysql_num_rows($res) == 1) { $_SESSION['logged'] = 1; //è stata trovato username e password corrispondenti header('Location: index.php'); }
else { header('Location: index.php'); } ?>
</div>
</body>
</html>
Tutte le pagine hanno il session_start