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 4606164
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:31:41+00:00 2026-05-22T00:31:41+00:00

UPDATE: I added the CSRF protection like Berdir told me, with the help of

  • 0

UPDATE:

I added the CSRF protection like Berdir told me, with the help of the link below to make my application work again. However.. I’m not quite sure what I did right now 😀 How is this going to make my app more secure? I’m particularly bothered by the fact that I’m now getting a cookie value in my ajax code, because I have to pass it with my ajax call.. otherwise it just doesn’t work. Doesn’t this give away some crucial information about the cookie? Or am I just being paranoid. Thanks!

http://aymsystems.com/ajax-csrf-protection-codeigniter-20

//old
Hi.

In this web app I’m building, I have a functionality to add ‘tips and tricks’ about certain subjects. These pages can be added only by accounts with the admin role. However, I also want the ability to remove these pages. (Always handy, right). Since I’m using CodeIgniter, I was thinking of just making a controller function which takes an ID, and passes this ID to the model where the page corresponding to that ID would get deleted from the database.

Just to make this clear:

Controller:

public function del_content($id)
{
    $this->content_model->del_content($id)
}

Model:

public function del_content($id)
{
    // database code which I can't be bothered to look up now
    // something like $this->db->where(), $this->db->delete()
}

This is all really simple, but I’m scared that it might be too simple. This doesn’t really seem oh so very secure to me, is it? Since you would be able to call the function from the URL address bar in your browser, you could basically remove the whole content table through that. (Since you’d be doing http://mywebsite/controller/del_content/3 for the item with ID 3). Of course, only administrator accounts would have access to that function, but still..

I have never programmed anything like this before and thus never had to think about the security measures I should take in this case. Would anyone be kind enough to give me some things I should keep an eye out for and perhaps some ideas, suggestions, on how to make this more secure?

Thanks a lot!

  • 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-22T00:31:42+00:00Added an answer on May 22, 2026 at 12:31 am

    What you need to protect against are CSRF attacks. Put simply, they are attacks which trick administrators into visiting a certain URL by GET or POST request.

    The typical way to do that are tokens. When generating the link or form that points to the delete action, you generate a token that you send to the client (either as hidden form field or as part of the GET URL), also store it on the server for the current session and when that action is executed, you compare the submitted and the stored token and only continue if they match.

    Many frameworks/systems have this built-in in some ways, for example are all forms generated with the Form API in Drupal protected against such attacks.

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

Sidebar

Related Questions

NOTE: I added my new solution at the UPDATE answer below. I try to
Update : Added simple test example http://jsfiddle.net/7UhrW/1/ using normalize.css. Chrome/WebKit and Firefox have different
update I added a metabox using http://codex.wordpress.org/Function_Reference/add_meta_box Unfortunatly it only adds the metabox to
EDIT: Modified title and added update. UPDATE : We no longer believe this is
Update: I've added an answer that describes my final solution (hint: the single Expr
I added a counter cache but can't get it to update. But I can
I'm using an Ajax update panel and have recently added ASP.NET tracing code to
There're files/folders that were deleted and then re-added to the repository. svn update >
Update: Added Schema to the bottom... I have a table of contracts: tbl_contract And
Update Added jsfiddle - see bottom of post I currently have a function that

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.