Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7068789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:22:01+00:00 2026-05-28T05:22:01+00:00

Disclaimer : I’m new to web development. Scenario : I’ve built an application using

  • 0

Disclaimer: I’m new to web development.

Scenario: I’ve built an application using CodeIgniter that would be best described as an event calendar. There is a shared feature in the application that allows you to share your event calendar with another individual. When logged in, a user can travel to the shared page, and choose from a list of those who have shared their event calendars with them. Currently, when a user selects the name of the person who has shared their event calendar with them, the following URI is generated:

http://example.com/folder/controller/method/id

The id section is the the owner_id in the database of the user who has shared their calendar with the individual.

Issue: It’s easy to go change the id section of the URL to another user’s owner_id in the database. This allows whoever does so to access the event calendar of an individual who has not authorized the sharing of their event calendar.

Question: What are some methods to resolve this security gap? Please let me know if there is anything else that I need to provide, or explain in a clearer fashion. Thanks in advance for your time and energy.

Model:

class Shares_model extends crud_model {

    public function __construct()
    {
        parent::__construct();

        $this->pk = 'id';
        $this->table_name = 'shares';
    }

    public function get($shared_to_user_id)
    {
        $this->db->where('shared_to_id', $shared_to_user_id);
        $ids = parent::get_all();

        $users = array();

        foreach ($ids as $id)
        {
            $users[$id->owner_id]['owner_id'] = $id->owner_id;
            $users[$id->owner_id]['owner_first_name'] = $id->owner_first_name;
            $users[$id->owner_id]['owner_last_name'] = $id->owner_last_name;
        }

        return $users;
    }   
}

View:

<div class="panel">
    <h4>Shared Planners</h4>
        <ol>
            <?php foreach($sharers as $s): ?>
            <li><a href="<?php echo base_url('user/shared/view/'.$s['owner_id']) ?>"><strong><?php echo $s['owner_first_name']." ".$s['owner_last_name'] ?></strong></a></li>
            <?php endforeach; ?>
        </ol>
</div>

Controller:

class Shared extends Common_Auth_Controller {

    private $end_user;

    public function __construct()
    {
        parent::__construct();

        $this->end_user = $this->ion_auth->user()->row();
        $data['end_user'] = $this->end_user;
        $this->load->vars($data);

        $this->load->model('events_model', 'events');
    }

    public function index()
    {
        $title['title'] = 'Shared';

        $this->load->model('shares_model','shares');

        $data['sharers'] = $this->shares->get($this->end_user->id);

        $this->load->view('public/head_view', $title);
        $this->load->view('user/header_view');
        $this->load->view('user/shared_view', $data);
        $this->load->view('user/footer_view');
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:22:01+00:00Added an answer on May 28, 2026 at 5:22 am

    Use the below logic

     <?php
                // Check if user is logged in 
                if (!$this->ion_auth->logged_in())
                {
                    //Not logged in , so redirect them to login page
                    redirect('account/login', 'refresh');
                }
    
                else{
                // So the user is logged in 
                // Get the id of the currently logged in user ( The user who is trying to view the page )
                $current_user = $this->ion_auth->get_user();
                $current_userid = $current_user->id;
    
    
                // you need an array of users who have been invited to that event by the event creator
                // As you mentioned you are storing the users who have been invited in db, get the ids to an array 
    
                $invited_users = getIdsOfusers();
    
                if (in_array($current_userid, $invited_users)) {
                    // Yes, The user who is trying to view the page has access
                    // you can show him the respective view
                }
                else {
                    // No, The user who is trying to view the page Doesn't have  access
                    show_error('You dont have access !' ,500 );
                }
        }
    
        ?>      
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Disclaimer: I'm completely clueless about .net and COM. I have a vendor's application that
Disclaimer: I'm completely new to Java EE/EJB and all that, so bear with me.
Disclaimer: super new to rails. I'm using Rails 3.2 Anyways, I'm trying to create
Disclaimer: I am very new to iOS development. Please excuse the possible stupidity of
(Disclaimer: I'm a beginner in mobile application development and I'm quite weak with programming
Disclaimer: I'm new to GWT/PlayN, so this might be an obvious mistake that I'm
Disclaimer: I'm new to unit testing and just getting my feet wet. That being
Disclaimer: the following is a sin against XML. That's why I'm trying to change
Disclaimer: I'm fairly new to python! If I want all the lines of a
Disclaimer Yes, I am fully aware that what I am asking about is totally

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.