Can I monitor which file executes the SQL statement?

Source: Internet
Author: User
Can I monitor which file executes the SQL statement? I took over the maintenance for the project, but the developer was not me, but found that the website may have a backdoor.
Data is often modified.
However, one file and one file cannot be found.
So I want to monitor which file to perform the operation records and analyze them ..
Is there any way?


Reply to discussion (solution)

Does your project use a database class?

Does your project use a database class?


Is conn. php called During database operations?

Does your project use a database class?



The include folder contains db_mysql.class.php.

Check whether mysql_query exists in files other than db_mysql.class.php.
If yes, it is all the places to be checked.

In the db_mysql.class.php file, the Chinese method contains the characters query, execute, insert, update, and fetch.
Join

file_put_contents('log.txt', print_r(debug_backtrace(), 1), FILE_APPEND);
You can see from the log.txt file where the SQL command is executed.

Just try again later.

Check whether mysql_query exists in files other than db_mysql.class.php.
If yes, it is all the places to be checked.

In the db_mysql.class.php file, the Chinese method contains the characters query, execute, insert, update, and fetch.
Join

file_put_contents('log.txt', print_r(debug_backtrace(), 1), FILE_APPEND);
You can see from the log.txt file where the SQL command is executed.



Thank you. However, I found that some php files also use some SQL statements. Can I directly write it in config. php?

Check whether mysql_query exists in files other than db_mysql.class.php.
If yes, it is all the places to be checked.

In the db_mysql.class.php file, the Chinese method contains the characters query, execute, insert, update, and fetch.
Join

file_put_contents('log.txt', print_r(debug_backtrace(), 1), FILE_APPEND);
You can see from the log.txt file where the SQL command is executed.



Array
(
[0] => Array
(
[File] =>/www/web/zlhk/public_html/include/conn. php
[Line] => 3
[Function] => include
)

[1] => Array
(
[File] =>/www/web/zlhk/public_html/madmin45/users. php
[Line] => 8
[Args] => Array
(
[0] =>/www/web/zlhk/public_html/include/conn. php
)

[Function] => include
)

)
Array

All similar data

You didn't do what I said!

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.