Author |
Topic |
|
kmedlin
Starting Member
14 Posts |
Posted - 08 April 2004 : 01:58:37
|
Before I write I want to say that I have taken full advantage of the search features of this board. I've read a TON tonight and I'm still having some problems.
I have the need for 2 logins that access the SQL 2000 database I have the web-application hosted in.
1st Login: Sets site variables for my website
2nd Login: Sets cookie information for Snitz
1st Login works well. When there is a successful login I redirect the browser to a page called transferlogin.asp that has the following code: (minus * of course)
<!--#include file="forum/inc_func_common.asp"--> <% Call doCookies(strEncodedPassword) %>
This calls the doCookies function and passes it the password from the user that is logging in. I have checked with a response.write to ensure that something is actually being written to the strEncodedPassword.
I have also disabled the encryption (sha256) functionality in the inc_sha256.asp file. This, I'm told, will disable the encryption and it looks like it has because when I create new users via the forum registration their passwords are not encrypted.
Here's the strange part...
I set the strEncodedPassword and strDBNTFUserName at the same time and know they have something written to them. However, I'm not entirely sure what happens in the doCookies subroutine.
My interpretation of the code is that:
1) It sets the cookie 2) It checks to see if the strEncodedPassword and strDBNTFUserName match 3) If they do it writes the cookie and sets the expiration date set in the config.asp file.
I added 2 lines of code.
After the lines: if fSavePassWord = "true" then Response.Cookies(strUniqueID & "User").Expires = dateAdd("d", intCookieDuration, strForumTimeAdjust)
I added: response.redirect("main.asp")
THEN
After the lines: Session(strCookieURL & "last_here_date") = ReadLastHereDate(strDBNTFUserName) I added: response.redirect("default.asp")
So....
If the sub routine runs correctly I will either go to main.asp if the cookie is set, or to default.asp if it is not set correctly.
Unfortunately, I continually get redirected back to default.asp and I'm totally confused as to why!
Any help would be greatly appreciated! |
|
kmedlin
Starting Member
14 Posts |
Posted - 08 April 2004 : 08:59:58
|
I cannot use Universal Login mod simply because I cannot change the way the user logs in. Otherwise I'd use that mod because it's basically what I'm looking for for the 2nd login.
Anyone got any help? |
|
|
OneWayMule
Dev. Team Member & Support Moderator
Austria
4969 Posts |
|
kmedlin
Starting Member
14 Posts |
Posted - 08 April 2004 : 09:13:29
|
LOGIN CODE: (I just modified the typical Dreamweaver login code to set some other variables for me that I need throughout the site.)
<% ' *** Validate request to log in to this site. MM_LoginAction = Request.ServerVariables("URL") If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString) MM_valUsername=CStr(Request.Form("username")) If MM_valUsername <> "" Then MM_fldUserAuthorization="" MM_redirectLoginSuccess="transferlogin.asp" MM_redirectLoginFailed="login.asp?fail=1" MM_flag="ADODB.Recordset" set MM_rsUser = Server.CreateObject(MM_flag) MM_rsUser.ActiveConnection = MM_conWARnet_STRING MM_rsUser.Source = "SELECT M_NAME, M_PASSWORD, MEMBER_ID, M_LEVEL" If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization MM_rsUser.Source = MM_rsUser.Source & " FROM cultur3k.FORUM_MEMBERS WHERE M_NAME='" & Replace(MM_valUsername,"'","''") &"' AND M_PASSWORD='" & Replace(Request.Form("password"),"'","''") & "'" MM_rsUser.CursorType = 0 MM_rsUser.CursorLocation = 2 MM_rsUser.LockType = 3 MM_rsUser.Open If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then ' username and password match - this is a valid user Session("MM_Username") = MM_valUsername Session("UserID") = MM_rsUser.Fields.Item("MEMBER_ID").Value Session("UserLevel") = MM_rsUser.Fields.Item("M_LEVEL").Value Session("UserPW") = MM_rsUser.Fields.Item("M_PASSWORD").Value If (MM_fldUserAuthorization <> "") Then Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value) Else Session("MM_UserAuthorization") = "" End If if CStr(Request.QueryString("accessdenied")) <> "" And false Then MM_redirectLoginSuccess = Request.QueryString("accessdenied") End If MM_rsUser.Close Response.Redirect(MM_redirectLoginSuccess) End If MM_rsUser.Close Response.Redirect(MM_redirectLoginFailed) End If %>
so...what happens is that it gets passed to transferlogin.asp which has this code:
<!--#include file="forum/inc_func_common.asp"--> <% strDBNTFUserName = Session("MM_UserName") strEncodedPassword = Session("UserPW") Call doCookies(Request.Form("password")) %>
Which then runs the modified doCookies code which looks like this: sub doCookies(fSavePassWord) if strSetCookieToForum = 1 then Response.Cookies(strUniqueID & "User").Path = strCookieURL else Response.Cookies(strUniqueID & "User").Path = "/" end if Response.Cookies(strUniqueID & "User")("Name") = strDBNTFUserName Response.Cookies(strUniqueID & "User")("Pword") = strEncodedPassword 'Response.Cookies(strUniqueID & "User")("Cookies") = Request.Form("Cookies") if fSavePassWord = "true" then Response.Cookies(strUniqueID & "User").Expires = dateAdd("d", intCookieDuration, strForumTimeAdjust) response.redirect("main.asp") end if Session(strCookieURL & "last_here_date") = ReadLastHereDate(strDBNTFUserName) response.redirect("default.asp") end sub
Every time I end up going back to default.asp. If I remove that final line it just sits at transferlogin.asp so I know that when it fails and not when it succeeds it goes to default.asp.
Any suggestions? |
|
|
kmedlin
Starting Member
14 Posts |
Posted - 08 April 2004 : 09:16:32
|
Ahhhhh.....
Actually I didn't have my transferlogin as above (hadn't uploaded that)....now when I do get it like that I get the following error:
ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/warnet/forum/inc_func_common.asp, line 554
line 554 is in this function:
function ReadLastHereDate(UserName) dim rs_date dim strSql if trim(UserName) = "" then ReadLastHereDate = DateToStr(DateAdd("d", -10, strForumTimeAdjust)) exit function end if '## Forum_SQL strSql = "SELECT M_LASTHEREDATE " strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS " strSql = strSql & " WHERE " & strDBNTSQLName & " = '" & ChkString(UserName, "SQLString") & "' " Set rs_date = Server.CreateObject("ADODB.Recordset") rs_date.open strSql, my_Conn if (rs_date.BOF and rs_date.EOF) then ReadLastHereDate = DateToStr(DateAdd("d",-10,strForumTimeAdjust)) else if rs_date("M_LASTHEREDATE") = "" or IsNull(rs_date("M_LASTHEREDATE")) then ReadLastHereDate = DateToStr(DateAdd("d",-10,strForumTimeAdjust)) else ReadLastHereDate = rs_date("M_LASTHEREDATE") end if end if rs_date.close set rs_date = nothing UpdateLastHereDate DateToStr(strForumTimeAdjust),UserName end function
line 554 specifically is: rs_date.open strSql, my_Conn
|
|
|
OneWayMule
Dev. Team Member & Support Moderator
Austria
4969 Posts |
|
kmedlin
Starting Member
14 Posts |
Posted - 08 April 2004 : 09:26:08
|
Okay...
I edited the transferlogin.asp page to look like this and uploaded it: <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <!--#include file="forum/config.asp"--> <!--#include file="forum/inc_header.asp"-->
<% strDBNTFUserName = Session("MM_UserName") strEncodedPassword = Session("UserPW") Call doCookies(Request.Form("password")) %>
Now I get the error: There has been a problem...
Your strDBType is not set, please edit your config.asp to reflect your database type.
However, when I check my config.asp file strDBType is set! So I'm unsure why it's saying this. |
Edited by - kmedlin on 08 April 2004 09:33:08 |
|
|
OneWayMule
Dev. Team Member & Support Moderator
Austria
4969 Posts |
|
kmedlin
Starting Member
14 Posts |
Posted - 08 April 2004 : 09:33:46
|
I am using SQL 2000
In my config.asp it reads: strDBType = "sqlserver" |
|
|
kmedlin
Starting Member
14 Posts |
Posted - 09 April 2004 : 11:09:18
|
anyone? |
|
|
kmedlin
Starting Member
14 Posts |
Posted - 13 April 2004 : 10:44:27
|
seriously! nobody knows anything about the doCookies sub routine? This is really bizarre because I cannot figure out why my code isn;t working! |
|
|
|
Topic |
|