Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 11
  1. #1

    utenti online ...........

    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

  2. #2

    Re: utenti online ...........

    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
    Vuoi vedere quanti o chi sono? perchè la cosa è molto differente..

  3. #3
    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 !

  4. #4
    ah, dimenticavo... per chiamare la funzione basta:

    codice:
    Ci sono
    <script language="javascript" type="text/javascript" src="http://www.tuosito.it/users.php?display=javascript">
          </script> utenti online
    dove users.php è il file che contiene lo script...
    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 !

  5. #5
    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

  6. #6

  7. #7
    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 !

  8. #8

  9. #9
    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 !

  10. #10
    // 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

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.