• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Uploading files - Passing a variable in the url

#1
[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?


Messages In This Thread
Uploading files - Passing a variable in the url - by El Forum - 03-09-2008, 09:35 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.