<%
'----------------------------------------------------------------------------------------
'-  ASP Security Login - Version 2.0 - 01 June 2005 
'-  Copyright © 2005 - Livio Siri (http://www.livio.net) - All Rights Reserved.     
'----------------------------------------------------------------------------------------
Option Explicit

'--- Prevent caching
Response.Buffer = True
Response.ExpiresAbsolute = Now() - 1
Response.AddHeader "cache-control", "must-revalidate"
Response.AddHeader "cache-control", "private"
Response.AddHeader "pragma", "no-cache"
Session.Timeout = 20

'--- Define variables
Dim sReferer, sGoBackTo, sUserName, sPassword, bLoginSuccessful, Error
Dim UserName, Password

'--- #### EDIT YOUR USERNAME and PASSWORD HERE ####
UserName = "manemp"
Password = "employee"
'--- #### END EDIT ####

if request.querystring("comebackto") <> "" then
	sReferer = request.querystring("comebackto")
	sGoBackTo = "?" & request.querystring
end if

'--- If Login Form has been submitted
if request.form("Status") = "FormSubmitted" then
	sUserName = replace(request.form("txtUserName"),"'","")
	sPassword = replace(request.form("txtPassword"),"'","")

'--- Check for username and password match
	If (sUserName = UserName) AND (sPassword = Password) then
		bLoginSuccessful = True
	Else
		bLoginSuccessful = False
		Error = "Nombre de usuario o contraseña incorrecta"
	'--- Send user to the default page after 3 unsuccessful try
		Session("count") = Session("count") + 1
		if Session("count") > 3 then 
			Session.abandon
			response.redirect sGoBackTo
		End if
	End if
	Session("bLoginSuccessful") = bLoginSuccessful
End if

'--- After a successful login, let's send the user back to see the protected page
'--- The variable sReferer holds the page to go back,
'---  if it is empty, the user is redirected to the default page
if bLoginSuccessful Then
	if sReferer = "" then
		response.redirect "../"
	else
		response.redirect sReferer
	end if
else
'--- If no login performed then display the Login Form
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><title>Login into protected pages - by www.lasp.net</title>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META name="description" content="This page requires login">
<style>
BODY, TD {
	color: NAVY;
	font-family: "Trebuchet MS";
	font-size: 14px;
	font-weight: bold;
}
A:link     {text-decoration: none}
A:visited  {text-decoration: none}
A:active   {text-decoration: none}
A:hover    {text-decoration: none;color: #000000}
.text {color: NAVY;font-family: Verdana,tahoma,Arial;font-size: 9px;}
.coltext {color: tomato;font-family: Verdana,tahoma,Arial;font-size: 10px;font-weight: bold;}
.inputSubmit {
	color: NAVY;
	background-color: #FFFFFF;
	border-color : NAVY;
	border-top : 1px solid;
	border-bottom : 1px solid;
	border-left : 1px solid;
	border-right : 1px solid;
	font-family : "Trebuchet MS";
	font-size : 14px;
	font-weight: bold;
	padding-left: 10px;
	padding-right: 10px;
	cursor: hand;
}
.inputBox {
	color : NAVY;
	background : #FFFFFF;
	border-color : NAVY;
	border-top : 1px solid;
	border-bottom : 1px solid;
	border-left : 1px solid;
	border-right : 1px solid;
	font-family : "Trebuchet MS";
	font-size : 12px;
}
body {
	background-color: #FFFFFF;
}
</style>
</HEAD>
<body  language="JavaScript" onLoad="document.Login.txtUserName.focus()">
<br>
<br><br><br><br>


<table width="200" border="0" align="center" cellpadding="5" cellspacing="0" style="border: 1px solid navy;">
<form action="login.asp<%=sGoBackTo%>" method="post" name="Login">
<tr>
<%
'--- Show error when credentials are incorrect 
if Error <> "" then
	response.write "<td colspan=2 align=center class=coltext bgcolor=#F0FFF0 style=""border-bottom: 1px solid navy;"">" & Error
	response.write "</td></tr><tr>"
End if
%>
<td bgcolor="#FFFFFF" align=center height=80><img name="lojo" src="logo.jpg" width="200" height="70" alt=""><br></td>
</tr>
<tr>
  <td bgcolor="#FFFFFF" align=center>Acceso a SIEPS</td>
</tr>
<tr>
  <td bgcolor="#FFFFFF" align=center height=80><table border="0" cellpadding="2" cellspacing="0">
    <tr>
      <td align="right"><b>Usuario:</b></td>
      <td><input type="Text" name="txtUserName" size="18" class="inputBox"></td>
    </tr>
    <tr>
      <td align="right"><b>Password:</b></td>
      <td><input type="Password" name="txtPassword" size="18" class="inputBox"></td>
    </tr>
    <tr>
      <td class=text align=center height=30>&nbsp;</td>
      <td class=text align=center><input type="submit" name="cmdLogin" value="Login" class="inputSubmit">
          <input type="hidden" name="Status" value="FormSubmitted"></td>
    </tr>
  </table></td>
</tr>
</form></table>

<p align=center>

</BODY></HTML>
<% End if %>
