You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							18 lines
						
					
					
						
							665 B
						
					
					
				
			
		
		
	
	
							18 lines
						
					
					
						
							665 B
						
					
					
				<?php
 | 
						|
/* For licensing terms, see /license.txt */
 | 
						|
 | 
						|
require_once __DIR__.'/../inc/global.inc.php';
 | 
						|
api_protect_admin_script();
 | 
						|
 | 
						|
$tableUser = Database::get_main_table(TABLE_MAIN_USER);
 | 
						|
$userInfo = api_get_user_info(api_get_user_id());
 | 
						|
if (isset($userInfo['last_login'])) {
 | 
						|
    $sql = "SELECT login_user_id, MAX(login_date) login_date from track_e_login group by login_user_id";
 | 
						|
    $result = Database::query($sql);
 | 
						|
    while ($row = Database::fetch_array($result)) {
 | 
						|
        $date = $row['login_date'];
 | 
						|
        $userId = $row['login_user_id'];
 | 
						|
        $sql = "UPDATE $tableUser SET last_login ='$date' WHERE user_id = $userId";
 | 
						|
        Database::query($sql);
 | 
						|
    }
 | 
						|
}
 | 
						|
 |