SQL injection problems

Source: Internet
Author: User
Ask about SQL injection. Hello everyone & nbsp; I made a website a few days ago & nbsp; considering that I didn't do SQL anti-injection & nbsp; I have read some case columns & nbsp; I used them on my own website & nbsp; but they didn't respond & nbsp; now I 'd like to ask & nbsp; how can I build SQL code to be injected? The main statement is this & lt ;? Phpinclude & nb ask about SQL injection
Hello, everyone, I made a website a few days ago. considering that I didn't do SQL anti-injection, I read some cases and used them on my own website but didn't respond. now, please ask me how to write SQL code like this. can be injected?
This is the main statement.
Include "../admin/connss. php ";
$ Id = $ _ GET [id];
$ SQL = mysql_query ("select * from news where id = '$ ID '");
$ Row = mysql_fetch_array ($ SQL );
?>

I don't think it's okay to filter the data. it should be injected. but I tried some methods and it's okay to ask.
Thank you.
------ Solution --------------------
Both addslashes and mysql_real_escape_string can escape fields to prevent injection.
------ Solution --------------------

-- Your program design looks like this:
-- $ Id = "100"
Select... from... where ID = '201312 ';
-- The SQL injection result is as follows:
-- $ Id = "100 'or '1' = '1"
Select... from... where ID = '20180101' or '1' = '1'

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.