CodeIgniter Forums
FreakAuth - keep session alive in flash-call (fancyupload) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: FreakAuth - keep session alive in flash-call (fancyupload) (/showthread.php?tid=9246)



FreakAuth - keep session alive in flash-call (fancyupload) - El Forum - 06-18-2008

[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


FreakAuth - keep session alive in flash-call (fancyupload) - El Forum - 06-18-2008

[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){
...
}


FreakAuth - keep session alive in flash-call (fancyupload) - El Forum - 06-19-2008

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

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


FreakAuth - keep session alive in flash-call (fancyupload) - El Forum - 06-19-2008

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


FreakAuth - keep session alive in flash-call (fancyupload) - El Forum - 07-13-2009

[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....


FreakAuth - keep session alive in flash-call (fancyupload) - El Forum - 12-31-2009

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


FreakAuth - keep session alive in flash-call (fancyupload) - El Forum - 07-21-2010

[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!