Welcome Guest, Not a member yet? Register   Sign In
FreakAuth - keep session alive in flash-call (fancyupload)
#1

[eluser]Skinnpenal[/eluser]
Hi guys!

I'm trying to implement Fancyupload - a script for uploading files via flash, and by that getting progress bars on the transfers.

In my application I use FreakAuth for authentication.

How can I get the flash script accepted by FreakAuth?

I've been trying to supply the session ID via the url:
controller/action?PHPSESSID=.....

And getting the session_id like this:
Code:
$this->input->cookie($this->db_session->sess_cookie);

I suspect that last line of being wrong, and in that case.. how can I retrieve the session id from FreakAuth?

EDIT:
When I print the contents of $_GET, it's empty. Might that be reason for this failing? In that case, how can I fix the issue then? Smile
#2

[eluser]hybriid[/eluser]
$_GET is disabled in CI, try using

url: controller/action/session_id

and then access it with

$this->uri->segement(3)

or

function action($session_id){
...
}
#3

[eluser]Skinnpenal[/eluser]
ah.. good point, thanks! Smile

Any ideas how I can get FreakAuth to use this session id?
#4

[eluser]hybriid[/eluser]
sorry, can't help you there, i haven't used freakauth.
#5

[eluser]Wimm_vw[/eluser]
I try to do the same thing. Has anyone found a solution to this matter?

I am getting my login form underneath when I try to upload the files....
#6

[eluser]runrun[/eluser]
@skinpennal can you post your PHP code in your fancyupload ? I dont know how to get it work.
#7

[eluser]alant[/eluser]
This isn't a FreakAuth problem.. it's just that Flash objects basically behave like separate browsers and so they lose the session that you want them to use.

FancyUpload provides a way of posting the ci_session..

The following will make FancyUpload play nicely with any sort of session-based stuff that you're doing with CI.

--

When you initialise Fancyupload, make sure that appendCookieData is set to true.

Code:
appendCookieData: true

Make sure that in your ci_session config, that you are NOT matching useragents:

Code:
$config['sess_match_useragent']    = FALSE; // Because Flash is being used

And then you need to change the sess_read function in the Session library. You should really do this by creating your own MY_Session library... add the following lines below the session cookie check:

Code:
// Has the session id been posted?
        // Used for when Flash is involved
        if ($session === FALSE) {
            $session = $this->CI->input->post($this->sess_cookie_name);
        }

So the beginning of the sess_read function will look like this:
Code:
function sess_read()
    {
        // Fetch the cookie
        $session = $this->CI->input->cookie($this->sess_cookie_name);

        // Has the session id been posted?
        // Used for when Flash is involved
        if ($session === FALSE) {
            $session = $this->CI->input->post($this->sess_cookie_name);
        }


Not sure if this is the best way to do it.. but it works for me!




Theme © iAndrew 2016 - Forum software by © MyBB