diff --git a/header.php b/header.php index bbcf6d5e..4ab2f175 100644 --- a/header.php +++ b/header.php @@ -1,4 +1,8 @@ +
This is a great starting point for new custom pages.
- \ No newline at end of file + \ No newline at end of file diff --git a/setup.php b/setup.php index 13afb865..7ccb15d5 100644 --- a/setup.php +++ b/setup.php @@ -2,461 +2,455 @@ if(file_exists('config.php')){ header("Location: login.php"); -}else{ +} + +include("functions.php"); - include("functions.php"); +if(isset($_POST['add_database'])){ - 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("config.php", "w"); - $myfile = fopen("config.php", "w"); + $txt = ""; - $txt = "?>"; + fwrite($myfile, $txt); - fwrite($myfile, $txt); + fclose($myfile); - fclose($myfile); + include("config.php"); - include("config.php"); + // 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; - // 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 = ''; - } - } - - //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()"); - - $_SESSION['alert_message'] = "User added"; - - header("Location: setup.php?company"); - } - if(isset($_POST['add_company_settings'])){ + //Create Some Data - include("config.php"); + mysqli_query($mysqli,"INSERT INTO accounts SET account_name = 'Cash', account_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"); + 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()"); - header("Location: login.php"); + 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"; - - - - - - - - -Click on the install button to start the install process, you must create a database before proceeding
-This process will accomplish the following
-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
-Click on the install button to start the install process, you must create a database before proceeding
+This process will accomplish the following
+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
+