fill_whoisonline.php 918 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * This script contains a data filling procedure for users
  4. * @author Julio Montoya <gugli100@gmail.com>
  5. *
  6. */
  7. /**
  8. * Initialisation section
  9. */
  10. require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
  11. /**
  12. * Loads the data and injects it into the Dokeos database, using the Dokeos
  13. * internal functions.
  14. * @return array List of user IDs for the users that have just been inserted
  15. */
  16. function fill_whoisonline() {
  17. $table_e_online = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
  18. $max = 100;
  19. //Cleaning the table
  20. $sql = "TRUNCATE $table_e_online";
  21. $rs = Database::query($sql);
  22. //filling the table
  23. for ($i=1;$i <=$max;$i++) {
  24. $date = api_get_utc_datetime();
  25. $sql = "INSERT INTO $table_e_online (login_id, login_user_id, login_date, login_ip, course, session_id, access_url_id)
  26. VALUES ('$i', '$i', '$date', '127.0.0.1', '', '0','1')";
  27. $rs = Database::query($sql);
  28. }
  29. }