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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:46:50+00:00 2026-05-30T19:46:50+00:00

I allow my users to favorite an update or a forum topic. So when

  • 0

I allow my users to favorite an update or a forum topic.
So when a user tries to favorite one of these i will send via Ajax 2 things, the item_id(update or topic) as id(ex. 1321313213) and its type(“update” or “topic”) as string.

However lets say someones tries to favorite an update with the id untouched but the type is changed to “topic”(via firebug or whatever else)…

This should not procceed since this combination is not correct… how can i assure that the item_id being sent is an update or a topic since this ID might co-exist in both tables???

Current solution:

Create a hidden input element and add as value 5 random characters (a-zA-Z0-9) and md5 type name(update or topic)

like:

$random_str = $this->my_model->generateRandomString(5);
<input type="hidden" value="<?php echo $random_str.md5("update"); ?>" id="type" />

so when i try to validate the data to check if it is an update or topic i split the type on the first 5 characters and later and check if the later characters are md5 hashed are update or topic and continue validation

I would like some help in case this can be altered as well…

  • 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-30T19:46:51+00:00Added an answer on May 30, 2026 at 7:46 pm

    Your server side script (PHP) must always assume it’s getting bogus data. Never rely solely on javascript to handle any sanitization / verification.

    If your javascript can determine if the job should be “update” or “topic”, I’m sure your PHP can do that as well. Probably using a few more DB queries or some such, but that’s the price you’ve got to pay.

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

Sidebar

Related Questions

How would I only allow users authenticated via Python code to access certain files
I'm working on a forum-like webapp where I'd like to allow users to favourite
We do not allow users to download files directly (payed files). If the user
I would like to allow users to send emails which are generated in my
I'm trying to allow users click on a group of thumbs which will open
I allow users to enter a regular expression to match IP addresses, for doing
To allow users and site admins to view/add/edit/delete data in my application I decided
I am looking to allow users to control of subdomain of an app I
I want to allow users to upload avatar-type images in a variety of formats
I'd like to allow users to record videos directly from their webcam. I haven't

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.