Welcome Guest, Not a member yet? Register   Sign In
javascript, authentication, and codeigniter
#1

[eluser]Devon Lambert[/eluser]
Hello all,

I'm trying to pass a user's id to a controller for processing within my upload script. The issue I am running into is that controller is being called from within a javascript file. Apparently, even though I have a logged in user, CI does not pass the appropriate authentication information.

If it helps, I am making use of redux_authentication and the Jquery Uploadify plugin.

Here is a brief code sample:

Js:
Code:
$('.uploadify').livequery(...    
        
        $(this).uploadify({
            'uploader'       : baseurl + "assets/swf/uploadify.swf",
            'script'         : baseurl + 'member/process',
            'cancelImg'      : baseurl + 'assets/css/images/uploads_images/cancel.png',
    ... });

CONTROLLER:
Code:
public function process() {

...

        // Get the user profile info
        $profile = $this->redux_auth->profile();
        
...
                
                // Add the user's id to the options array for processing
        $options['user_id'] = $profile->id;
...
}

This should all work, in my mind atleast, but the $profile object is empty, because the script does not believe it has a logged in user.

I am hoping that there's some way for me to keep the user's authenticated information behind our closed doors so to speak. In other words, I would prefer not to send the user's information through the view file, where the javascript file is called, as this feels un safe to me.

Any help is greatly appreciated.

Thank you.




Theme © iAndrew 2016 - Forum software by © MyBB