Php+mysql Injection Page Implementation _ Security Tutorial

Source: Internet
Author: User
Tags mysql injection

First of all, to draw on the injection point, the previous injection point is such a http://www.xxx.com/show.php?id=1, a typical digital injection.
$id =$_get[' id '];//gets the values passed by the Get method and assigns them to the variable.
Since it is injected then be sure to manipulate the database.

$con = mysql_connect (' 127.0.0.1 ', ' root ', ' root ');//Connect the database using the Connect function, then assign the value to the variable, connect this function has three

The parameters are the database address, account number, password, respectively.
mysql_select_db (' database name ', $con);//mysq_select_db function Specifies the database of the query
$sql = "SELECT * from table name where id= $id";//use a variable to hold the SQL statement for the query.
Echo mysql_result (mysql_query ($sql), 0, ' username ')//Here are the functions of result and query, mysql_result () function to return the results set

The value of a field, the Mysql_query function executes the SQL statement, and this returns the contents of the Username field.
I've got five fields here.
When Id=1 returns the value of username, it is one.

There are five fields known, so let's see if they can be injected.

Related Article

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.