fill_whoisonline.php 817 B

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