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

  • SEARCH
  • Home
  • 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 8301465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:57:49+00:00 2026-06-08T16:57:49+00:00

So I have a page for editing posts. Let’s say the user goes to

  • 0

So I have a page for editing posts. Let’s say the user goes to site.dev/post/edit/104 to get a form populated with all data for that post from the database.

I store the post id in a hidden field so it’s easier to access for some ajax components I have on the page.

Now, I can just open up FireBug and alter the post id in the hidden field no problem. What’s to stop a malicious user from making a simple script that just changes the post id and and overwrites every post id in the database with whatever they filled out in that form?

Granted, the user does have to be authenticated to access the page, and I do validate on the server side to make sure the post ID and other fields are holding acceptable values, but as long as the post id is an integer, it will update them all. I suppose this is still an issue with it being passed by query strings in the URL, but then the page at least loads all the content.

I’m a little confused on this and I can’t really think of a more ‘secure’ alternative to this right now. Is there some way to prevent this?

I am building with Codeigniter if there are any suggestions related specifically to it.

  • 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-06-08T16:57:50+00:00Added an answer on June 8, 2026 at 4:57 pm

    In order to make your variables more secure you can use the CI’s Encryption Class. You just have to set an encryption key in your config file, load the library in your controller & encrypt the ID with the following code:

    $id = 1;
    $encrypted_id = $this->encrypt->encode($id);
    

    So, when you print the URL, instead of printing directly the id as an integer, print the encrypted_id. The user will have no idea of what this means and, as long as it doesn’t have your key, it can’t decode the id 😀

    When you receive the encoded id, you can decode it by using the decode() method of the encryption class.

    For more information visit:
    http://codeigniter.com/user_guide/libraries/encryption.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an edit page I want to use to allow editing of user
I have a page on my site with a form for editing event information
Let's say you have this scenario:a simple blog home-page that loads both static content
In my MVC application I have a page for a user editing their account
I have a wordpress site where I editing some page, but I notice that
I am using spring security and have an admin jsp page for editing user
I have a MVC page which allows creation and editing of a subcontract. When
I have this function to unlock a list the user is currently editing: function
I'm new to template editing in wordpress and I'm trying to get a page
Project type: Asp MVC 2/NHibernate/C# Problem If you have an edit page in an

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.