$versions{'login_page_mgr.pl'} = '06.6.00.0000';

# Contains all sub routines (functions) to display the
# login screens for the store manager/admin areas.

#######################################################################
#
# AgoraCart and all associated files, except where noted, are
# Copyright 2001 to Present jointly by K-Factor Technologies, Inc.
# and by C E Mayo (aka Mister Ed) at AgoraCart.com & K-Factor.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This copyright notice may not be removed or altered in any way.
#
#######################################################################

sub display_login {
    my ( $mgr_session_err, $trash ) = @_;

    # delete old login files first
    opendir( USER_LOGINS, "$ip_file_dir" );
    @myfiles = grep( /\.login/, readdir(USER_LOGINS) );
    closedir(USER_LOGINS);
    # set 15 minute default for session times, if empty
    if ( $mc_session_time_setting eq '' ) {
        $mc_session_time_setting = 15;
    }
    my $session_compare_value = $mc_session_time_setting / 1440;
    foreach $zfile (@myfiles) {
        $my_path = "$ip_file_dir/$zfile";
        if ( -M "$my_path" > $session_compare_value ) {
            $my_path =~ /([^\xFF]*)/;
            $my_path = $1;
            unlink("$my_path");
        }
    }

    my $imageURLthingy = "images";
    if (   ( $sc_self_serve_images =~ /yes/i )
        || ( ${sc_path_for_cookie} =~ /^cgi/i ) )
    {
        $imageURLthingy = "manager.cgi?mgr_seshun=$mgr_seshun&picserve=";
    }

    my $temp_manager_cgi_version = "$versions{'manager.cgi'}";
    $temp_manager_cgi_version =~ s/Gold//i;

    print <<ENDOFTEXT;
<!DOCTYPE html>
<html lang="en">
<head>
<title>AgoraCart Route 66 Legacy Version Manager: $sc_domain_name_for_cookie$sc_path_for_cookie</title>
<meta name="description" content="AgoraCart Route 66 Legacy Management Area Login">

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap core CSS -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->

<link rel='icon' href='favicon.ico' type='image/x-icon'>

<!-- Custom styles for this template -->
<link href="assets/agc_mgr2.css" rel="stylesheet">

<style>
/* ~~~ Copyright ~~~ */
.copyright{
    background: url($imageURLthingy/background.gif);
}


/* ~~~ BEGIN Header  ~~~ */
#header {
    background: url($imageURLthingy/background.gif);
}
/* ~~~ END Header ~~~ */
</style>

</head>
<body>
<div class="container">
<nav class="navbar navbar-default navbar-fixed-top">
<div id="header" class="container-fluid">
  <div id="logo">
      <a href="http://www.AgoraCart.com" target="_new"><img src="$imageURLthingy/Agora-logo-white2.gif" width="286" height="55" border="0" alt="AgoraCart eCommerce Shopping Cart System"></a>
  </div>
  <div id="left_top" class="hidden-xs hidden-sm pull-right">
       <img src="$imageURLthingy/header.gif" width="534" height="72" border="0" alt="AgoraCart eCommerce Shopping Cart System">
  </div>
</div>
<div class="container-fluid mgr-bar-width mgr-bar-back">
<div class="navbar-header mgr-bar-back">
    <a class="navbar-brand"><font id="top_product">Route 66 </font><font id="top_version">Gold Version $temp_manager_cgi_version</font></a>
</div>
</div>
</nav>
<div class="container-fluid">
<div class="row col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 mgr-center mgr-legacy-banner">$manager_banner</div>
</div>
ENDOFTEXT

    if ($mgr_session_err) {
        print <<ENDOFTEXT;
<div class="row col-xs-12 col-sm-12 col-md-12 col-lg-12">
    <div class="col-xs-1 col-sm-1 col-md-1 col-lg-2"></div>
    <div class="col-xs-10 col-sm-10 col-md-10 col-lg-8 mgr-warning mgr-center">
        <h3>Oops!</h3>
        <h4>$mgr_session_err</h4>
    </div>
    <div class="col-xs-1 col-sm-1 col-md-1 col-lg-2"></div>
</div>
ENDOFTEXT
    }

    print <<ENDOFTEXT;
<div class="row col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-2"></div>
<div class="col-xs-10 col-sm-10 col-md-10 col-lg-8">
<form class="form-signin" action="manager.cgi" method="post">

        <h2 class="form-signin-heading">Please sign in</h2>
        <label for="inputUsername" class="sr-only">Username</label>
        <input type="text" id="inputUsername" name="username" class="form-control" placeholder="Username" required autofocus>
        <br><br>
        <label for="inputPassword" class="sr-only">Password</label>
        <input type="password" id="inputPassword" name="password" class="form-control" placeholder="Password" required>
        <br>
        <input type=hidden name="login" value="yes">
        <input type=hidden name="welcome_screen" value="yes">
        <br>
        <button class="btn btn-lg btn-primary btn-block" type="submit" value="submit">Sign in</button>

</form>
</div>
<div class="col-xs-1 col-sm-1 col-md-1 col-lg-2"></div>
</div>

<div class="row col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="col-xs-2 col-sm-2 col-md-2 col-lg-3"></div>
<div class="col-xs-8 col-sm-8 col-md-8 col-lg-8">
<br><br><br>
</div>
<div class="col-xs-2 col-sm-2 col-md-2 col-lg-2"></div>
</div>

</div><!-- END main content -->

</div>

</div> <!--end of container-->

<footer class="footer row copyright col-xs-12 col-sm-12 col-md-12 col-lg-12 navbar-fixed-bottom">
<p>&copy; Copyright 1999 to 2020 by CE Mayo, "Mister Ed" and K-Factor Technologies Inc. at <a class="copybuttons" href="https://www.agoracart.com">AgoraCart.com</a> &
<a class="copybuttons" href="https://www.k-factor.net" target="_blank">K-Factor Technologies, Inc.</a></p>
</footer>

<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</body>
</html>
ENDOFTEXT


}

#######################################################################

1;
