Raga ho recuperato da un vecchio post su AV il codice per il login del Forum alla Home.. ho creato la home con il link a una pagina : login.php
Nella login.php c'è il seguente codice..
Codice:
<?php
$db_hostname = "localhost";
$db_username = "webhosting";
$db_password = "******";
$db_name = "my_webhosting";
$dbcon = mysql_connect($db_hostname, $db_username, $db_password);
mysql_select_db("$db_name");
$login = " <p><span class="genmed">
<form action="phpBB2/login.php" method="post">
<input value="../index.php" name="redirect" type="hidden">
Username:<br /><input size="15" name="username" type="text" class="post"><br />
Password:<br /><input size="15" name="password" type="password" class="post"><br />
<br />
<input value="ON" name="autologin" type="hidden">
<input value="Login" name="login" class="mainoption" type="submit"></form><br /><br />
<a class="gensmall" href="phpBB2/profile.php?mode=sendpassword">Ho dimenticato la password</a><br />
<br />
Non hai ancora un account?<br />
Ti puoi <a href="phpBB2/profile.php?mode=register">registrare</a> gratuitamente</span>
</span></p>n";
if (isset($HTTP_COOKIE_VARS[tfkbb2log_sid])) {
$session_id = $HTTP_COOKIE_VARS[tfkbb2log_sid];
$query = "SELECT session_id, session_user_id, session_logged_in FROM bb_sessions WHERE session_id='$session_id'";
$result = mysql_query($query, $dbcon);
$row = mysql_fetch_array($result);
if ($session_id === $row[session_id]) {
if ($row[session_logged_in] == "1") {
$query2 = "SELECT username FROM bb_users WHERE user_id='$row[session_user_id]'";
$result2 = mysql_query($query2, $dbcon);
$row2 = mysql_fetch_array($result2);
echo "Benvenuto $row2[username]";
}
else {
echo $login;
}
}
else {
echo $login;
}
}
else {
echo $login;
}
?>
mi da errore.. ki mi aiuta a scriverlo giusto??