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 00000000..62c247cf Binary files /dev/null and b/pittpc.tar.gz differ diff --git a/setup.php b/setup.php index 52a6f6c8..9582566e 100644 --- a/setup.php +++ b/setup.php @@ -2,88 +2,84 @@ if(isset($_POST['add_database'])){ - $host = $_POST['host']; - $database = $_POST['database']; - $username = $_POST['username']; - $password = $_POST['password']; + $host = $_POST['host']; + $database = $_POST['database']; + $username = $_POST['username']; + $password = $_POST['password']; - $myfile = fopen("dbconnect.php", "w"); + $myfile = fopen("config.php", "w"); - $txt = ""; + $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