index.php 828 B

123456789101112131415161718192021222324252627
  1. <?php
  2. require_once("../config.php");
  3. if(isset($_SESSION['authorized']) && $_SESSION['authorized']) {
  4. header("Location: /dashboard/");
  5. }
  6. $database = SqliteDatabase::getSingleton();
  7. $validAccounts = $database->queryArray("SELECT rowid AS client_id, subdomain FROM accounts;");
  8. $clientId = 0;
  9. foreach($validAccounts as $account) {
  10. if($account['subdomain'] == DOMAIN) {
  11. $clientId = $account['client_id'];
  12. break;
  13. }
  14. }
  15. if($clientId == 0) {
  16. header("Location: http://ccldtech.com");
  17. }
  18. $currentAccount = $database->queryArray("SELECT rowid AS client_id, * FROM accounts WHERE client_id = ".$clientId." LIMIT 1;")[0];
  19. $data = array();
  20. $data['currentClient'] = $currentAccount;
  21. $data['defaultStylesheet'] = DOMAIN . ".css";
  22. $data['currentClient']['logo'] = "ccldlogo.png";
  23. echo (new View())->render("login.php", $data);