Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: General / Classic ASP versions(v3.4.XX)
 Integration into existing site
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

speirsp
Starting Member

3 Posts

Posted - 06 December 2005 :  08:49:24  Show Profile
All,

I need to find out which cookies, session variables I need to set in order to log into snitz forums without using the snitz login form. I have authentication already and an existing user database and wish to use that. i understand I will probably have two user databases, but the existing will simply update the snitz one. Just need to know what to set.

Regards,

Paul

Roger Fredriksson
Average Member

Sweden
556 Posts

Posted - 06 December 2005 :  10:02:05  Show Profile  Visit Roger Fredriksson's Homepage
This is how I did it after Snitzers(Shaggy?) helped me (a lot) and it works!
<%
'The table USERS is in my old non-Snitz db in wich the members-info is taken from my old registration form and stored.
'I have made a session-variable holding the ID for the current visitor. First step is to get all input-values for
'the current user for transfer her/his info to Snitz db. My connection is now to old-db.

cUsId=Session("UsId")

oSql = "SELECT * FROM USERS WHERE IDnr =" & cUsId
Set objrs = cnObj.execute(oSql)
cUserID = objrs.Fields("IDnr")
cEpost=objrs.Fields("Email")
user = objrs.Fields("username")
pass = objrs.Fields("password")
' Fornamn=first name; Efternamn=last name
cFornamn=objrs.Fields("Fornamn")
cEfternamn=objrs.Fields("Efternamn")

ors.Close
set ors = Nothing

<%
'Connect to Snitz-db by using strConnString
strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../xxxxx/xxxxx.mdb") '## MS Access 2000 using virtual path
'Now i include the sha-function (first line below) and the ADO Type Library (second line below)
%>

<!--#INCLUDE FILE="inc_sha256.asp"-->
<!--#INCLUDE FILE="golib.asp"-->

<%
Dim objRS, intIDForNewRecord


If Len(Session("Snitz"))=0 then

Set objRS = Server.CreateObject ("ADODB.Recordset")
objRS.Open "Forum_Members", strConnString , adOpenStatic, adLockOptimistic, adCmdTable

objRS.MoveLast
'intIDForNewRecord = objRS("Member_ID") + 1

objRS.AddNew ' add a new record
objRS("M_EMAIL")=cEpost
objRS("M_NAME") = user
objRS("M_COUNTRY")="ADV"
objRS("M_FIRSTNAME")= cFornamn
objRS("M_LASTNAME")= cEfternamn
strEncodedPassword = sha256("" & trim(pass))
objRS("M_Password") = strEncodedPassword
objRS.Update

objRS.Close
Set objRS = Nothing

call doCookies(pass)
Session("Snitz")="OK"

end if
%>


<%
'login, hm? the lines below are only for use in my old application
Session("USERID")=user
Session("NAME")=cFornamn
Session("UsID")=cUserID
Session("Password")=pass
Session("Epost")=cEpost
cUsID=cUserID

' this is Snitz-code used by call doCookies above
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") = user
Response.Cookies(strUniqueID & "User")("Pword") = strEncodedPassword
Response.Cookies(strUniqueID & "User").Expires = dateAdd("d", intCookieDuration, strForumTimeAdjust)
end sub

rf/www.avgifter.com

Edited by - Roger Fredriksson on 25 February 2006 05:34:45
Go to Top of Page

speirsp
Starting Member

3 Posts

Posted - 08 December 2005 :  06:28:15  Show Profile
Hi Roger,

Thanks for the info. I did get it working at work, but at home where the live system is, I can't get the thing to run. I'm just looking at the login section. I set the cookie, the session variable but It doesn't seem to work. I'll look further when I'm not so tired. I note that the system can be configured to not use cookies. How would the login be achieved in this case? Do you know what the session variable are that need to be set.

Regards,

Paul
Go to Top of Page

Roger Fredriksson
Average Member

Sweden
556 Posts

Posted - 08 December 2005 :  08:38:15  Show Profile  Visit Roger Fredriksson's Homepage
Sorry,I cannot help you more than sharing the code above. Please step in, Snitzer!

rf/www.avgifter.com
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 08 December 2005 :  09:17:47  Show Profile  Send ruirib a Yahoo! Message
You don't want to use the forum in non cookie mode. It will show the forum administration interface to everyone. Not something desirable, IMO.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

