CodeIgniter Forums

Full Version: Uploading files - Passing a variable in the url
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Kemik[/eluser]
Hello,

Take a look at this example please. Notice I add the $album_id to the end of the url on the manage photos link.

I want to create a page where the uploaded photo's is inserted in to the database along with the user_id and group_id. Getting the user_id is easy as it's in the session. The group_id must be pulled from the url. Easy enough.

However, I add a security check on page load to see if the user has admin over that album.

Code:
if (!logged_in()) {
            redirect('user/login');
            return;
        } elseif (!$this->uri->segment(3)) {
            show_error('No Album ID passed.');
        } elseif (!$this->photo_model->author_check($this->session->userdata('user_id'), $this->uri->segment(3))) {
            show_error('Only album authors may upload code.');
        } else {
            $this->session->set_flashdata('album_id', $this->uri->segment(3));
        }

When I go to submit the form the url changes to url.com/photos/upload/upload changing the 3rd uri segment to upload.

I cannot think of any way around this problem. Do you have any suggestions?