Non riesco a fare il mio form per accedere al sito.
E' fatto da 3 files:
signin.php:
cp.php, nella cartella siteCodice:<!DOCTYPE html> <html> <head> <title>TiKiWiKi - Accedi</title> </head> <body> <p> Accedi con il tuo username e la tua password:<br><br> <form action='site/cp.php' method='post'> Username: <input type='text' name='username'><br><br> Password: <input type='password' name='password'><br><br> <input type='submit' value='Accedi'> </form> </p> </body> </html>
index.php, nella cartella /site/edit/Codice:<!DOCTYPE html> <html> <head> <title>Pannello di controllo - TiKiWiKi</title> </head> <body> <p> <?php if (!isset($_POST['username']) and !isset($_POST['password'])) : echo "Mancano alcuni dati. <a href='../signin.php'>Indietro</a>."; else : if (!@mysql_connect('tikiwiki.altervista.org', 'tikiwiki', 'censura')) : echo "Impossibile accedere. Riprova più tardi.<br>"; endif; if (!@mysql_select_db('my_tikiwiki')) : echo "Impossibile trovare il set di siti web. Errore critico.<br>"; endif; $username = $_POST['username']; $sql = "SELECT password FROM sites WHERE username='$username'"; $password = mysql_fetch_row($sql); if ($_POST['password'] == $password[0]) : echo "Attendi...</body><head><meta http-equiv='refresh' content='1; url=edit'></head><body>"; else: echo 'Errore'; echo mysql_error(); endif; endif; ?> </body> </html>
Quando inserisco i dati di accesso (sono già presenti nel db), in cp.php mi mostra la stringa Errore, senza nemmeno mostrare l' errore mysql.Codice:<!DOCTYPE html> <html> <head> <title>Pannello di controllo</title> </head> <body> <p> <?php if ($_GET['cp'] == 'on') :?> <a href='newpage.php'><img class='cp-left' src='../../img/newpage.png'> <a href='editpage.php'><img class='cp-center' src='../../img/editpage.png'> <a href='http://www.dot.tk'><img class='cp-right' src='../../img/dot-tk.png'> <?php else :?> echo "Errore di autenticazione :-( sigh..."; <?php endif; ?> </p>

LinkBack URL
About LinkBacks
