Author |
Topic |
night-red
Starting Member
Canada
8 Posts |
Posted - 17 October 2002 : 22:16:05
|
i use this as a include in my pages it is for a access db with db access not nt i have no visible problems but there are some bas problems in mods etc.
Also i removed the code that adds the javascript to show text at the bottom of the page in my script
<!--#INCLUDE VIRTUAL="/board/inc_sha256.asp"-->
<%
'###################
'# config
'###################
Response.Buffer = true
dim strDBType, strConnString, strTablePrefix, strMemberTablePrefix, strFilterTablePrefix '## Do Not Edit
Dim counter, ConnErrorNumber, ConnErrorDesc, blnSetup '## Do Not Edit
strDBType = "access"
strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:/inetpub/database/snitz_forums_2000.mdb" '## MS Access 2000
strTablePrefix = "FORUM_"
strMemberTablePrefix = "FORUM_"
strFilterTablePrefix = "FORUM_" 'used for BADWORDS and NAMEFILTER tables
Const intAdminMemberID = 1
strCookieURL = Left(Request.ServerVariables("Path_Info"), InstrRev(Request.ServerVariables("Path_Info"), "/"))
strUniqueID = "Snitz00"
strDBNTSQLName = "M_NAME"
strAutoLogon = "0"
strNTGroups = "0"
'###################
'# func_common
'###################
function chkString(pString,fField_Type)
fString = trim(pString)
if fString = "" or isNull(fString) then
fString = " "
end if
Select Case fField_Type
Case "SQLString"
fString = Replace(fString, "'", "''")
fString = HTMLEncode(fString)
chkString = fString
exit function
Case "display"
if strAllowHTML <> "1" then
fString = HTMLEncode(fString)
end if
if strBadWordFilter = "1" then
fString = ChkBadWords(fString)
end if
fString = replace(fString,"+","#043;")
chkString = fString
exit function
End Select
chkString = fString
end function
function HTMLEncode(pString)
fString = trim(pString)
if fString = "" or IsNull(fString) then
fString = " "
else
fString = replace(fString, ">", ">")
fString = replace(fString, "<", "<")
end if
HTMLEncode = fString
end function
function chkQuoteOk(fString)
chkQuoteOk = not(InStr(1, fString, "'", 0) > 0)
end function
function chkUser(fName, fPassword, fAuthor)
dim rsCheck
dim strSql
'## Forum_SQL
strSql = "SELECT MEMBER_ID, M_LEVEL, M_NAME, M_PASSWORD "
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " WHERE " & strDBNTSQLName & " = '" & ChkString(fName, "SQLString") & "' "
strSql = strSql & " AND M_PASSWORD = '" & ChkString(fPassword, "SQLString") &"'"
strSql = strSql & " AND M_STATUS = " & 1
Set rsCheck = my_Conn.Execute(strSql)
if rsCheck.BOF or rsCheck.EOF or not(ChkQuoteOk(fName)) or not(ChkQuoteOk(fPassword)) then
MemberID = -1
chkUser = 0 '## Invalid Password
if strDBNTUserName <> "" and chkCookie = 1 then
Call ClearCookies()
strDBNTUserName = ""
end if
else
MemberID = rsCheck("MEMBER_ID")
if (rsCheck("MEMBER_ID") & "" = fAuthor & "") and (cLng(rsCheck("M_LEVEL")) <> 3) then
chkUser = 1 '## Author
else
select case cLng(rsCheck("M_LEVEL"))
case 1
chkUser = 2 '## Normal User
case 2
chkUser = 3 '## Moderator
case 3
chkUser = 4 '## Admin
case else
chkUser = cLng(rsCheck("M_LEVEL"))
end select
end if
end if
rsCheck.close
set rsCheck = nothing
end function
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", 30, date & " " & time)
end if
end sub
sub ClearCookies()
if strSetCookieToForum = 1 then
Response.Cookies(strUniqueID & "User").Path = strCookieURL
else
Response.Cookies(strUniqueID & "User").Path = "/"
end if
Response.Cookies(strUniqueID & "User") = ""
Session(strCookieURL & "Approval") = ""
Session.Abandon
end sub
'###################
'# header
'###################
set my_Conn = Server.CreateObject("ADODB.Connection")
my_Conn.Open strConnString
strDBNTUserName = Request.Cookies(strUniqueID & "User")("Name")
strDBNTFUserName = trim(chkString(Request.Form("Name"),"SQLString"))
if strDBNTFUserName = "" then strDBNTFUserName = trim(chkString(Request.Form("User"),"SQLString"))
select case Request.Form("Method_Type")
case "login"
strEncodedPassword = sha256("" & Request.Form("Password"))
select case chkUser(strDBNTFUserName, strEncodedPassword,-1)
case 1, 2, 3, 4
Call DoCookies(Request.Form("SavePassword"))
strLoginStatus = 1
case else
strLoginStatus = 0
end select
case "logout"
Call ClearCookies()
end select
if trim(strDBNTUserName) <> "" and trim(Request.Cookies(strUniqueID & "User")("Pword")) <> "" then
chkCookie = 1
mLev = cLng(chkUser(strDBNTUserName, Request.Cookies(strUniqueID & "User")("Pword"),-1))
chkCookie = 0
else
MemberID = -1
mLev = 0
end if
my_conn.close
set my_conn = nothing
%>
|
- Night-Red
|
|
|
spageforum
Starting Member
Australia
29 Posts |
Posted - 20 October 2002 : 22:45:35
|
Hi @tomic,
Looks like there is a small typo in the readme file released on 9/29/02. Just above the 3rd text box, it says IN_HEADER.ASP. I think you meant the inc_header.asp. |
|
|
jtisdale
Starting Member
USA
4 Posts |
Posted - 24 October 2002 : 01:13:34
|
FYI, the readme file contains errors in that you have the suffix on three of the buttons as .asp:
button_logout.asp button_login2.gif button_logout2.asp button_login3.gif button_logout3.asp
Thanks for the tool...JT |
|
|
mike124
New Member
68 Posts |
Posted - 26 October 2002 : 06:58:51
|
Great mod so far. But I have a problem
If I use the MOD to log on without saving the password my membername is shown. But when I go the forum it says I'm not logged on. And its the same the other way around.Is that a bug?
If I say yes to save the password there is no problems.
coockies are set to website
I havn't changed any code and they are included like this: <!--#INCLUDE VIRTUAL="forum3403/config.asp"--> <!--#INCLUDE VIRTUAL="forum3403/inc_sha256.asp"--> <!--#INCLUDE VIRTUAL="forum3403/inc_func_common.asp"--> <!--#INCLUDE VIRTUAL="forum3403/inc_header.asp"--> <!--#INCLUDE VIRTUAL="forum3403/inc_login.asp"--> |
Edited by - mike124 on 26 October 2002 07:48:11 |
|
|
keimdf
Starting Member
USA
21 Posts |
Posted - 01 November 2002 : 21:34:41
|
sorry, but I don't see this connection. Specifically, how do I insert the inc_login.asp into a page to get a validated login and how do I direct it to a specific page? |
|
|
Eric915
Starting Member
31 Posts |
Posted - 04 November 2002 : 17:37:26
|
I can't get this to work. I login on /ac2 but when I hop to my forum page at /ac2/forum it shows me as not logged in. I think it has something to do with what Work_mule posted above. But for the life of me, I don't know how to fix it. |
|
|
keimdf
Starting Member
USA
21 Posts |
Posted - 07 November 2002 : 07:55:50
|
Currently, I am maintain two MS Access databases on my website. The most current one is the Snitz BBS database. I use the other database to provide login access to several other areas on my web site. What I want to do is just use the Snitz database for all functions. I have read all of this thread and have spent several days trying different parts of the everything that I have found here with NO success. This has been terribly frustrating. Can anyone help me with this?
here is a snippet of my most current code. The login screen displays and I can enter both username & password, but it clears the screen and returns to enter the "UserName". I am not sure that it every gets out of the screen.
<!--#INCLUDE FILE="config.asp" --> <!--#INCLUDE FILE="inc_sha256.asp"--> <!--#INCLUDE FILE="inc_func_common.asp" --> <!--#INCLUDE FILE="inc_func_secure.asp" --> <!--#INCLUDE FILE="inc_login.asp" --> <% if (strAuthType = "nt") then call NTauthenticate() if (ChkAccountReg() = "1") then call NTUser() end if end if
strDBNTUserName = Request.Cookies(strUniqueID & "User")("Name") strDBNTFUserName = trim(chkString(Request.Form("Name"),"SQLString")) if strDBNTFUserName = "" then strDBNTFUserName = trim(chkString(Request.Form("User"),"SQLString")) if strAuthType = "nt" then strDBNTUserName = Session(strCookieURL & "userID") strDBNTFUserName = Session(strCookieURL & "userID") end if Response.Write " s1" select case Request.Form("Method_Type") case "login" strEncodedPassword = sha256("" & Request.Form("Password")) select case chkUser(strDBNTFUserName, strEncodedPassword,-1) case 1, 2, 3, 4 Call DoCookies(Request.Form("SavePassword")) strLoginStatus = 1 case else strLoginStatus = 0 end select case "logout" Call ClearCookies() end select
if trim(strDBNTUserName) <> "" and trim(Request.Cookies(strUniqueID & "User")("Pword")) <> "" then chkCookie = 1 mLev = cLng(chkUser(strDBNTUserName, Request.Cookies(strUniqueID & "User")("Pword"),-1)) chkCookie = 0 else MemberID = -1 mLev = 0 end if
select case Request.Form("Method_Type") case "login" if strLoginStatus = 0 then Response.Write "<p align=""center"">Your username and/or password were incorrect.</p>" & vbNewLine & _ "<p align=""center"">Please either try again or register for an account.</p>" & vbNewLine else Response.Write "<p align=""center"">You logged on successfully!</p>" & vbNewLine & _ "<p align=""center"">Thank you for your participation.</p>" & vbNewLine end if Response.Write "<meta http-equiv=""Refresh"" content=""1; URL=" & Request.ServerVariables("HTTP_REFERER") & """>" & vbNewLine & _ "<p align=""center""><a href=""" & Request.ServerVariables("HTTP_REFERER") & """>Back To Previous Page</a></p>" & vbNewLine Response.End case "logout" Response.Write"<p align=""center"">You logged out successfully!</p>" & vbNewLine & _ "<p align=""center"">Thank you for your participation.</p>" & vbNewLine & _ "<meta http-equiv=""Refresh"" content=""1; URL=" & Request.ServerVariables("URL") & """>" & vbNewLine & _ "<p align=""center""><a href=""" & Request.ServerVariables("URL") & """>Back To Previous Page</a></p>" & vbNewLine Response.End end select
end if %>
This is probably going to be something rather simple, but as I am new to ASP, I am having a heck of a time finding the problem. |
|
|
padawan
Junior Member
200 Posts |
Posted - 16 November 2002 : 02:51:25
|
sir @TOMIC!
...long time, no posts! how the heck are ya... 'hope you're doing fine...
and yet again, i'm onto a different forum project and requires your expert advise.
I'm not quite sure if this one will/can utilize your Universal Login MOD but I think the task calls for something similar. Here it goes...
I'd like to move the Snitz Login section to the top right hand corner of a framed page. Pls. see below for details.
What sections of the inc_header.asp would I need to cut and paste to the rightbanner.asp(right side of the frame) to make this happen (assuming that all the includes are in placed, including your UL MOD)?
Here's the site location: http://168.144.128.134/naffaa/
Here are the links to txt files: inc_login.asp.txt inc_header.asp.txt inc_login.asp.txt index.html.txt
Your gracious help is greatly appreciated. I'll make sure we've got a place for you on our table for Thanksgiving as a token of appreciation
thanks, sir!
padawan
|
"...be mindful of the SnitzForce..." |
Edited by - padawan on 16 November 2002 02:56:37 |
|
|
japes
Starting Member
3 Posts |
Posted - 02 December 2002 : 14:18:33
|
Has anyone actually got it up and running? Having tried to install the latest release ( at least I hope it is ) I still retain the login form instead of the logout form, after a user has logged in.
I think it stems from variable mlev remaining at 0 . Has anyone found a fix?
Oh, andsetting cookie to Forum seems to work better than setting to website. Why? If set to website, then when I logout while inside a topic view, it still shows I am logged in. Setting it to FORUM alleaviates this. Any thoughts??? |
Edited by - japes on 02 December 2002 14:21:04 |
|
|
laser
Advanced Member
Australia
3859 Posts |
Posted - 02 December 2002 : 15:00:21
|
japes, it DOES work but it also took me a lot of time to get it working (the code changes were a breeze, but the Snitz settings needed and testing were the hard bit). I'll go with @tomic's advice that the cookie be set to website, but I also had to reload the application variables. You also need to include inc_header, or make a new one so you can remove the unnecessary stuff from your new page.
Hang in there, but it's a good MOD |
|
|
japes
Starting Member
3 Posts |
Posted - 02 December 2002 : 15:35:00
|
quote: Originally posted by laser
japes, it DOES work but it also took me a lot of time to get it working (the code changes were a breeze, but the Snitz settings needed and testing were the hard bit). I'll go with @tomic's advice that the cookie be set to website, but I also had to reload the application variables. You also need to include inc_header, or make a new one so you can remove the unnecessary stuff from your new page.
Hang in there, but it's a good MOD
Would you have any simple directions? I agree the code changes I think, we're a breeze.....but what am I missing ?? Some additional small code update deep in the furrows of replies in these forums?
Cookie is set to website. Inc_header is used before the call to inc_login.asp variables mlev and strDBNTFUserName do not echo back, which helps explain why the 'logout' view never shows......
|
|
|
laser
Advanced Member
Australia
3859 Posts |
|
japes
Starting Member
3 Posts |
Posted - 03 December 2002 : 11:32:38
|
Laser, Thank you. I have followed those tips and it worked.
Japes |
|
|
laser
Advanced Member
Australia
3859 Posts |
Posted - 03 December 2002 : 15:07:04
|
Not a problem mate |
|
|
PeeWee.Inc
Senior Member
United Kingdom
1893 Posts |
Posted - 06 December 2002 : 07:07:08
|
I'v downloaded this... What i want to do with it is set it up like it is over at snitzbitz.com but i dont know what code to take out of Inc_hearder.asp and inc_footer.asp I do not need to use it outside the forum tho. I will have it in inc_site_left.asp |
De Priofundus Calmo Ad Te Damine |
|
|
Topic |
|