View Full Version : How to limit the number of logins?
dvlnblk
06-07-2003, 06:12 PM
I am running an access database where users have to login. It all works fine but I have to make it so they can only login one time and never again with that username and password. Can you help...please?
jsawkang
06-08-2003, 10:22 PM
Hi...
u can use Session to do that.
like
Session("Username")=username
Session("Password")=password
dvlnblk
06-09-2003, 02:45 AM
can you elaborate? Please
jsawkang
06-09-2003, 02:59 AM
<%
Session("Username")=Request.Form("txtusername")
Session("Password")=Request.Form("txtpassword")
%>
the code above u put in ur login.asp page. or whatever name u called it.
Then put the code below on the login page or any other page that u want. * AND Put the code at the TOP(before the HTML tag).
<%
if (Session("Username") <> "") AND Session("Password") <> "") Then
response.redirect "main.asp"
else
response.redirect "relogin.asp"
end if
%>
OR u can save the code as check.asp
then put <!--#include file="check.asp"--> at the top.
dvlnblk
06-09-2003, 08:39 PM
This always sends me to the relogin page. Can you explain to me exactly what this is doing? I mean the <> specifically. If you do I can probably figure out what I need to do to make it work. Thanks Very Much, I greatly appreciate it. Dvl
jsawkang
06-09-2003, 10:50 PM
hi...
the sign "<>" means "not equal to"
in that case it means. if Session("Username") and Session("Password") not equal to nothing, then will redirect u to main.asp page. else to relogin. asp page.
so, u must be login so that the Session kept.
* Note: if anothe person login using the same PC, the session will be overwritten
good luck.
dvlnblk
06-11-2003, 03:05 PM
What you have above it the code that protects a page so that the user has to be loggin in to view it. It is good but I need the code that will only let a user login once. Maybe a way to change his password or something like that when he logges in. Can anyone help me with that? Thanks, DVL
galvatron
06-11-2003, 10:17 PM
can't you just delete the username and password from the record once he logged in for the first time. or he changes it, then replace it with the new one.
or have another column in you database "hasloggedinalready"
with a boolean
then in the login page where haloggedinalready = 'false'
vBulletin v3.0.3, Copyright ©2000-2012, Jelsoft Enterprises Ltd.