Lo so che non realizza nessuna pagina ma per fare una pagina diversa per ogni utente senza crearne per forza 57 diverse ne servirebbe una dinamica... è quello il mio vero problema...cioè che non so come strutturare la pagina in questione.
Comunque questo è il codice dell'index con annesso login:
Codice HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Studio Domus | Homepage</title>
<link rel="stylesheet" href="style.css" type="text/css" charset="utf-8" />
</head>
<body>
<div id="wrapper">
<div id="nav">
<a href="index.htm">Chi siamo</a>
<a href="dove.htm">Dove siamo</a>
<a href="servizi.htm">Servizi</a>
<a href="area_p.php">Area Privata</a>
<a href="contatti.htm">Contatti</a>
</div>
<div id="body">
<div id="body-top">
<div id="body-top-2"></div>
<div id="body-bot">
<div id="welcome">
<img src="images/pic_1.jpg" width="231" height="301" alt="Pic 1" />
<h2>Benvenuti</h2>
<p><table border="0" cellspacing="1" cellpadding="0" width="200" align="center" bgcolor="#768cb3"><tbody>
<tr><form action="checklogin.php" method="post"> <input name="phpMyAdmin" type="hidden" value="V0N0db6Fl62QWr6eBkly75xAGn3" /><td>
<table border="0" cellspacing="1" cellpadding="3" width="200" bgcolor="#768cb3"><tbody>
<tr>
<td colspan="3"><strong>Accesso area riservata</strong></td>
</tr>
<tr>
<td width="78">ID:</td>
<td width="6">:</td>
<td width="116"><input id="myusername" name="myusername" type="text" /></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input id="mypassword" name="mypassword" type="password" /></td>
</tr>
<tr>
<td></td>
<td></td>
<td><input name="Submit" type="submit" value="Login" /></td>
</tr>
</tbody></table>
</td>
</form></tr>
</tbody></table></p>
<p> </p>
<p> </p>
</div>
<div id="content">
<h2>La nostra azienda.</h2>
<p>balblallbllalblalblla</p>
<p>blablalblalblal.</p>
<div class="fineline"></div>
<h2>I nostri condòmini:</h2>
<div id="picbar">
<div id="arr-left">
<a href=""><img src="images/arr_left.gif" width="15" height="90" alt="Arr Left" /></a>
</div>
<div class="picbox">
<a href=""><img src="images/pic_3.jpg" width="117" height="74" alt="Pic 3" /></a>
</div>
<div class="picbox">
<a href=""><img src="images/pic_4.jpg" width="117" height="74" alt="Pic 4" /></a>
</div>
<div class="picbox">
<a href=""><img src="images/pic_5.jpg" width="117" height="74" alt="Pic 5" /></a>
</div>
<div id="arr-right">
<a href=""><img src="images/arr_right.gif" width="15" height="90" alt="Arr Right" /></a>
</div>
<div class="clear"></div>
</div>
<div class="fineline-flat"></div>
<div id="planer">
<h2>Regolamenti.</h2>
<div class="fineborder"><img src="images/pic_6.jpg" width="186" height="79" alt="Pic 6" /></div>
<p>Regolamenti per una sana vita condominiale tra vicini.</p>
<p class="more"><a href="regolamenti.htm" class="bar-lit">Altro</a></p>
</div>
<div id="stories">
<h2>Carte e richieste.</h2>
<div class="fineborder"><img src="images/pic_7.jpg" width="186" height="79" alt="Pic 7" /></div>
<p>Per blablabla blabla</p>
<p class="more"><a href="carte.htm" class="bar-lit">Altro</a></p>
</div>
<div class="clear-flat"></div>
</div>
<div class="clear"></div>
</div>
</div>
</div>
<div id="footer">
<p>© Ruolo. All rights reserved</p>
</div>
</div>
</body>
</html>
Questo invece è la registrazione:
Codice HTML:
<?php
$host="localhost";
$username="eleon";
$password="";
$db_name="my_eleon";
$tbl_name="Iscrizione";
$db = mysql_connect($localhost,$username,$password);
mysql_select_db($db_name,$db);
$username = $_POST['username'];
$password = $_POST['password'];
mysql_query("INSERT INTO ".$tbl_name." (username,password,nome,cognome,citta,indirizzo_email,data_nascita) VALUES ('$username','$password','$nome','$cognome','$citta','$indirizzo_email','$data_nascita')",$db) || die(mysql_error());
mysql_close($db);
?>
E poi ovviamente c'è il check login:
Codice HTML:
<?php
$host="localhost";
$username="eleon";
$password="";
$db_name="my_eleon";
$tbl_name="Iscrizione";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("myusername");
session_register("mypassword");
header("location:login_success.php");
}
else {
echo "Attenzione username o password errati";
}
?>
E il login success:
Codice HTML:
<?php
session_start();
if(!session_is_registered(myusername)){
header("location:");
}
?>
Se possono servire... li ho postati