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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:44:28+00:00 2026-06-01T14:44:28+00:00

might be a silly question nonetheless: I’m playing around with the following code: $a=’a’;

  • 0

might be a silly question nonetheless:

I’m playing around with the following code:

$a='a';

if ($_GET['a'] == $a)
    echo 'true';
else
    echo 'false';

Now, is there any way to send data to break the verification? Obviously the way it could’ve been done in an SQL injection won’t go.

Just wondering how secure this way of validation is.

Thanks in advance.

EDIT:

My question was, is there anything that can be passed thorugh $_GET that could ‘break’ the comparison and always output ‘true’.

  • 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-01T14:44:29+00:00Added an answer on June 1, 2026 at 2:44 pm

    If you are looking to validate that $_GET['a'] really in face equals to "a" and nothing else, than yes, that’s the code.

    However, if you’re expecting "a" and only "a" it probably shouldn’t be a user input.

    Validation (or sanitation), means to take whatever string they might throw at you, and make sure it’s valid for whatever purpose you want it to. If it’s sent to the database, pass it through mysql_escape_string() or use prepared statements. If it’s to be displayed as HTML make sure there aren’t any harmful tags by using html_entities() or strip_tags().

    Your verification isn’t very good for anything else other than saying the user has inputted "a". But yes, nothing other than "a" would be able to get through.

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

Sidebar

Related Questions

this might be a silly question, but well. I have the following code that
This might sound like a silly question but how would I make this code
this might be a silly question but... Refactoring my code, I came up with
Might be a silly question, just wanted to know do the following ways on
This might be a silly question but does ARC (automatic reference counting) interact with
This might seem as silly question but I am thinking there might be the
This might sound a silly question but I've really spend hours in trying to
This might look like a silly question to some, but handling the different types
I know it might look like a silly question but here is my case
This might be a very silly / stupid question, but, my defence is 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.