ariciao
oggi per me è una giornata difficilissima...
allora risolta ormai del tutto la registrazione utenti
ho dei grossi problemi con il login
questa è la pagina del log
nn riesco a capire dove cavolo possa essere l'errore...
mi affido a voi... genietti...
contate che utenti_ins è il nome del database
user è il campo nome utente all'interno del db
e psw e il campo password all'interno del db
Codice PHP:
<?php
mysql_connect("localhost", "...", "...") or die(mysql_error());
mysql_select_db("...") or die(mysql_error());
if(isset($_COOKIE['ID_my_site']))
{
$username = $_COOKIE['ID_my_site'];
$pass = $_COOKIE['Key_my_site'];
$check = mysql_query("SELECT * FROM utenti_ins WHERE user = '$user'")or die(mysql_error());
while($info = mysql_fetch_array( $check ))
{
if ($pass != $info['password'])
{
}
else
{
echo "dovrebbe aver visto i cookie???";
}
}
}
if (isset($_POST['submit'])) {
if(!$_POST['user'] | !$_POST['psw']) {
die('You did not fill in a required field.');
}
if (!get_magic_quotes_gpc()) {
$_POST['email'] = addslashes($_POST['email']);
}
$check = mysql_query("SELECT * FROM utenti_ins WHERE user = '".$_POST['user']."'")or die(mysql_error());
$check2 = mysql_num_rows($check);
if ($check2 == 0) {
die('nn esiste questo utente <a href=cond.php>registrati</a>');
}
while($info = mysql_fetch_array( $check ))
{
$_POST['psw'] = stripslashes($_POST['psw']);
$info['password'] = stripslashes($info['password']);
$_POST['psw'] = md5($_POST['psw']);
if ($_POST['psw'] != $info['psw']) {
die('password sbagliata...');
}
else
{
// if login is ok then we add a cookie
$_POST['user'] = stripslashes($_POST['user']);
$hour = time() + 3600;
setcookie(ID_my_site, $_POST['user'], $hour);
setcookie(Key_my_site, $_POST['psw'], $hour);
//then redirect them to the members area
die('dovrebbe aver fatto il log...');
}
}
}
else
{
?>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
<h1>Login</h1>
Username: <input type="text" name="user" maxlength="40">
Password: <input type="password" name="psw" maxlength="50">
<input type="submit" name="submit" value="Login">
</form>
<?php
}
?>
grassie milisime!