0) { $results_utente=@mysql_fetch_array($query_utente_results); $userid = $results_utente['ID']; $query_ban = "SELECT ID FROM $db1_name.storico WHERE id_utente=$userid AND azione='loginerror' AND data>$lastdata"; $query_ban_results = @mysql_query ($query_ban, $connessione); $nban = @mysql_num_rows($query_ban_results); $ban=0; if ($nban) { if ($nban>=$lerror_num) { $ban=1; } } if ((!$ban) && ($results_utente['password']==$pass)) { $iflogged = 1; if ($expire>0) { $query_cookiedays = "SELECT valore_int FROM global WHERE nome='cookie_days'"; $query_cookiedays_results = @mysql_query ($query_cookiedays, $connessione); $results_cookiedays=@mysql_fetch_array($query_cookiedays_results); $cookiedays = $results_cookiedays['valore_int']; $newcookieexpires = time() + ($cookiedays * 86400); } else { $newcookieexpires=0; } setcookie ("datilogin", $dati, $newcookieexpires) ; } else { $iflogged = -2; } } else { $iflogged = -2; } } ?>0) { $results_ip=@mysql_fetch_array($query_ip_results); $id_ip = $results_ip['ID']; } else { $query_ip_insert = "INSERT INTO ip (ip, host) VALUES ('$act_ip', '$act_host')"; $query_ip_insert_results = @mysql_query ($query_ip_insert, $connessione); } } if ($iflogged<1) { $query_guest = "SELECT ID FROM utenti WHERE nick=\"guest\""; $query_guest_results = @mysql_query ($query_guest, $connessione); $results_guest=@mysql_fetch_array($query_guest_results); $userid = $results_guest['ID']; } $query_sessiontime = "SELECT valore_int FROM global WHERE nome=\"session_time\""; $query_sessiontime_results = @mysql_query ($query_sessiontime, $connessione); $results_sessiontime=@mysql_fetch_array($query_sessiontime_results); $sessiontime = $results_sessiontime['valore_int']; $lasttime = ($sessiontime * 60); $lastdata = (time() - $lasttime); while (!(isset($session_lastdata))) { $query_session = "SELECT ID, last_data FROM sessioni WHERE id_ip=$id_ip AND id_utente=$userid AND last_data>$lastdata"; $query_session_results = @mysql_query ($query_session, $connessione); $num = @mysql_num_rows($query_session_results); if ($num>0) { $results_session=@mysql_fetch_array($query_session_results); $session_id = $results_session['ID']; $session_lastdata = $results_session['last_data']; $new_last_data = time(); $query_sessiontime = "UPDATE sessioni SET last_data=$new_last_data WHERE ID=$session_id"; $query_sessiontime_results = @mysql_query ($query_sessiontime, $connessione); } else { $now_data = time(); $query_ip_insert = "INSERT INTO sessioni (id_ip, id_utente, create_data, last_data) VALUES ($id_ip, $userid, $now_data, $now_data)"; $query_ip_insert_results = @mysql_query ($query_ip_insert, $connessione); } } ?> Ricerca - Reteluna Forum