Language: PHP
Label: vulnerable
CWE: CWE-829 \u2014 Inclusion of Functionality from Untrusted Control Sphere
The product imports, requires, or includes executable functionality (such as a library) from a source that is outside of the intended control sphere.

Code:
 function add_login_info(int $user_id) {
    global $table_prefix;	// table prefix;
    global $conn;			// MySQL connection variable.

    $user_ip = safe_input(get_ipaddr());
    $user_aggent = safe_input($_SERVER['HTTP_USER_AGENT']);
    
    // Insert User information Into Database
    $conn->query("INSERT INTO {$table_prefix}users_login_history (login_users_id, login_ip, login_user_aggent) 
                        VALUES ('{$user_id}', '{$user_ip}', '{$user_aggent}')");
    
}