The invention discloses a php-based independent
sql injection defense analysis alarm method and a
system thereof, and the method comprises the steps: checking whether a request IP is a forbidden IP
blacklist, ending the request if the request IP is the forbidden IP
blacklist, and entering the next step if the request IP is not the forbidden IP
blacklist; judging whether parameters of
sql injectioncontain blacklist symbols, and if yes, setting the
sql injection as a note level; judging whether parameters of
sql injection contain blacklist keywords, and if yes, setting the
sql injection as a winning level; dividing the parameters of the
sql injection by taking a space as a criterion, judging whether the parameters contain blacklist keywords, and if yes, setting the sql injection as an errorlevel; and performing sql injection on the error level, checking whether the request ip injected by the sql is subjected to
injection attacks for a specified number of times, and if yes, forbidding the request ip and listing the request ip into a forbidden IP blacklist. According to the method, measures are taken for the sql injection problem in an omnibearing manner, corresponding measures are taken for prevention, response, monitoring and recording, and the
data security is protected to a greater extent.