diff --git a/qrcode/install/config/database.php b/qrcode/install/config/database.php deleted file mode 100644 index 2c48784..0000000 --- a/qrcode/install/config/database.php +++ /dev/null @@ -1,36 +0,0 @@ -validate_post($_POST) == true) { - // First create the database, then create tables, then write config file - if ($database->create_database($_POST) == false) { - $message = $core->show_message('error', "The database could not be created, please check your database credentials!"); - } else if ($database->create_tables($_POST) == false) { - $message = $core->show_message('error', "The database tables could not be created, please check your database credentials!"); - } else if ($core->write_config($_POST) == false) { - $message = $core->show_message('error', "The database configuration file could not be written, please chmod application/config/database.php file to 777"); - } - - // If no errors, redirect to index - if (!isset($message)) { - header("Refresh: 10; finish.php"); - $installing = 1; - } - } else { - $message = $core->show_message('error', 'Not all fields have been filled in correctly. The host, username, password, and database name are required.'); - } -} - -?> - - - - - - - - - PHP Dynamic Qr code - Installer - - - - - - - - - -
-
-
- -
-
- -
-
- -
-
- -
-
-
-
-
-
-
-

Start

-
-
-
-

Folder Permissions

-
-
-
-

Database

-
-
-
-

Finish

-
-
- -
- -
- -
- - -
- The database is being created. Please wait! -
- -
- -
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-

Database

-
- - -
-
- - -
-
- - -
-
- - -
- -
-
-
- Prev - -
-
-
-
-
-
-
-
-
-
- - - diff --git a/qrcode/install/finish.php b/qrcode/install/finish.php index 2abb5e7..da5ddd8 100644 --- a/qrcode/install/finish.php +++ b/qrcode/install/finish.php @@ -1,12 +1,3 @@ - - @@ -14,7 +5,7 @@ if (!file_exists('../config/config.php')) { - PHP Dynamic Qr code - Installer + PHP Dynamic Qr code - Setup @@ -36,52 +27,25 @@ if (!file_exists('../config/config.php')) {
-
- - -
-
-
-
-
-
-

Start

-
-
-
-

Folder Permissions

-
-
-
-

Database

-
-
-
-

Finish

-
-
-
-

Finish

- -

The installation was successful.
Keep the documentation handy and log in to the control panel by entering the default credentials:

+

+ The installation was successful. +
+ Keep the documentation handy and log in to the control panel by entering the default credentials: +

+ superadmin
+ superadmin

+ We recommend that you create a new superadmin user and to delete the default one mentioned above.

-superadmin
-superadmin

- -We recommend that you create a new superadmin user and to delete the default one mentioned above.

- -N.B. Remember to delete the "install" folder otherwise you could accidentally start the installation procedure again, deleting all the saves in the database

-
- -
- - Log in + N.B. Remember to delete the "install" folder otherwise you could accidentally start the installation procedure again, deleting all the saves in the database

+
+ Log in +
@@ -91,6 +55,5 @@ We recommend that you create a new superadmin user and to delete the default one
- diff --git a/qrcode/install/folder-permissions.php b/qrcode/install/folder-permissions.php deleted file mode 100644 index 2c743d6..0000000 --- a/qrcode/install/folder-permissions.php +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - PHP Dynamic Qr code - Installer - - - - - - - - - -
-
-
- -
-
- -
-
- -
-
- -
- - -
-
-
-
-
-
-

Start

-
-
-
-

Folder Permissions

-
-
-
-

Database

-
-
-
-

Finish

-
-
- -
-
-

Folder Permissions

-
-
-

/config

-

/saved_qrcode

-
-
-

-

-
-
-
- Prev - - Next -
-
-
- -
-
-
-
-
-
- - - - diff --git a/qrcode/install/includes/core_class.php b/qrcode/install/includes/core_class.php deleted file mode 100644 index 3716125..0000000 --- a/qrcode/install/includes/core_class.php +++ /dev/null @@ -1,61 +0,0 @@ -/** -* PHP Dynamic Qr code -* -* @author Giandonato Inverso -* @copyright Copyright (c) 2020-2021 -* @license https://opensource.org/licenses/MIT MIT License -* @link https://github.com/giandonatoinverso/PHP-Dynamic-Qr-code -* @version 1.0 -*/ - -* @copyright Copyright (c) 2020-2021 -* @license https://opensource.org/licenses/MIT MIT License -* @link https://github.com/giandonatoinverso/PHP-Dynamic-Qr-code -* @version 1.0 -*/ + * @copyright Copyright (c) 2020-2021 + * @license https://opensource.org/licenses/MIT MIT License + * @link https://github.com/giandonatoinverso/PHP-Dynamic-Qr-code + * @version 1.0 + */ class Database { // Function to the database and tables and fill them with the default data - function create_database($data) + function create_database($db_host, $db_user, $db_password, $db_name, $db_port) { // Connect to the database - $mysqli = new mysqli($data['db_host'],$data['db_user'],$data['db_password'],''); + $mysqli = new mysqli($db_host,$db_user,$db_password,'', $db_port); // Check for errors if(mysqli_connect_errno()) return false; // Create the prepared statement - $mysqli->query("CREATE DATABASE IF NOT EXISTS ".$data['db_name']); + $mysqli->query("CREATE DATABASE IF NOT EXISTS ".$db_name); // Close the connection $mysqli->close(); @@ -31,10 +31,10 @@ class Database { } // Function to create the tables and fill them with the default data - function create_tables($data) + function create_tables($db_host, $db_user, $db_password, $db_name, $db_port) { // Connect to the database - $mysqli = new mysqli($data['db_host'],$data['db_user'],$data['db_password'],$data['db_name']); + $mysqli = new mysqli($db_host,$db_user,$db_password,$db_name, $db_port); // Check for errors if(mysqli_connect_errno()) diff --git a/qrcode/install/index.php b/qrcode/install/index.php deleted file mode 100644 index 5c915ee..0000000 --- a/qrcode/install/index.php +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - - PHP Dynamic Qr code - Installer - - - - - - - - - -
-
-
- -
-
- - - -
-
- -
-
- -
- - -
-
-
-
-
-
-

Start

-
-
-
-

Folder Permissions

-
-
-
-

Database

-
-
-
-

Finish

-
-
- -
-
-

System Requirements

-
-
-

-    PHP Version: - = 5.6): ?> - - -  (Your PHP version must be 5.6 or greater) - - -

-

-    cURL PHP Extension: - - Enabled - - Disabled (You should enable "cURL" in your server) - - -

- -
-
-

- = 5.6): ?> - - - - -

-

- - - - - -

- -
-
- -
- - Next -
- -
-
-
-
-
-
-
-
- - - - diff --git a/qrcode/install/setup.php b/qrcode/install/setup.php new file mode 100644 index 0000000..f16f6ee --- /dev/null +++ b/qrcode/install/setup.php @@ -0,0 +1,62 @@ + + * @copyright Copyright (c) 2020-2021 + * @license https://opensource.org/licenses/MIT MIT License + * @link https://github.com/giandonatoinverso/PHP-Dynamic-Qr-code + * @version 1.0 + */ + +require_once ('../config/environment.php'); +require_once('includes/database_class.php'); + +/* +|-------------------------------------------------------------------------- +| CHECK REQUIREMENTS +|-------------------------------------------------------------------------- + */ + +if (!(phpversion() >= 5.6)) { + echo "Installation failed. A php version> = 5.6 is required"; + die(); +} + +if (!extension_loaded('curl')) { + echo "Installation failed. The curl extension is required"; + die(); +} + +/* +|-------------------------------------------------------------------------- +| CHECK FOLDER PERMISSION +|-------------------------------------------------------------------------- + */ + +if (!is_writable('../saved_qrcode')) { + echo "Installation failed. The folder where you save the qrcodes must have write permissions"; + die(); +} + +/* +|-------------------------------------------------------------------------- +| DATABASE CREATION +|-------------------------------------------------------------------------- + */ + +$database = new Database(); + +if (!$database->create_database(DATABASE_HOST, DATABASE_USER, DATABASE_PASSWORD, DATABASE_NAME, DATABASE_PORT)) { + echo "The database could not be created, please check your database credentials!"; + die(); +} +else if (!$database->create_tables(DATABASE_HOST, DATABASE_USER, DATABASE_PASSWORD, DATABASE_NAME, DATABASE_PORT)) { + echo "The database tables could not be created, please check your database credentials!"; + die(); +} + +// If no errors, redirect to index +header("Refresh: 1; finish.php"); + +?> \ No newline at end of file