Welcome Guest, Not a member yet? Register   Sign In
getting freakauth light login username
#1

[eluser]alectrash[/eluser]
Does anyone know how to query the ci_sessions table with a logged in users session id to find that persons username with freakauth light.

I have linked a flash file uploader into my CI code but it needs to know where the uploaded file shall go and I want to put it in a folder with thatb person username.

A really secure way I feel would be to send the flash object the session id as a parameter.

Therefore if people saved the html page and modified the flash session parameer it would throw an error it wont work.

Any ideas anyone?
#2

[eluser]Jimmy - IND[/eluser]
@param string $prop can be 'id', 'user_name', 'country_id', 'email', 'role', 'last_visit', 'created', 'modified'
@return prop string of currently logged in user
@return empty string if user not logged in or prop unknown

$this->freakauth_light->getUserProperty($prop);

or use to get just the username directly .

$this->freakauth_light->getUserName();
#3

[eluser]alectrash[/eluser]
I tried that but it will only work if it recognises you are logged in.

At moment I am making the call to the php script from the flash object which is not logged in, I therefore send the session id to flash as a variable which comes back to the php as $sent_session_data.

I then use following code to get username.

Code:
$query = $this->db->where('session_id', $sent_session_id)->get('ci_sessions');
                
  foreach($query->result() as $row)
  {
    $user_array = $row->session_data;
  }  
    
  $sess_data = explode('"', $user_array);
    
  $username = $sess_data[7];

  $filepath = "/var/uploaded_files/" . $username;




Theme © iAndrew 2016 - Forum software by © MyBB