// $db_host = "95.110.147.51"; $db_host = "localhost"; $db_user = "forum"; $db_password = "iCd4Hpw5"; $db1_name = "reteluna-forum"; $db2_name = "reteluna-forum"; $db3_name = "reteluna-forum"; $db4_name = "reteluna-forum"; $db5_name = "reteluna-forum"; $home_dir = 'http://forum.reteluna.it/'; $minmodlevel = 200; $minsmodlevel = 300; $minadminlevel = 400; $forum_field = 301; $l_scrittura=7; $l_lettura=3; $l_visibile=2; $l_invisibile=1; $kernel="Apollonius v0.3"; ?> $connessione = @mysql_connect($db_host, $db_user, $db_password) or die ("Errore nella connessione al database."); ?> $db1 = @mysql_select_db($db1_name,$connessione); $query_templates = "SELECT cartella FROM templates WHERE attivo=1"; $query_templates_results = @mysql_query ($query_templates, $connessione); $results_templates=@mysql_fetch_array($query_templates_results); $cartella_templates = $results_templates['cartella']; ?> if (empty($HTTP_COOKIE_VARS)) { $iflogged = -1; } if (!(isset($HTTP_COOKIE_VARS))) { $iflogged = 0; } if (isset($HTTP_COOKIE_VARS)) { $dati = $HTTP_COOKIE_VARS["datilogin"]; list ($nick, $pass, $expire) = explode(":", $dati); if ( ! get_magic_quotes_gpc() ) { $nick = mysql_escape_string($nick); $pass = mysql_escape_string($pass); } $query_utente = "SELECT ID, password FROM $db1_name.utenti WHERE nick='$nick'"; $query_utente_results = @mysql_query ($query_utente, $connessione); $query_global = "SELECT valore_int FROM $db1_name.global WHERE nome='lerror_num'"; $query_global_results = @mysql_query ($query_global, $connessione); $row_global=@mysql_fetch_array($query_global_results); $lerror_num=$row_global['valore_int']; $query_global = "SELECT valore_int FROM $db1_name.global WHERE nome='lerror_bantime'"; $query_global_results = @mysql_query ($query_global, $connessione); $row_global=@mysql_fetch_array($query_global_results); $lerror_bantime=$row_global['valore_int']; $lasttime = ($lerror_bantime * 60); $lastdata = (time() - $lasttime); $num = @mysql_num_rows($query_utente_results); if ($num>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; } } ?> $act_ip = $_SERVER['REMOTE_ADDR']; $act_host = @gethostbyaddr("$act_ip"); while (!(isset($id_ip))) { $db1 = @mysql_select_db($db1_name,$connessione); $query_ip = "SELECT ID FROM ip WHERE ip=\"$act_ip\" AND host=\"$act_host\""; $query_ip_results = @mysql_query ($query_ip, $connessione); $num = @mysql_num_rows($query_ip_results); if ($num>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); } } ?> $db1 = @mysql_select_db($db1_name,$connessione); $query_gconferma = "SELECT valore_int FROM global WHERE nome=\"giorni_conferma\""; $query_gconferma_results = @mysql_query ($query_gconferma, $connessione); $results_gconferma=@mysql_fetch_array($query_gconferma_results); $gconferma = $results_gconferma[valore_int]; $timeconferma = (time() - ($gconferma * 86400)); $query_activecontrol = "DELETE FROM utenti WHERE reg_data < $timeconferma AND active=0"; $query_activecontrol_results = @mysql_query ($query_activecontrol, $connessione); ?>