Fixed issues with setup.php
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
$calendar_name = $row['calendar_name'];
|
||||
$calendar_color = $row['calendar_color'];
|
||||
?>
|
||||
<option data-content="<i class='fa fa-circle mr-2' style='color:<?php echo $calendar_color; ?>;'></i> value="<?php echo $calendar_id; ?> ><?php echo $calendar_name; ?></option>
|
||||
<option data-content="<i class='fa fa-circle mr-2' style='color:<?php echo $calendar_color; ?>;'></i> <?php echo $calendar_name; ?>" value="<?php echo $calendar_id; ?>"><?php echo $calendar_name; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
//DB Settings
|
||||
|
||||
$dbhost = "localhost";
|
||||
$dbusername = "root";
|
||||
$dbpassword = "password";
|
||||
$database = "pittpc";
|
||||
|
||||
$mysqli = mysqli_connect($dbhost, $dbusername, $dbpassword, $database);
|
||||
|
||||
include("get_settings.php");
|
||||
?>
|
||||
+7
-7
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
//DB Settings
|
||||
|
||||
$dbhost = "localhost";
|
||||
$dbusername = "root";
|
||||
$dbpassword = "password";
|
||||
$database = "pittpc";
|
||||
$dbhost = "localhost";
|
||||
$dbusername = "root";
|
||||
$dbpassword = "password";
|
||||
$database="test";
|
||||
|
||||
$mysqli = mysqli_connect($dbhost, $dbusername, $dbpassword, $database);
|
||||
$mysqli = mysqli_connect($dbhost, $dbusername, $dbpassword, $database);
|
||||
|
||||
include("get_settings.php");
|
||||
|
||||
include("get_settings.php");
|
||||
?>
|
||||
Binary file not shown.
@@ -7,13 +7,13 @@ if(isset($_POST['add_database'])){
|
||||
$username = $_POST['username'];
|
||||
$password = $_POST['password'];
|
||||
|
||||
$myfile = fopen("dbconnect.php", "w");
|
||||
$myfile = fopen("config.php", "w");
|
||||
|
||||
$txt = "<?php\n\n";
|
||||
|
||||
fwrite($myfile, $txt);
|
||||
|
||||
$txt = "\$dbhost = \"$host\";\n\$dbusername = \"$username\";\n\$dbpassword = \"$password\";\n\$database=\"$database\";\n\n";
|
||||
$txt = "\$dbhost = \"$host\";\n\$dbusername = \"$username\";\n\$dbpassword = \"$password\";\n\$database = \"$database\";\n\n";
|
||||
|
||||
fwrite($myfile, $txt);
|
||||
|
||||
@@ -31,14 +31,6 @@ if(isset($_POST['add_database'])){
|
||||
|
||||
fclose($myfile);
|
||||
|
||||
$_SESSION['alert_message'] = "Database successful";
|
||||
|
||||
header("setup.php?import_database");
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['import_database'])){
|
||||
|
||||
include("config.php");
|
||||
|
||||
// Name of the file
|
||||
@@ -79,6 +71,10 @@ if(isset($_POST['import_database'])){
|
||||
|
||||
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'])){
|
||||
@@ -100,6 +96,8 @@ if(isset($_POST['add_user'])){
|
||||
|
||||
$_SESSION['alert_message'] = "User added";
|
||||
|
||||
header("Location: setup.php?company");
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['add_company_settings'])){
|
||||
@@ -116,7 +114,7 @@ if(isset($_POST['add_company_settings'])){
|
||||
|
||||
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'])){
|
||||
<div id="content-wrapper">
|
||||
|
||||
<div class="container">
|
||||
|
||||
<?php include("config.php"); ?>
|
||||
<?php if(isset($_GET['database'])){ ?>
|
||||
|
||||
<div class="card mb-3">
|
||||
@@ -203,17 +201,17 @@ if(isset($_POST['add_company_settings'])){
|
||||
<form class="p-3" method="post" autocomplete="off">
|
||||
|
||||
<div class="form-group">
|
||||
<label>MySQL Host</label>
|
||||
<label>Database Name</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-server"></i></span>
|
||||
<span class="input-group-text"><i class="fa fa-database"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="host" placeholder="Usually localhost" required>
|
||||
<input type="text" class="form-control" name="database" placeholder="Name of the database" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>MySQL Username</label>
|
||||
<label>Username</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-user"></i></span>
|
||||
@@ -223,7 +221,7 @@ if(isset($_POST['add_company_settings'])){
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>MySQL Password</label>
|
||||
<label>Password</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-lock"></i></span>
|
||||
@@ -233,14 +231,15 @@ if(isset($_POST['add_company_settings'])){
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-5">
|
||||
<label>MySQL Database Name</label>
|
||||
<label>Database Host</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-database"></i></span>
|
||||
<span class="input-group-text"><i class="fa fa-server"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="database" placeholder="Name of the database" required>
|
||||
<input type="text" class="form-control" name="host" placeholder="Usually localhost" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<button type="submit" name="add_database" class="btn btn-primary">Save</button>
|
||||
</form>
|
||||
@@ -298,8 +297,6 @@ if(isset($_POST['add_company_settings'])){
|
||||
|
||||
<?php }elseif(isset($_GET['company'])){ ?>
|
||||
|
||||
<?php include("config.php"); ?>
|
||||
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
<h6 class="mt-1"><i class="fa fa-building"></i> Company Settings</h6>
|
||||
@@ -378,7 +375,7 @@ if(isset($_POST['add_company_settings'])){
|
||||
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
<h6 class="mt-1"><i class="fa fa-database"></i> Start Install</h6>
|
||||
<h6 class="mt-1"><i class="fa fa-database"></i> Start Install <?php echo $database; ?></h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p>Click on the install button to start the install process, you must create a database before starting</p>
|
||||
|
||||
Reference in New Issue
Block a user