The way you did it will log you in as a session. Meaning that when ever a session is created by CI your query will run that. And you will see it logged in, but you actually want to get the user not the session.
Here is how I've done it:
1-Copy the index.php into external-user folder
2- Change the System and Application path
$system_path = '../system';
$application_folder = '../application';
Assuming CI is your main site, and Q2A is in a folder.
3- Inside qa-external-users.php add the following code inside qa_get_logged_in_user() .
ob_start();
include('index.php');
ob_end_clean();
$CI =& get_instance();
$CI->load->library('session'); //if it's not autoloaded in your CI setup
Remove session_start() as the session is already started.
Replace your query with this:
$userid = $CI->session->userdata('user_id');
$result = qa_db_read_one_assoc(qa_db_query_sub(
'SELECT * FROM users WHERE id=$',
$userid
));
Of course, I don't know the way your table is setup, but you might do some changes.
Hope it help