fix redirect loop if no config.php exists

This commit is contained in:
johnny@pittpc.com 2019-08-24 21:26:26 -04:00
parent 59db66f17e
commit 970568b182
2 changed files with 13 additions and 7 deletions

8
db.sql
View File

@ -622,10 +622,10 @@ CREATE TABLE `settings` (
`config_quote_next_number` int(11) DEFAULT NULL,
`config_quote_prefix` varchar(200) DEFAULT NULL,
`config_ticket_prefix` varchar(200) DEFAULT NULL,
`config_ticket_next_number` int(11) NOT NULL,
`config_enable_cron` int(1) NOT NULL,
`config_ticket_next_number` int(11) DEFAULT NULL,
`config_enable_cron` int(1) DEFAULT NULL,
`enable_alert_domain_expire` int(1) DEFAULT NULL,
`enable_alert_low_balance` int(1) NOT NULL,
`enable_alert_low_balance` int(1) DEFAULT NULL,
PRIMARY KEY (`company_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
@ -813,4 +813,4 @@ CREATE TABLE `vendors` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-08-24 20:19:43
-- Dump completed on 2019-08-24 21:25:45

View File

@ -3,7 +3,11 @@
include("config.php");
include("functions.php");
if(!isset($config_enable_setup) or $config_enable_setup == 0){
if(!isset($config_enable_setup)){
$config_enable_setup = 1;
}
if($config_enable_setup == 0){
header("Location: login.php");
}
@ -85,12 +89,14 @@ if(isset($_POST['add_database'])){
fwrite($myfile, $txt);
$txt = "\$config_app_name = 'IT CRM';\n\n";
$txt = "\$config_app_name = 'IT CRM';\n";
fwrite($myfile, $txt);
fclose($myfile);
include("config.php");
// Name of the file
$filename = 'db.sql';
// Temporary variable, used to store current query
@ -196,7 +202,7 @@ if(isset($_POST['add_company_settings'])){
fwrite($myfile, $txt);
$txt = "?>";
$txt = "?>\n";
fwrite($myfile, $txt);