From f06a66887dce6255962dfabd9c62a1a505866bdb Mon Sep 17 00:00:00 2001 From: root Date: Tue, 11 Jun 2019 14:53:44 -0400 Subject: [PATCH] Fixed issues with setup.php --- README.md | 7 +- add_calendar_event_modal.php | 2 +- config.old.php | 12 +++ config.php | 22 ++--- pittpc.tar.gz | Bin 0 -> 45 bytes setup.php | 153 +++++++++++++++++------------------ 6 files changed, 103 insertions(+), 93 deletions(-) create mode 100644 config.old.php create mode 100644 pittpc.tar.gz diff --git a/README.md b/README.md index 8f31f958..7263e5e6 100644 --- a/README.md +++ b/README.md @@ -45,9 +45,10 @@ CRM, Accounting and Invoicing System for small managed IT companies ### Installation Instructions -* Create a mysql database dump db.sql into it -* Set db user and password in config.php -* Point your browser and away you go +* Download the files in this repository +* Create a Mysql database +* Point your browser to setup.php fill in the info +* Your Done! that easy.. #### Requirements * Webserver (Apache, NGINX) diff --git a/add_calendar_event_modal.php b/add_calendar_event_modal.php index 681b58aa..2e99f926 100644 --- a/add_calendar_event_modal.php +++ b/add_calendar_event_modal.php @@ -34,7 +34,7 @@ $calendar_name = $row['calendar_name']; $calendar_color = $row['calendar_color']; ?> - + \ No newline at end of file diff --git a/config.php b/config.php index e717c90d..a6ea69c8 100644 --- a/config.php +++ b/config.php @@ -1,12 +1,12 @@ - \ No newline at end of file diff --git a/pittpc.tar.gz b/pittpc.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..62c247cfbfb1777afb1c92ddf2cf6e34f6d7fcb2 GIT binary patch literal 45 vcmb2|=3wx;`Y(oo`RzeQUIqq+Lkqt9=kl2^05Tz"; + $txt = "?>"; - fwrite($myfile, $txt); + fwrite($myfile, $txt); - fclose($myfile); + fclose($myfile); - $_SESSION['alert_message'] = "Database successful"; + include("config.php"); - header("setup.php?import_database"); + // Name of the file + $filename = 'db.sql'; + // Temporary variable, used to store current query + $templine = ''; + // Read in entire file + $lines = file($filename); + // Loop through each line + foreach ($lines as $line){ + // Skip it if it's a comment + if(substr($line, 0, 2) == '--' || $line == '') + continue; -} + // Add this line to the current segment + $templine .= $line; + // If it has a semicolon at the end, it's the end of the query + if(substr(trim($line), -1, 1) == ';'){ + // Perform the query + mysqli_query($mysqli,$templine); + // Reset temp variable to empty + $templine = ''; + } + } -if(isset($_POST['import_database'])){ + //Create Some Data - include("config.php"); + mysqli_query($mysqli,"INSERT INTO accounts SET account_name = 'Cash', account_created_at = NOW()"); - // Name of the file - $filename = 'db.sql'; - // Temporary variable, used to store current query - $templine = ''; - // Read in entire file - $lines = file($filename); - // Loop through each line - foreach ($lines as $line){ - // Skip it if it's a comment - if(substr($line, 0, 2) == '--' || $line == '') - continue; + mysqli_query($mysqli,"INSERT INTO categories SET category_name = 'Office Supplies', category_type = 'Expense', category_color = 'blue', category_created_at = NOW()"); + mysqli_query($mysqli,"INSERT INTO categories SET category_name = 'Travel', category_type = 'Expense', category_color = 'red', category_created_at = NOW()"); + mysqli_query($mysqli,"INSERT INTO categories SET category_name = 'Advertising', category_type = 'Expense', category_color = 'green', category_created_at = NOW()"); - // Add this line to the current segment - $templine .= $line; - // If it has a semicolon at the end, it's the end of the query - if(substr(trim($line), -1, 1) == ';'){ - // Perform the query - mysqli_query($mysqli,$templine); - // Reset temp variable to empty - $templine = ''; - } - } + mysqli_query($mysqli,"INSERT INTO categories SET category_name = 'Service', category_type = 'Income', category_color = 'orange', category_created_at = NOW()"); - //Create Some Data + mysqli_query($mysqli,"INSERT INTO categories SET category_name = 'Cash', category_type = 'Payment Method', category_color = 'purple', category_created_at = NOW()"); + mysqli_query($mysqli,"INSERT INTO categories SET category_name = 'Check', category_type = 'Payment Method', category_color = 'brown', category_created_at = NOW()"); - mysqli_query($mysqli,"INSERT INTO accounts SET account_name = 'Cash', account_created_at = NOW()"); + mysqli_query($mysqli,"INSERT INTO calendars SET calendar_name = 'Default', calendar_color = 'blue', calendar_created_at = NOW()"); - mysqli_query($mysqli,"INSERT INTO categories SET category_name = 'Office Supplies', category_type = 'Expense', category_color = 'blue', category_created_at = NOW()"); - mysqli_query($mysqli,"INSERT INTO categories SET category_name = 'Travel', category_type = 'Expense', category_color = 'red', category_created_at = NOW()"); - mysqli_query($mysqli,"INSERT INTO categories SET category_name = 'Advertising', category_type = 'Expense', category_color = 'green', category_created_at = NOW()"); + $_SESSION['alert_message'] = "Database successfully added"; - mysqli_query($mysqli,"INSERT INTO categories SET category_name = 'Service', category_type = 'Income', category_color = 'orange', category_created_at = NOW()"); - - mysqli_query($mysqli,"INSERT INTO categories SET category_name = 'Cash', category_type = 'Payment Method', category_color = 'purple', category_created_at = NOW()"); - mysqli_query($mysqli,"INSERT INTO categories SET category_name = 'Check', category_type = 'Payment Method', category_color = 'brown', category_created_at = NOW()"); - - mysqli_query($mysqli,"INSERT INTO calendars SET calendar_name = 'Default', calendar_color = 'blue', calendar_created_at = NOW()"); + header("Location: setup.php?user"); } if(isset($_POST['add_user'])){ - include("config.php"); + include("config.php"); $name = strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])); $email = strip_tags(mysqli_real_escape_string($mysqli,$_POST['email'])); @@ -100,23 +96,25 @@ if(isset($_POST['add_user'])){ $_SESSION['alert_message'] = "User added"; + header("Location: setup.php?company"); + } if(isset($_POST['add_company_settings'])){ - include("config.php"); + include("config.php"); - $config_company_name = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_company_name'])); - $config_company_address = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_company_address'])); - $config_company_city = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_company_city'])); - $config_company_state = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_company_state'])); - $config_company_zip = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_company_zip'])); - $config_company_phone = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_company_phone'])); - $config_company_site = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_company_site'])); - - mysqli_query($mysqli,"INSERT INTO settings SET config_company_name = '$config_company_name', config_company_address = '$config_company_address', config_company_city = '$config_company_city', config_company_state = '$config_company_state', config_company_zip = '$config_company_zip', config_company_phone = '$config_company_phone', config_company_site = '$config_company_site', config_start_page = 'dashboard.php'"); + $config_company_name = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_company_name'])); + $config_company_address = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_company_address'])); + $config_company_city = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_company_city'])); + $config_company_state = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_company_state'])); + $config_company_zip = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_company_zip'])); + $config_company_phone = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_company_phone'])); + $config_company_site = strip_tags(mysqli_real_escape_string($mysqli,$_POST['config_company_site'])); + + mysqli_query($mysqli,"INSERT INTO settings SET config_company_name = '$config_company_name', config_company_address = '$config_company_address', config_company_city = '$config_company_city', config_company_state = '$config_company_state', config_company_zip = '$config_company_zip', config_company_phone = '$config_company_phone', config_company_site = '$config_company_site', config_start_page = 'dashboard.php'"); - header("login.php"); + header("Location: login.php"); } @@ -192,7 +190,7 @@ if(isset($_POST['add_company_settings'])){
- +
@@ -203,17 +201,17 @@ if(isset($_POST['add_company_settings'])){
- +
- +
- +
- +
@@ -223,7 +221,7 @@ if(isset($_POST['add_company_settings'])){
- +
@@ -231,16 +229,17 @@ if(isset($_POST['add_company_settings'])){
- +
- +
- +
- +
+
@@ -298,8 +297,6 @@ if(isset($_POST['add_company_settings'])){ - -
Company Settings
@@ -378,7 +375,7 @@ if(isset($_POST['add_company_settings'])){
-
Start Install
+
Start Install

Click on the install button to start the install process, you must create a database before starting