<?php require_once('../Connections/connect.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysqli_real_escape_string") ? mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $theValue) : ((isset($GLOBALS["___mysqli_ston"]) && is_object($GLOBALS["___mysqli_ston"])) ? mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $theValue) : ((trigger_error("[MySQLConverterToo] Fix the mysql_escape_string() call! This code does not work.", E_USER_ERROR)) ? "" : ""));

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['username'])) {
  $loginUsername=$_POST['username'];
  $password=$_POST['password'];
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "myacount.php";
  $MM_redirectLoginFailed = "../error.php";
  $MM_redirecttoReferrer = false;
  mysqli_select_db( $connect, $database_connect);
  
  $LoginRS__query=sprintf("SELECT username, password FROM client WHERE username=%s AND password=%s",
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
   
  $LoginRS = mysqli_query( $connect, $LoginRS__query) or die(mysqli_error($GLOBALS["___mysqli_ston"]));
  $loginFoundUser = mysqli_num_rows($LoginRS);
  if ($loginFoundUser) {
     $loginStrGroup = "";
    
	if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;	      

    if (isset($_SESSION['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];	
    }
    header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}
?>
<!DOCTYPE html>
<html lang="en">

<head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Altura Credit Union</title>
        <!-- fav icon -->
        <link href="../assets/images/favicon.png" rel="shortcut icon" type="image/png">

        <!-- Bootstrap -->
        <link href="../assets/bootstrap/css/bootstrap.min.css" rel="stylesheet">
        <!-- animated-css -->
        <link href="../assets/css/animate.min.css" rel="stylesheet" type="text/css">
        <!-- font-awesome-css -->
        <link href="../assets/css/font-awesome.min.css" rel="stylesheet" type="text/css">
        <!-- owl-carrosel-css -->
        <link href="../assets/owl-carrosel/owl.carousel.min.css" rel="stylesheet" type="text/css">
        <link href="../assets/owl-carrosel/owl.theme.default.min.css" rel="stylesheet" type="text/css">
        <!-- offcanvas-menu-css -->
        <link href="../assets/css/offcanvas-menu.css" rel="stylesheet" type="text/css">
        <!-- style-css -->
        <link href="../assets/css/style.css" rel="stylesheet" type="text/css">
        <link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css">
    <script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
</head>
    <body class="serviceGrid-page sub-page">
        <!-- start preloader -->
        
        <!-- end preloader -->

        <div id="main-wrapper">
            <div id="box"></div>
            
            <header class="header-section header-section-one">
                <nav class="navbar navbar-inverse ">
                    <div class="container">
                        <div class="nav-p">
                            <div class="navbar-wrapper">
                                <div class="navbar-header">
                                    <a class="navbar-brand" href="../index.html">
                                        <img class="caption hidden-sm hidden-xs" src="../assets/images/logo.png" alt="image">
                                        <img class="caption-two visible-sm visible-xs" src="../assets/images/logo-m.png" alt="image">
                                    </a>
                                </div>

                                <div class="collapse navbar-collapse hidden-sm hidden-xs">
                                    <ul class="nav navbar-nav">
	                                    <li><a href="../index.html">Home</a></li>

                                        <li><a href="../about.html">About</a></li>

                                        <li><a href="../service.html">Service</a></li>

  <li><a href="../loan.html">Loans</a></li>
   <li class="active"><a href="../login.php">Login</a></li>
   
                                      <li><a href="../contact.html">Contact</a>
                                        </li>
                              
	                                </ul>
                                </div>
                            </div> 

                            <div class="nav-right-bar navbar-right hidden-sm hidden-xs">
                                <span><a href="#">Get a Quote</a></span>

                                <div class="search-view">
                                    <span class="open-bar"><i class="fa fa-search" aria-hidden="true"></i></span>

                                    <div id="search-bar">
                                        <span class="close-bar pull-right"><i class="fa fa-times" aria-hidden="true"></i></span>

                                        <form class="form-bar">
                                            <div class="form-group">
                                                <input type="text" class="form-control">
                                            </div>
                                        </form>
                                    </div> 
                                </div> 
                            </div> 
                        </div>
                    </div> 
                </nav> 
            </header> <!-- header-section -->


            <section class="banner-section">
                <div class="container">
                    <div class="header-title text-center">
                        <h2 class="title">Internet Banking</h2>
                        <span class="sub-title">Home > <span>Internet Banking</span></span>
                    </div> <!-- header-title -->
                </div>
            </section> <!-- banner-section -->



            <section class="working-section section-padding">
                <div class="working-section-two">
                    <div class="container">
                        <div class="header">
                            <div class="row">
                                <div class="col-sm-3"></div>

                                <div class="col-sm-9">
                                  <form name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
                                    <table width="400" border="1" class="table-bordered table-condensed">
                                      <tr>
                                        <td>Username</td>
                                        <td><span id="sprytextfield1"><span class="textfieldRequiredMsg">A value is required.</span></span>
                                          <label for="username"></label>
                                        <input type="text" name="username" id="username"></td>
                                      </tr>
                                      <tr>
                                        <td>Password</td>
                                        <td><span id="sprytextfield2">
                                          <label for="password"></label>
                                          <input type="password" name="password" id="password">
                                        <span class="textfieldRequiredMsg">A value is required.</span></span></td>
                                      </tr>
                                      <tr>
                                        <td>&nbsp;</td>
                                        <td><input type="submit" name="button" id="button" value="Login" class="btn btn-primary"s></td>
                                      </tr>
                                    </table>
                                  </form>
                                  <p>&nbsp;</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div> 
            </section>

        </div> <!-- main-wrapper -->


            <footer class="footer-section">
              <div class="copyright-section">
                  <div class="container">
                         <p class="inline-block">2022 © All rights reserved by <span><a href="#">Altura Credit Union</a></span></p>

                        <ul class="pull-right">
                            <li><a href="#">Legal</a></li>
                            <li><a href="#">SItemap</a></li>
                            <li><a href="#">Privacy Policy</a></li>
                        </ul>
                    </div>
                </div> 
            </footer> <!-- footer-section -->
        

        <!-- Off-Canvas View Only -->
        <span class="menu-toggle navbar visible-xs visible-sm"><i class="fa fa-bars" aria-hidden="true"></i></span>

        
    <!-- Off-Canvas View Only -->

        <div id="toTop" class="hidden-xs">
            <i class="fa fa-chevron-up"></i>
        </div> <!-- totop -->


        <script src="../assets/js/jquery.js"></script>
        <script src="../assets/bootstrap/js/bootstrap.min.js"></script>
        <script src="../assets/js/jquery.inview.min.js"></script>
        <script src="../assets/js/wow.js"></script>
        <script src="../assets/js/lightbox.js"></script>
        <script src="../assets/owl-carrosel/owl.carousel.min.js"></script>
        <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js"></script>
        <script src="../assets/js/script.js"></script>
    <script type="text/javascript">
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
    </script>
    </body>

</html>