speirsp
Starting Member

3 Posts

Posted - 11 December 2005 :  22:09:46  Show Profile
Probably not if that is the consequence. I think I have it worked out, thanks to all who helped.

Paul
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 12 December 2005 :  01:11:34  Show Profile  Visit AnonJr's Homepage
Just for reference (and any other poor soul searching for this in the future) how did you work it out?
Go to Top of Page

Nisse
Starting Member

Sweden
10 Posts

Posted - 17 February 2006 :  09:14:04  Show Profile  Visit Nisse's Homepage
If I implement this code on my site will it login my user on the forum as well?
Go to Top of Page

Nisse
Starting Member

Sweden
10 Posts

Posted - 17 February 2006 :  09:18:20  Show Profile  Visit Nisse's Homepage
forgot one thing. How do you solve the problem with new users registering. Is there someone who got code for putting a new user in the FORUM_members table?

Go to Top of Page

durell
Starting Member

USA
14 Posts

Posted - 24 February 2006 :  20:19:34  Show Profile
Roger: Looked at your code (I need to integrate current db) and it appears pretty straight forward....but I fall short when it comes to what your field names hold (or mean).

I really need to implement this .....so if you don't mind ....give me some definition of the fields and what they hold.

thanks
Go to Top of Page

Roger Fredriksson
Average Member

Sweden
556 Posts

Posted - 25 February 2006 :  05:46:32  Show Profile  Visit Roger Fredriksson's Homepage
durell, I have edited my post above trying to explain the code. I am a copyin and pasting guy with only very rudimentary ASP-knowledge but I will try to explain better if you still have q about my post.

Nisse, yes the code will login your visitor in Snitz-forum. The code also shows you how the info is transferred to Forum_members table.

speirsp, tell us if the code worked for you or share the code you used for getting it to work.

Snitzers, show no mercy - although the code works for me, tell us about shortcommings in the code.

rf/www.avgifter.com
Go to Top of Page

Nisse
Starting Member

Sweden
10 Posts

Posted - 17 March 2006 :  12:21:36  Show Profile  Visit Nisse's Homepage
The questions is what do we do to make the forum recognize that a specified user is logged on to the site. I've managed to create a user i the snitz database, thats no problemen. But what do I do to set the visitors login. So that he don't need to login twice.

What are the session-variables or do I set some cookies?.
Go to Top of Page

Roger Fredriksson
Average Member

Sweden
556 Posts

Posted - 17 March 2006 :  16:53:39  Show Profile  Visit Roger Fredriksson's Homepage
The answer is in the code above in my post. I have also emailed the set of files I am using to you.

rf/www.avgifter.com
Go to Top of Page

devo
Starting Member

1 Posts

Posted - 29 March 2006 :  16:43:27  Show Profile
Hello all,

What variables are included in golib.asp? I'm trying to have the user log into my site using existing security, and have them simultaneously logged into snitz. I used the above code (and added a check to see if they are already in the forum db), and all data transfers, but they are not logged via the cookies. I did not use golib.asp, as I don't have it and don't know which variables to set up in the sub above. :)

Any help would be appreciated,
Thanks.
Go to Top of Page

Roger Fredriksson
Average Member

Sweden
556 Posts

Posted - 30 March 2006 :  04:49:33  Show Profile  Visit Roger Fredriksson's Homepage
From the top of my head (I am not at my office until tomorrow) the file golib is not necessary for the code to work. It is a file only for my specific app. I think your issue has something to do with the cookies-code but I am not the one to figure it out so please step in Snitzer. (Shaggy helped me to get it to work )

rf/www.avgifter.com
Go to Top of Page

Roger Fredriksson
Average Member

Sweden
556 Posts

Posted - 31 March 2006 :  03:09:51  Show Profile  Visit Roger Fredriksson's Homepage
The file golib.asp is only for including the ADO type library and has nothing to do with the sub. In the beginning of my page using the code I have
<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_header.asp" -->
I think that inc_header or inc_header_short i nessecary for the sub to work. Snitzers, am I right?

rf/www.avgifter.com
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.5 seconds. Powered By: Snitz Forums 2000 Version 3.4.07