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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:00:35+00:00 2026-05-26T19:00:35+00:00

Is it safe to do smth like this in first if on the page

  • 0

Is it safe to do smth like this in first if on the page ctype_digit(base64_decode(trim($_POST['id']) or i should first create variable inside if and assign trim($_POST['id']) to it because they might have put some crazy thing in it that might overflow base64_decode or ctype_digit for example or i am overemphasizing?

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

    I would say that you are being careful enough by doing that. However, in most cases the correct way to code would be to create a variable, like $id, and assign it the value of your post variable. This is because allot of developers have to work with templates, and as a PHP programmer your task would be to take post / get input and database rows, and make them available to templates as easy to access variables and arrays.

    Your example makes your script safe when you are expecting a numerical id. If you are expecting a string, usually to be used in an SQL statement, then you will need to take further steps. Even the cleanest string can be used for SQL injection. That’s where prepared statements should be used.

    http://www.php.net/manual/en/mysqli.prepare.php

    http://www.php.net/manual/en/class.mysqli-stmt.php

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

Sidebar

Related Questions

Is it safe to do something like this in Node.js/Express.js? // use Object.create(null) so
I use safe navigation operator to avoid NPEs like this myInstance?.field1 myInstance?.field2 myInstance?.field3 To
Are Django middleware thread safe? Can I do something like this, class ThreadsafeTestMiddleware(object): def
Is it safe to use something like this to ensure that a directory isn't
Is it XSS safe to do something like this in jQuery? <html> ... <input
I have a thread safe observable collection replacement which I would like to write
Is this safe? I'm not using any virtual functions in my actual implementation, but
Is safe make a webform, where the user can enter sed command, like: s/\(.*\)
Is it safe? For instance, if I create a bunch of different GCD queues
is safe if I use this macro in my code? #define my_calloc(x, n) ((x)

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.