An easy point of sale system with automatic inventory tracking. https://netsyms.biz/apps/nickelbox/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.php 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php
  2. require_once __DIR__ . "/required.php";
  3. require_once __DIR__ . "/lib/login.php";
  4. /* Authenticate user */
  5. $userpass_ok = false;
  6. $multiauth = false;
  7. if (checkLoginServer()) {
  8. if ($VARS['progress'] == "1") {
  9. if (authenticate_user($VARS['username'], $VARS['password'])) {
  10. switch (get_account_status($VARS['username'])) {
  11. case "LOCKED_OR_DISABLED":
  12. $alert = lang("account locked", false);
  13. break;
  14. case "TERMINATED":
  15. $alert = lang("account terminated", false);
  16. break;
  17. case "CHANGE_PASSWORD":
  18. $alert = lang("password expired", false);
  19. case "NORMAL":
  20. $userpass_ok = true;
  21. break;
  22. case "ALERT_ON_ACCESS":
  23. sendLoginAlertEmail($VARS['username']);
  24. $userpass_ok = true;
  25. break;
  26. }
  27. if ($userpass_ok) {
  28. if (userHasTOTP($VARS['username'])) {
  29. $multiauth = true;
  30. } else {
  31. doLoginUser($VARS['username'], $VARS['password']);
  32. header('Location: app.php');
  33. die("Logged in, go to app.php");
  34. }
  35. }
  36. } else {
  37. $alert = lang("login incorrect", false);
  38. }
  39. } else if ($VARS['progress'] == "2") {
  40. if (verifyTOTP($VARS['username'], $VARS['authcode'])) {
  41. if (doLoginUser($VARS['username'])) {
  42. header('Location: app.php');
  43. die("Logged in, go to app.php");
  44. } else {
  45. $alert = lang("login server user data error", false);
  46. }
  47. } else {
  48. $alert = lang("2fa incorrect", false);
  49. }
  50. }
  51. } else {
  52. $alert = lang("login server unavailable", false);
  53. }
  54. ?>
  55. <!DOCTYPE html>
  56. <html>
  57. <head>
  58. <meta charset="UTF-8">
  59. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  60. <meta name="viewport" contgreent="width=device-width, initial-scale=1">
  61. <title><?php echo SITE_TITLE; ?></title>
  62. <link href="static/css/bootstrap.min.css" rel="stylesheet">
  63. <link href="static/css/font-awesome.min.css" rel="stylesheet">
  64. <link href="static/css/app.css" rel="stylesheet">
  65. </head>
  66. <body>
  67. <div class="container">
  68. <div class="row">
  69. <div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 col-sm-offset-3 col-md-offset-4 col-lg-offset-4">
  70. <div>
  71. <?php
  72. if (SHOW_ICON == "both" || SHOW_ICON == "index") {
  73. ?>
  74. <img class="img-responsive banner-image" src="static/img/logo.png" />
  75. <?php } ?>
  76. </div>
  77. <div class="panel panel-primary">
  78. <div class="panel-heading">
  79. <h3 class="panel-title"><?php lang("sign in"); ?></h3>
  80. </div>
  81. <div class="panel-body">
  82. <form action="" method="POST">
  83. <?php
  84. if (!is_empty($alert)) {
  85. ?>
  86. <div class="alert alert-danger">
  87. <i class="fa fa-fw fa-exclamation-triangle"></i> <?php echo $alert; ?>
  88. </div>
  89. <?php
  90. }
  91. if ($multiauth != true) {
  92. ?>
  93. <input type="text" class="form-control" name="username" placeholder="<?php lang("username"); ?>" required="required" autofocus /><br />
  94. <input type="password" class="form-control" name="password" placeholder="<?php lang("password"); ?>" required="required" /><br />
  95. <input type="hidden" name="progress" value="1" />
  96. <?php
  97. } else if ($multiauth) {
  98. ?>
  99. <div class="alert alert-info">
  100. <?php lang("2fa prompt"); ?>
  101. </div>
  102. <input type="text" class="form-control" name="authcode" placeholder="<?php lang("authcode"); ?>" required="required" autofocus /><br />
  103. <input type="hidden" name="progress" value="2" />
  104. <input type="hidden" name="username" value="<?php echo $VARS['username']; ?>" />
  105. <?php
  106. }
  107. ?>
  108. <button type="submit" class="btn btn-primary">
  109. <?php lang("continue"); ?>
  110. </button>
  111. </form>
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. <div class="footer">
  117. <?php echo LICENSE_TEXT; ?><br />
  118. Copyright &copy; <?php echo date('Y'); ?> <?php echo COPYRIGHT_NAME; ?>
  119. </div>
  120. </div>
  121. <script src="static/js/jquery-3.2.1.min.js"></script>
  122. <script src="static/js/bootstrap.min.js"></script>
  123. </body>
  124. </html>