CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Slightly extended login needed

Print topic Send  topic

Author Message
dava133
Posted: 02/27/2002, 2:48 PM

I have a situation where users register and there information is entered into my db but have a value in my is_active column of 0 until activated by an administrator. I would like to not allow these users in until it is activated and if possible redirected to a page saying that their registration will be activated shortly and then they will be able to access the site. So if the login and password is correct I need users with is_activated value = 0 to go to the screen just mentioned and ones which = 1 just to proceed as normal. Im using ASP 2.0 w/ templates but Im not too good with ne of the languages although im willing to give ne ideas a go, ne on have ne solutions??

If this is not possible I will just have to set security level = 0 after registration then when activated also change that to 1 but I cant see how I could have the intermediatery page using that method, cheers

David

David
Ken Hardwick
Posted: 02/27/2002, 3:34 PM

Try something similar to below...
Add the following to the "On Login" Event
'get the value from Is_activated field
Activated = CLng(DLookUp("Member_Info", "is_activated", "Login =" & ToSQL(sLogin, "Text") & " and Password=" & ToSQL(sPassword, "Text")))

'If the value is 1 then the bPassed value will not change
'however, if it is zero (not activated) them bPassed will be set back
'to zero and user will not be able to login
bPassed = bPassed * Activated
dava133
Posted: 02/27/2002, 4:15 PM

cheers m8 just tried that but now it just seems to reject all usernames/passwords!! don't understand why :(
Ken Hardwick
Posted: 02/27/2002, 4:50 PM

Try...custom login..obtain code...and add the code between the stars...
works for...ken

'-------------------------------
sLogin = GetParam("Login")
sPassword = GetParam("Password")
bPassed = CLng(DLookUp("Member_Info", "count(*)", "Login =" & ToSQL(sLogin, "Text") & " and Password=" & ToSQL(sPassword, "Text")))

if bPassed > 0 then
'-------------------------------
' Login and password passed
'-------------------------------
Session("UserID") = sLogin
Session("UserRights") = CLng(DLookUp("Member_Info", "Access_Code", "Login =" & ToSQL(sLogin, "Text") & " and Password=" & ToSQL(sPassword, "Text")))

'****************************************************************************
'get the value from Is_activated field
Activated = CLng(DLookUp("Member_Info", "is_activated", "Login =" & ToSQL(sLogin, "Text") & " and Password=" & ToSQL(sPassword, "Text")))

if Activated = 0 then
response.redirect("NotActivate.asp")
end if
'****************************************************************************

if not(sPage = request.serverVariables("SCRIPT_NAME")) and not(isEmpty(sPage)) then
response.redirect(sPage & "?" & sQueryString)
end if
else
sloginErr = "Login or Password is incorrect."
end if
'-------------------------------
dava133
Posted: 02/27/2002, 5:16 PM

still no joy, now all un/pw combinations seem to be redictting to notactivated.asp, under Session("UserRi...
I have a cn.Close
and a Set cn = Nothing
u dont seem to have them on urs, should they be above or below the code i just entered?? cheers
Ken Hardwick
Posted: 02/28/2002, 12:33 AM

What I had last suggested works great for me...
Steps to take...
1)Open the custom login event..and "generate the code"..
At this time mine looks as follows :
///////////////////////////////////////////////////////////////////////////////
'-------------------------------
sLogin = GetParam("Login")
sPassword = GetParam("Password")
bPassed = CLng(DLookUp("Member_Info", "count(*)", "Login =" & ToSQL(sLogin, "Text") & " and Password=" & ToSQL(sPassword, "Text")))

if bPassed > 0 then
'-------------------------------
' Login and password passed
'-------------------------------
Session("UserID") = sLogin
Session("UserRights") = CLng(DLookUp("Member_Info", "Access_Code", "Login =" & ToSQL(sLogin, "Text") & " and Password=" & ToSQL(sPassword, "Text")))
if not(sPage = request.serverVariables("SCRIPT_NAME")) and not(isEmpty(sPage)) then
response.redirect(sPage & "?" & sQueryString)
end if
else
sloginErr = "Login or Password is incorrect."
end if
'-------------------------------
////////////////////////////////////////////////////////////////////////////////Then copy/paste the "Session("UserRights")=...."
row to right below itself...change Session("userrights") to "Is_activated" and
change "access_ccode" to the "Is_Activated" or what every your field names are.
Add your if right after that..
which results in the following for me...
This works fine for me so not sure why you are having a problem.
One way to test would be just set your variable to a value and generate/test
Like add "IsActivate = 1" right before the new if statement and test.
And "IsActivate = 0" and test again. If both worked, then there is something wrong with your lookup???
Best of luck..if you still can not get to work, send me an email for addition help.
Ken@KenHardwick.com


'-------------------------------
sLogin = GetParam("Login")
sPassword = GetParam("Password")
bPassed = CLng(DLookUp("Member_Info", "count(*)", "Login =" & ToSQL(sLogin, "Text") & " and Password=" & ToSQL(sPassword, "Text")))

if bPassed > 0 then
'-------------------------------
' Login and password passed
'-------------------------------
Session("UserID") = sLogin
Session("UserRights") = CLng(DLookUp("Member_Info", "Access_Code", "Login =" & ToSQL(sLogin, "Text") & " and Password=" & ToSQL(sPassword, "Text")))


Is_activated = CLng(DLookUp("Member_Info", "Is_Activated", "Login =" & ToSQL(sLogin, "Text") & " and Password=" & ToSQL(sPassword, "Text")))

If Is_Activated = 0 then
response.redirect("Not_Activated")
end if



if not(sPage = request.serverVariables("SCRIPT_NAME")) and not(isEmpty(sPage)) then
response.redirect(sPage & "?" & sQueryString)
end if
else
sloginErr = "Login or Password is incorrect."
end if
'-------------------------------




   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.