mi serve uno script da scaricare oppure qualcosa fatta da voi ke mi permetta di vedere gli utenti collegati sulla home del mio sito,
mi potreste aiutare?
sicuro di una vs risp vi![]()
mi serve uno script da scaricare oppure qualcosa fatta da voi ke mi permetta di vedere gli utenti collegati sulla home del mio sito,
mi potreste aiutare?
sicuro di una vs risp vi![]()
C3 Comunicazione a 360° Realizzazione siti internet I Realizzazione siti web Catania | Creazione siti web Catania
Vuoi vedere quanti o chi sono? perchè la cosa è molto differente..Originariamente inviato da vinarcid0810
mi serve uno script da scaricare oppure qualcosa fatta da voi ke mi permetta di vedere gli utenti collegati sulla home del mio sito
questo script funziona abbastanza bene.. devi creare una tabella chimata users_online con i campi id (auto_increment e chiave primaria), ip (TEXT) e timestamp (TEXT)
codice:<?php /* ################# ## INFORMATION ## ################# Users Online v 1.0 by Nate Davis (darknuke) - http://www.darknuke.com This script is copyright to Nate Davis. Released on July 5th, 2003 ########### ## TERMS ## ########### This script is open source, distribute it freely as you please. Giving me credit would be nice.. :-D */ global $REMOTE_ADDR, $display; ############### ## VARIABLES ## ############### // CONFIGURABLE $data_refresh = 600; // how long before an entry will be deleted in seconds // DATABASE CONFIGURATION $db_host = "localhost"; $db_user = "xxxxx"; $db_pass = "xxxxx"; $db_name = "xxxxx"; $db_table = "users_online"; // DO NOT EDIT UNLESS YOU KNOW WHAT YOUR DOING $timestamp = time(); // timestamp variable $user_ip = $REMOTE_ADDR; // IP address variable // QUERIES $online_query = "SELECT * FROM {$db_table}"; $exists_query = "SELECT ip FROM {$db_table} WHERE ip='{$user_ip}'"; $update_query = "UPDATE {$db_table} SET timestamp='{$timestamp}' WHERE ip='{$user_ip}'"; $insert_query = "INSERT INTO {$db_table} (ip, timestamp) VALUES ('{$user_ip}', '{$timestamp}')"; // the delete query is not in this list because it requires the $data array in the delete case ################## ## BEGIN SCRIPT ## ################## // CONNECT TO DATABASE $mysql_link = mysql_connect($db_host, $db_user, $db_pass); mysql_select_db($db_name); // ADD/EDIT ENTRY if (mysql_num_rows(mysql_query($exists_query)) == 0) { mysql_query($insert_query); } else { mysql_query($update_query); } // DELETE OLD ENTRIES $online = mysql_query($online_query); while($data=mysql_fetch_assoc($online)) { $difference = $timestamp - $data[timestamp]; if ($difference > $data_refresh) { // DELETE QUERY $delete_query = "DELETE FROM {$db_table} WHERE timestamp='$data[timestamp]'"; mysql_query($delete_query); $users_online = $users_online - 1; } } $users_online = mysql_num_rows(mysql_query($online_query)); ################ ## END SCRIPT ## ################ ################ ## PRINT DATA ## ################ if ($display == "javascript") { print "document.write('"; } if ($users_online > 1) { print "<span class=title>$users_online</span>"; } elseif ($users_online == "1") { print "<span class=title>$users_online</span>"; } elseif ($users_online == "0") { print "0"; } if ($display == "javascript") { print "');"; } ?>
I'm your dreams, make you real... I'm your eyes when you must steel...I'm pain when you can't feel...sad but true !
ah, dimenticavo... per chiamare la funzione basta:
dove users.php è il file che contiene lo script...codice:Ci sono <script language="javascript" type="text/javascript" src="http://www.tuosito.it/users.php?display=javascript"> </script> utenti online![]()
I'm your dreams, make you real... I'm your eyes when you must steel...I'm pain when you can't feel...sad but true !
x Hornwind
non funziona ho fatto tutto come hai detto tu ma nulla,
ho creato la il database e la relativa tabella con i campi necessari il file php ma nulla.
appena entro nella pagina si apre una finestra con il seguente msg "errore di debug eseguire il debug? riga 1 errore sintassi
C3 Comunicazione a 360° Realizzazione siti internet I Realizzazione siti web Catania | Creazione siti web Catania
ecco il sito
clicca
C3 Comunicazione a 360° Realizzazione siti internet I Realizzazione siti web Catania | Creazione siti web Catania
ma sei sicuro di aver creato il file users.php ? http://fantamaneger.135.it/users.php mi dice pagina inesistente...![]()
I'm your dreams, make you real... I'm your eyes when you must steel...I'm pain when you can't feel...sad but true !
si sicuro![]()
C3 Comunicazione a 360° Realizzazione siti internet I Realizzazione siti web Catania | Creazione siti web Catania
hai configurato i paramentri del db nello script ? ...è assurdo, deve funzionare per forza... oltre tutto è di una banalità pazzesca...
I'm your dreams, make you real... I'm your eyes when you must steel...I'm pain when you can't feel...sad but true !
// DATABASE CONFIGURATION
$db_host = "localhost";
$db_user = "vinarcid0810";
$db_pass = "xxxxxx";
$db_name = "my_vinarcid0810";
$db_table = "users_online";
xxxxxx=la mia pass
e poi
Ci sono
<script language="javascript" type="text/javascript" src="http://fantamaneger.135.it/users.php?display=javascript">
</script> utenti online
C3 Comunicazione a 360° Realizzazione siti internet I Realizzazione siti web Catania | Creazione siti web Catania