About SQL injection

Source: Internet
Author: User
Login his login code is like this: PHPcode $ username $ _ REQUEST [username]; $ password $ _ REQUEST [passw ask about SQL injection
I read this post just now
Http://topic.csdn.net/u/20121011/08/ed0d9538-0ed1-49c4-95c3-0fc1ef686aa2.html

The login code is as follows:
PHP code
  $username = $_REQUEST['username'];$password = $_REQUEST['password'];$sql="select * from users where username='$username' and password='$password'";

Later, according to his method, the user name can indeed be submitted without the password to log on successfully.

However, this method first meets the condition that get_magic_quotes_gpc is disabled.

Then his login code seems to be too backward. The current passwords are generally encrypted with md5, for example, my login verification is generally written like this:
PHP code
  $ Username = $ _ REQUEST ['username']; $ password = md5 ($ _ REQUEST ['password']); // changed this line $ SQL = "select * from users where username = '$ username' and password =' $ password '";

In this way, the $ SQL statement obtained by submitting the form becomes:
Select * from users where username = 'Sean 'and password = '7e2705cbd698f255b7fe11eff40de898'


How should we inject data like this?

------ Solution --------------------
Isn't there $ username? Why not use $ password?

As long as magic_quotes_gpc = on these pediatric attacks immediately become invalid

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.