Get the App
SLTechnology News&Howtos  ›  Network Security  › 

A small problem about the Construction of Sqli-labs under php7.0

Shulou Source: shulou.com Published: 2022-06-01 02:20:06 10月03日 Update

Since the previous version of kali is newer, php7.0 (this is the problem) is installed by default.

Users of PHP 5 can use mysql extension,mysqli and PDO_MYSQL, but PHP 7 removes mysql extension, leaving only the latter two options.

Therefore, there will be some problems when Sqli-labs connects to the database and queries.

When we install Sqli-labs, we must change the function of the related database to mysqli.

When you click setup db at the beginning, it will stay on the page.

Enter the directory to view the code cd / var/www/html/sqli-labs/sql-connections

There are seven files under the directory

# steps

# 0x00 modification function

Change all mysql_xxx () to mysqli_xxx

Use the combination of sed+grep

Sed-I "s/mysql_/mysqli_/g" `grep mysql_-rl. / `

# 0x01 modifies function parameters

Since connection is optional under mysql_error () function, and connection becomes required under mysqli_error (), you need to change mysql_error () to mysql_error ($con).

Sed-I s / "mysql_error ()" / "mysqli_error (\ $con)" / g `grep "mysql_error ()"-rl. / `

Mysql_query ($sql) under php5.0 can be queried.

Mysql_query under php7.0 ($con,$sql)

Tags: Function data database time directory command file query question one-step code user parameter character string form step version syntax faceted Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB OPPO Reno NVidia macOS vpn