tiamat2012
Programmer
Hey all,
For my clients I create little sections where they can keep their database maintained (little admin programs) but these areas need to be passworded.. and I don't have access to their hoster to see if they support ssl.
In the meantime, I've done md5 encryption but I need a check on each page that requires them to have logged in. Does anybody know how I can set up something to do this? I know how to do it in ASP, it requires to standard pages (maybe you can convert?)
security.asp
login.asp
and then you insert this at the beginning of whatever page you need them to be logged in to reach
Could anyone help?
Thank you for your time,
Kerry
For my clients I create little sections where they can keep their database maintained (little admin programs) but these areas need to be passworded.. and I don't have access to their hoster to see if they support ssl.
In the meantime, I've done md5 encryption but I need a check on each page that requires them to have logged in. Does anybody know how I can set up something to do this? I know how to do it in ASP, it requires to standard pages (maybe you can convert?)
security.asp
Code:
bLoggedIn = (len(session("UserName")) > 0)
if bRequireLogin then
'Login required
if Not bLoggedIn then
'Not logged in, ask for login
response.redirect "login.asp?comebackto=" & _
request.servervariables("script_name") & "?" & _
server.urlencode(request.querystring)
'Note how we construct the page to come back
end if
end if
login.asp
Code:
<%
if request("comebackto") <> "" then
sReferer = request("comebackto")
sGoBackTo = "?" & request.querystring
end if
'Login Form submitted
sUserName = request("txtUserName")
sPassword = request("txtPassword")
if request("cmdLogin") <> "" then
'Check for username and password
if sUserName = "bill" And sPassword = "gates" then
bLoginSuccessful = True
session("UserName") = sUserName
if sReferer = "" then
response.redirect "default.asp"
else
response.redirect sReferer
end if
end if
'After a successful login, let's send the user
'back to the page requested. The variable sReferer
'holds the page to go back, if it is empty, we should
'redirect the user to our default page.
end if
'Display the Login Form
%>
<form action="login.asp<%=sGoBackTo%>" method="post">
<input type="text" name="txtUserName"><br>
<input type="password" name="txtPassword"><br>
<input type="submit" name="cmdLogin"><br>
</form>
and then you insert this at the beginning of whatever page you need them to be logged in to reach
Code:
<%
bRequireLogin = True
%>
<!--#include file="security.asp"-->
Could anyone help?
Thank you for your time,
Kerry