Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - filter recordset via Author_ID
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

filter recordset via Author_ID

 Post Reply Post Reply
Author
zerohero View Drop Down
Newbie
Newbie


Joined: 24 July 2003
Location: United Kingdom
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote zerohero Quote  Post ReplyReply Direct Link To This Post Topic: filter recordset via Author_ID
    Posted: 26 January 2004 at 9:13pm

hi all...

i have intergrated the WWF database into my own...i am now atempting to filter recordsets via the Author_ID from the cookie produced from the login...

i am using UDev... and am familiar with how to filter recordsets via a cookie... but i dont know what the cookie is called to filter on...?

can some one help me out as i dont where to start...

cheers... 

Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 27 January 2004 at 3:30am
The author ID is not stored in the cookie as this would be a seurity risk.

The user is tracked using cookies which containb a unique security code generated for each user.

The cookie is called WWF and the User code is UID
Back to Top
zerohero View Drop Down
Newbie
Newbie


Joined: 24 July 2003
Location: United Kingdom
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote zerohero Quote  Post ReplyReply Direct Link To This Post Posted: 27 January 2004 at 4:58am

thanks 4 the reply...

i am using WWF v7.1 and i found the code requesting the cookie and it is called "Forum" ...is this correct?

i have tried to filter on the Forum... here is the code UD generates:

<%
Dim rsTestCookieFilter__MMColParam
rsTestCookieFilter__MMColParam = "1"
if (Request.Cookies("Forum")  <> "") then rsTestCookieFilter__MMColParam = Request.Cookies("Forum")
%>
<%
set rsTestCookieFilter = Server.CreateObject("ADODB.Recordset")
rsTestCookieFilter.ActiveConnection = MM_connNightOwls_STRING
rsTestCookieFilter.Source = "SELECT *  FROM tblAuthor  WHERE User_code = '" + Replace(rsTestCookieFilter__MMColParam, "'", "''") + "'"
rsTestCookieFilter.CursorType = 0
rsTestCookieFilter.CursorLocation = 2
rsTestCookieFilter.LockType = 3
rsTestCookieFilter.Open()
rsTestCookieFilter_numRows = 0
%>

but i getthe following error:

ADODB.Field error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

/leedsnightowls/forum/TMP1xawcs57nu.asp, line 26

any ideas what im doin wrong...?

cheers...

Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 27 January 2004 at 5:25am
Version 7.1 did have a different name for the cookie, you should really update to the latest version for security reasons.

That code produced by Dreamweaver looks like some of the worse code I have ever seen, DW is not very good with anything part from HTML coding, even thats not always good though.

If I where you I would scrape it and start again writting it by hand.

Have a look at the tutorial on databases in the ASP section of this site.

You can even look at the code in the file common.asp on teh forum and see how that reads in the cookie and matches it up to a database record.
Back to Top
zerohero View Drop Down
Newbie
Newbie


Joined: 24 July 2003
Location: United Kingdom
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote zerohero Quote  Post ReplyReply Direct Link To This Post Posted: 27 January 2004 at 8:11am

cheers...

i will upgrade when i hav resolved this issue...

i have done the tutorial understood it and got the following page to read the db:

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="common.asp" -->
<html>
<head>
<title>testCookieFilter</title>
</head>
<body bgcolor="white" text="black">
<%
'Dimension variables

Dim rsMembers  'Holds the recordset for the records in the database


'Create an ADO recordset object
Set rsMembers = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblAuthor.Username, tblAuthor.User_code FROM tblAuthor;"

'Open the recordset with the SQL query
rsMembers.Open strSQL, adoCon

'Loop through the recordset
Do While not rsMembers.EOF
 
 'Write the HTML to display the current record in the recordset
 Response.Write ("<br>")
 Response.Write (rsMembers("Username"))
 Response.Write ("<br>")
 Response.Write (rsMembers("User_code"))
 Response.Write ("<br>")

 'Move to the next record in the recordset
 rsMembers.MoveNext

Loop

'Reset server objects
rsMembers.Close
Set rsMembers = Nothing
Set adoCon = Nothing
%>
</body>
</html>

so from here... how would i get filter the rs with the user_code...?

any help gratefully accepted...ta...

Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 27 January 2004 at 12:42pm
I'm not sure what you mean by filter, you are not filtering anything and certainly not the recordset.

What you need to do is just write an sql statement that gets the members details from the authors table.

SELECT * FROM tblAuthor WHERE User_code = '" & strLoggedInUserCode & "';"

The query will get the corresponding record from the database, if no record is returned then the database then the person has altered the cookie on their machine and is tring to hack the board.


Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.