Convertire Timestamp dopo While
-
Salve,
Ho una pagina che permette di visualizzare i log degli utenti, con data annessa, nel database la data è salvata con la funzione time(), solo che, adesso non so come convertirla in data normale :SPotete aiutarmi?
Ecco il codice attuale:
<?php //Includo la connessione al database require('config.php'); // Se non è stata definita la variabile manda l'utente alla homepage if(!isset($_SESSION['login'])) { header('Location: index.php'); exit; } elseif(mysql_num_rows(mysql_query("SELECT id_utente FROM amministratori WHERE id_utente = '{$_SESSION['login']}'")) == 0) { ?> <HTML> <HEAD> <META NAME="GENERATOR" Content="AlterVista - Editor HTML"> <META HTTP-EQUIV=Refresh CONTENT="5; URL=rcayla2.altervista.org/privata.php"> <TITLE></TITLE> </HEAD> <BODY> <strong>Non hai l'autorizzazione necessaria per vedere l'IP degli Utenti!</strong><br /><br /> ...Tra pochi secondi verrai reindirizzato alla pagina Privata...<br /> <a href="/privata.php">Se non vuoi aspettare oltre premi qui</a> </BODY> </HTML> <?php } else { ?> <HTML> <HEAD> <META NAME="GENERATOR" Content="AlterVista - Editor HTML"> <TITLE>Visualizza Log</TITLE> </HEAD> <BODY> <?php $query_ip = "SELECT user,id_utente,ip_utente,data, browser FROM ip_utenti INNER JOIN utenti ON ip_utenti.id_utente=utenti.id ORDER BY ip_utenti.data DESC LIMIT 20"; $result_query_ip = mysql_query($query_ip) OR die("Query non eseguita correttamente. ".mysql_error()); echo '<table><tr><td>'; require('menu.php'); echo '</td><td>'; echo '<table border="2"><tr><th>User</th><th>IP</th><th>Data</th><th>Browser</th></tr>'; while($a = mysql_fetch_array($result_query_ip)) echo '<tr><td>'.$a['user'].'</td><td>'.$a['ip_utente'].'</td><td>'.$a['data'].'</td><td>'.$a['browser'].</td></tr>'; echo '</table>'; echo '</td></tr></table>'; } ?> </BODY> </HTML> -
Ciao RCayla,
devi passare il timestamp come secondo parametro della funzione date.
Esempio:date('d m Y', $miotime); -
-
Se fai cosi:
<?php //Includo la connessione al database require('config.php'); // Se non è stata definita la variabile manda l'utente alla homepage if(!isset($_SESSION['login'])) { header('Location: index.php'); exit; } elseif(mysql_num_rows(mysql_query("SELECT id_utente FROM amministratori WHERE id_utente = '{$_SESSION['login']}'")) == 0) { ?> <HTML> <HEAD> <META NAME="GENERATOR" Content="AlterVista - Editor HTML"> <META HTTP-EQUIV=Refresh CONTENT="5; URL=rcayla2.altervista.org/privata.php"> <TITLE></TITLE> </HEAD> <BODY> <strong>Non hai l'autorizzazione necessaria per vedere l'IP degli Utenti!</strong><br /><br /> ...Tra pochi secondi verrai reindirizzato alla pagina Privata...<br /> <a href="/privata.php">Se non vuoi aspettare oltre premi qui</a> </BODY> </HTML> <?php } else { ?> <HTML> <HEAD> <META NAME="GENERATOR" Content="AlterVista - Editor HTML"> <TITLE>Visualizza Log</TITLE> </HEAD> <BODY> <?php $query_ip = "SELECT user,id_utente,ip_utente,data, browser FROM ip_utenti INNER JOIN utenti ON ip_utenti.id_utente=utenti.id ORDER BY ip_utenti.data DESC LIMIT 20"; $result_query_ip = mysql_query($query_ip) OR die("Query non eseguita correttamente. ".mysql_error()); echo '<table><tr><td>'; require('menu.php'); echo '</td><td>'; echo '<table border="2"><tr><th>User</th><th>IP</th><th>Data</th><th>Browser</th></tr>'; while($a = mysql_fetch_array($result_query_ip)) echo '<tr><td>'.$a['user'].'</td><td>'.$a['ip_utente'].'</td><td>'.date('d m Y', $a['data']).'</td><td>'.$a['browser'].'</td></tr>'; echo '</table>'; echo '</td></tr></table>'; } ?> </BODY> </HTML> -
-
Figurati.

Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.
Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.
Con il tuo contributo, questo post potrebbe essere ancora migliore 💗
Registrati Accedi
