From 6f5803492873c43490070bc41cf78b67000b8171 Mon Sep 17 00:00:00 2001 From: "johnny@pittpc.com" Date: Sat, 20 Jul 2019 16:45:00 -0400 Subject: [PATCH] If config.php exists redirect setup.php to login.php, if login doesn't exist redirect index.php to setup.php --- index.php | 38 ++- setup.php | 788 +++++++++++++++++++++++++++--------------------------- 2 files changed, 424 insertions(+), 402 deletions(-) diff --git a/index.php b/index.php index 22f906c0..a5f60d3c 100644 --- a/index.php +++ b/index.php @@ -1,16 +1,28 @@ - + - +if(file_exists('config.php')){ + include("header.php"); - -

Blank Page

-
-

This is a great starting point for new custom pages.

+?> + + + - \ No newline at end of file + +

Blank Page

+
+

This is a great starting point for new custom pages.

+ + \ No newline at end of file diff --git a/setup.php b/setup.php index ab48f895..13afb865 100644 --- a/setup.php +++ b/setup.php @@ -1,452 +1,462 @@ "; + fwrite($myfile, $txt); - fwrite($myfile, $txt); + $txt = "?>"; - fclose($myfile); + fwrite($myfile, $txt); - include("config.php"); + fclose($myfile); - // 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; + include("config.php"); - // 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 = ''; - } - } + // 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; - //Create Some Data - - mysqli_query($mysqli,"INSERT INTO accounts SET account_name = 'Cash', account_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()"); - - 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()"); - - $_SESSION['alert_message'] = "Database successfully added"; - - header("Location: setup.php?user"); - -} - -if(isset($_POST['add_user'])){ - - include("config.php"); - - $name = strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])); - $email = strip_tags(mysqli_real_escape_string($mysqli,$_POST['email'])); - $password = md5(mysqli_real_escape_string($mysqli,$_POST['password'])); - - if($_FILES['file']['tmp_name']!='') { - $path = "uploads/users/"; - $path = $path . time() . basename( $_FILES['file']['name']); - $file_name = basename($path); - move_uploaded_file($_FILES['file']['tmp_name'], $path); + // 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 users SET name = '$name', email = '$email', password = '$password', avatar = '$path', created_at = NOW()"); + //Create Some Data - $_SESSION['alert_message'] = "User added"; + mysqli_query($mysqli,"INSERT INTO accounts SET account_name = 'Cash', account_created_at = NOW()"); - header("Location: setup.php?company"); + 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()"); -} + mysqli_query($mysqli,"INSERT INTO categories SET category_name = 'Service', category_type = 'Income', category_color = 'orange', category_created_at = NOW()"); -if(isset($_POST['add_company_settings'])){ + 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()"); - include("config.php"); + mysqli_query($mysqli,"INSERT INTO calendars SET calendar_name = 'Default', calendar_color = 'blue', calendar_created_at = NOW()"); - $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'])); - $config_api_key = keygen(); - - 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_invoice_prefix = 'INV-', config_next_invoice_number = 1, config_invoice_overdue_reminders = '1,3,7', config_api_key = '$config_api_key', config_recurring_auto_send_invoice = 1, config_default_net_terms = 7, config_send_invoice_reminders = 0"); + $_SESSION['alert_message'] = "Database successfully added"; - header("Location: login.php"); + header("Location: setup.php?user"); -} + } -?> + if(isset($_POST['add_user'])){ - - + include("config.php"); - + $name = strip_tags(mysqli_real_escape_string($mysqli,$_POST['name'])); + $email = strip_tags(mysqli_real_escape_string($mysqli,$_POST['email'])); + $password = md5(mysqli_real_escape_string($mysqli,$_POST['password'])); - - - - - + if($_FILES['file']['tmp_name']!='') { + $path = "uploads/users/"; + $path = $path . time() . basename( $_FILES['file']['name']); + $file_name = basename($path); + move_uploaded_file($_FILES['file']['tmp_name'], $path); + } - Install CRM + mysqli_query($mysqli,"INSERT INTO users SET name = '$name', email = '$email', password = '$password', avatar = '$path', created_at = NOW()"); - - + $_SESSION['alert_message'] = "User added"; - - + header("Location: setup.php?company"); - - - - - + } - + if(isset($_POST['add_company_settings'])){ - - + } -
+ ?> + + + + + + + + + + + + + Install CRM + + + + + + + + + + - - - -
+ + + + + + + +
-
- - - -
-
-
Setup Database
-
-
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
-
+ + + +
- - - -
-
-
Create your first user
-
-
- -
-
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
-
- - -
-
- -
-
-
- - - -
-
-
Company Settings
-
-
-
-
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- -
-
- -
- - +
+ + + +
+
+
Setup Database
+
+
+ - -
-
+
+ +
+
+ +
+ +
+
- +
+ +
+
+ +
+ +
+
-
-
-
Start Install
-
-
-

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

-

This process will accomplish the following

-
    -
  • Create a config.php
  • -
  • Creates the following expense cataegories (Office Supplies, Advertising, Travel)
  • -
  • Creates the following payment methods (Cash, Check)
  • -
  • Creates an account named Cash
  • -
  • Creates an income category
  • -
-

After install add cron.php to your cron and set it to run once everyday at 12AM. This is so recurring invoices will automatically be sent out and created. This will also trigger late payment reminders, along with alerts such as domains expiration, etc.

-

An API is present to allow integration with other third pary apps. An API Key will be auto generated, and can be changed at a later date. The API will give you the following capabilities

-
    -
  • Address book XML for VOIP Phones
  • -
  • Caller ID Lookup
  • -
  • Get List of Emails in CSV to export to a mailing list
  • -
  • Get Balance, can be useful for customer's to get balances by phone
  • -
-
Install
-
-
+
+ +
+
+ +
+ +
+
- +
+ +
+
+ +
+ +
+
+ +
+ + +
+
+ + + + +
+
+
Create your first user
+
+
+ +
+
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+
+ + +
+
+ +
+
+
+ + + +
+
+
Company Settings
+
+
+
+
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ + + +
+
+
+ + + +
+
+
Start Install
+
+
+

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

+

This process will accomplish the following

+
    +
  • Create a config.php
  • +
  • Creates the following expense cataegories (Office Supplies, Advertising, Travel)
  • +
  • Creates the following payment methods (Cash, Check)
  • +
  • Creates an account named Cash
  • +
  • Creates an income category
  • +
+

After install add cron.php to your cron and set it to run once everyday at 12AM. This is so recurring invoices will automatically be sent out and created. This will also trigger late payment reminders, along with alerts such as domains expiration, etc.

+

An API is present to allow integration with other third pary apps. An API Key will be auto generated, and can be changed at a later date. The API will give you the following capabilities

+
    +
  • Address book XML for VOIP Phones
  • +
  • Caller ID Lookup
  • +
  • Get List of Emails in CSV to export to a mailing list
  • +
  • Get Balance, can be useful for customer's to get balances by phone
  • +
+
Install
+
+
+ + + +
+
- +
- + -
- + + + + - - - - + + + - - - + + - - + + + - - - + + - - + - + - \ No newline at end of file + \ No newline at end of file