Salve, ho un form LOGIN, una INDEX accessibile sono a chi è loggato, un file di CONNESSIONE al database!!!
Ora volevo sapere come posso fare, quando un utente si logga, a far vedere nella index il suo "user" prelevato dal database!?!?!?!?
Vi posto i codici:
login_success.php
Codice PHP:
<?php
session_start();
if(isset($_SESSION['username'])) {
}
if(!session_is_registered(myusername)){
header("location:main_login.php");
}
?>
<div id='content'>
<h1><strong>Benvenuto</strong></h1>
<p></p>
</div>
login & register
Codice PHP:
<!-- index e i 2 forms-->
<table width="300" border="0" align="left" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="form1" method="post" action="checklogin.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3"><strong>Member Login </strong></td>
</tr>
<tr>
<td width="78">Username</td>
<td width="6">:</td>
<td width="294"><input name="myusername" type="text" id="myusername"></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input name="mypassword" type="text" id="mypassword"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
<br>
<br>
<br>
<br>
<br>
<br>
<div style="text-align: right">
<table border="0" cellspacing="1" cellpadding="0" width="300" align="right" bgcolor="#cccccc"><tbody>
<tr><form action="provaregistrazione.php" method="post"> <input name="phpMyAdmin" type="hidden" value="V0N0db6Fl62QWr6eBkly75xAGn3" /><td>
<table border="0" cellspacing="1" cellpadding="3" width="100%" bgcolor="#ffffff"><tbody>
<tr>
<td colspan="3"><strong>Registrazione</strong></td>
</tr>
<tr>
<td width="78">Nome</td>
<td width="6">:</td>
<td width="294"><input id="username" name="username" type="text" /></td>
</tr>
<tr>
<td width="78">Cognome</td>
<td width="6">:</td>
<td width="294"><input id="username" name="username" type="text" /></td>
</tr>
<tr>
<td width="78">Email</td>
<td width="6">:</td>
<td width="294"><input id="username" name="username" type="text" /></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input id="password" name="password" type="password" /></td>
</tr>
<tr>
<td></td>
<td></td>
<td><input name="Submit" type="submit" value="Registrati" /></td>
</tr>
</tbody></table>
</td>
</form></tr>
</tbody></table>
</div>