Author |
Topic |
OneWayMule
Dev. Team Member & Support Moderator
Austria
4969 Posts |
|
OpenIntro
Junior Member
USA
126 Posts |
|
GOKU
Starting Member
South Africa
4 Posts |
Posted - 26 October 2003 : 07:57:53
|
Errors in inc_news.asp are due to incorrect variable checking before being used in an SQL query. The following code without any additional MODS will correct this:
<% '################################################################################# '## News Forum MOD v1.0 for Snitz v3.3 by dan@danknows.com '## News Forum refreshed MOD v1.1 for Snitz v3.4 Update by alex042@picme.net '#################################################################################
' ******** BEGIN News display ******** if strNewsForum_ID <> "" then strSql = "SELECT " & strTablePrefix & "FORUM.F_SUBJECT" &_ " FROM " & strTablePrefix & "FORUM " &_ " WHERE " & strTablePrefix & "FORUM.FORUM_ID = " & strNewsForum_ID set rs = Server.CreateObject("ADODB.Recordset") Response.Write "SQL: " & strSql & "<BR>" rs.open strSql, my_conn, 3 forumTitle = rs("F_SUBJECT") rs.Close Set rs = Nothing else forumTitle = "" end if %>
<% Response.Write "<table width=""100%"" border=""0"" bordercolor=""" & strTableBorderColor & """ cellspacing=""1"" cellpadding=""0"" bgcolor=""" & strTableBorderColor & """>" & vbNewLine & _ "<tr>" & vbNewLine & _ "<td bgcolor=""" & StrHeadCellColor & """>" & vbNewLine & _ "<font size=""4"" color=""" & StrHeadFontColor & """> Site News</font>" & vbNewLine & _ "</td>" & vbNewLine & _ "</tr>" & vbNewLine & _ "<tr>" & vbNewLine & _ "<td align=""left"">" & vbNewLine & _ "<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"" bgcolor=""" & strTableBorderColor & """>" & vbNewLine & _ "<tr>" & vbNewLine & _ "<td>" & vbNewLine %>
<table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="<% =strTableBorderColor %>"> <tr valign="top"> <td align=center> <table border="0" cellpadding="2" cellspacing="0" width="100%" bgcolor="<% =strTableBorderColor %>"> <% if strNewsForum_ID <> "" then strSql ="SELECT TOP "& strNewsTopicCount & " " & strTablePrefix & "FORUM.F_SUBJECT, " & strTablePrefix & "TOPICS.FORUM_ID, " & strTablePrefix & "TOPICS.TOPIC_ID, " & strTablePrefix & "TOPICS.CAT_ID, " & strMemberTablePrefix & "MEMBERS.MEMBER_ID, " & strMemberTablePrefix & "MEMBERS.M_NAME, " & strTablePrefix & "TOPICS.T_SUBJECT, " & strTablePrefix & "TOPICS.T_MESSAGE, " & strTablePrefix & "TOPICS.T_DATE, " & strMemberTablePrefix & "MEMBERS.M_SIG" strSql = strSql & " FROM " & strTablePrefix & "FORUM INNER JOIN (" & strMemberTablePrefix & "MEMBERS INNER JOIN " & strTablePrefix & "TOPICS ON " & strMemberTablePrefix & "MEMBERS.MEMBER_ID = " & strTablePrefix & "TOPICS.T_AUTHOR) ON (" & strTablePrefix & "FORUM.FORUM_ID = " & strTablePrefix & "TOPICS.FORUM_ID) AND (" & strTablePrefix & "FORUM.CAT_ID = " & strTablePrefix & "TOPICS.CAT_ID)" strSql = strSql & " WHERE " & strTablePrefix & "FORUM.FORUM_ID=" & strNewsForum_ID & " and " & strTablePrefix & "TOPICS.T_STATUS < 2" strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.T_DATE DESC" set rs = Server.CreateObject("ADODB.Recordset") rs.open strSql, my_conn, 3 if not (rs.EOF or rs.BOF) then rs.movefirst
newsCount=0 do while (not rs.EOF) %> <tr> <td width="100%" bgcolor="<%=strAltForumCellColor %>"> <a href="topic.asp?TOPIC_ID=<%=rs.Fields("TOPIC_ID")%>"> <font face="<%=strDefaultFontFace%>" size="<%=strDefaultFontSize %>" color="<%=strHeadFontColor %>"> <b><%=rs.Fields("T_SUBJECT")%></b></font></a> </td> </tr> <tr> <td width="100%" bgcolor="<% =strForumCellColor %>"> <font face="<%=strDefaultFontFace%>" size="1" color="<%=strCategoryFontColor %>"> Posted by <a href=pop_profile.asp?mode=display&id=<%=rs.Fields("MEMBER_ID")%>><%=rs.Fields("M_Name")%></a> On <%=ChkDate(rs.Fields("T_Date")," At ",true)%></font></a> </td> </tr>
<tr> <td width=100% bgcolor="<% =strForumFirstCellColor %>"> <table border="0" width="100%"> <tr> <td bgcolor="<% =strForumFirstCellColor %>" width="5"> </td> <td bgcolor="<% =strForumFirstCellColor %>"> <font color="<% =strForumFontColor %>" face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"> <% =formatStr(RemoveSignature(rs.Fields("T_MESSAGE"), rs.Fields("M_SIG"))) %></font> </td> </tr> </table> </td> </tr> <% rs.MoveNext Loop end if else %> <tr> <td width="100%" bgcolor="<%=strAltForumCellColor %>"> No defined News...<br> </td. </tr> <% end if %> </table> </td> </tr> </table> <% Response.Write "</td>" & vbNewLine & _ "</tr>" & vbNewLine & _ "</table>" & vbNewLine & _ "</td>" & vbNewLine & _ "</tr>" & vbNewLine & _ "</table>" & vbNewLine %> <% if strNewsForum_ID <> "" then rs.Close Set rs = Nothing end if '****** End News Display *******
Function RemoveSignature(strExpression, strRemove) if strRemove <> " " then RemoveSignature = Replace(strExpression, strRemove, "") else RemoveSignature = strExpression end if End Function
%>
|
SSJ3 |
|
|
~dream~
Starting Member
10 Posts |
Posted - 21 January 2004 : 00:12:38
|
Hello ^_^ I've been trying to add mods to my forum and things are going well so far. I was searching for a news mod today and I'm having trouble getting this one working. I'm trying to work away from the forum directory. All of the includes are virtual and have the correct path. I copied the default.asp to my main web directory to test everything and it seems to work fine. the Homepage.asp just wont work, I get the 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.
/community/forums/inc_news.asp, line 7 ---------- To me what's odd is that if I have the homepage.asp in the /forums dir instead of the / dir... then it seems to work. I don't see why there's a problem when I can link to everything else with the copied default.asp. If someone can help me out i'd really appreciate it ^_^ Other question i have is what's the most populare news type mod? I downloaded News Forum Refreshed, Simple Slash, and Content Display... I've only played around with the news one, but any information / reccomendations would be nice... Thx ^_^ ~dream |
|
|
The Impact
Junior Member
Australia
398 Posts |
Posted - 21 January 2004 : 03:09:24
|
Are there any topics in the forum you selected ? |
|
|
~dream~
Starting Member
10 Posts |
Posted - 21 January 2004 : 13:38:54
|
Yes i made 7 topics to test it out. Like I said everything works when the Homepage.asp is in the forums directory. Below is what my homepage.asp looks like: ------ <!--#INCLUDE VIRTUAL="/community/forums/config.asp" --> <!--#INCLUDE VIRTUAL="/community/forums/inc_func_common.asp" --> <!--#INCLUDE VIRTUAL="/community/forums/inc_header.asp" --> <!--#INCLUDE VIRTUAL="/community/forums/inc_news.asp" --> <!--#INCLUDE VIRTUAL="/community/forums/inc_footer.asp" --> ------ Same file in two locations but one gets the error. Is there anything besides includes and javascripts that some how... hmmm ------ <% strSql = "SELECT " & strTablePrefix & "FORUM.F_SUBJECT" &_ " FROM " & strTablePrefix & "FORUM " &_ " WHERE " & strTablePrefix & "FORUM.FORUM_ID = " & strNewsForum_ID set rs = Server.CreateObject("ADODB.Recordset") rs.open strSql, my_conn forumTitle = rs("F_SUBJECT") rs.Close Set rs = Nothing %>
<table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="<% =strTableBorderColor %>"> <tr valign="top"> <td height=22 bgcolor="<%=strPageBGColor%>" align=center nowrap><acronym title="View <%=forumTitle%> Forum"><a href="/community/forums/forum.asp?FORUM_ID=<%=strNewsForum_ID%>"><b><font face="<%=strDefaultFontFace %>" size="<%=strDefaultFontSize %>" color="<%=strDefaultFontColor %>"><%=forumTitle%></a></b></font></acronym> </td> </tr> <tr> <td align=center> <table border="0" cellpadding="4" cellspacing="1" width="100%" bgcolor="<% =strTableBorderColor %>"> <% strSql ="SELECT TOP "& strNewsTopicCount & " " & strTablePrefix & "FORUM.F_SUBJECT, " & strTablePrefix & "TOPICS.FORUM_ID, " & strTablePrefix & "TOPICS.TOPIC_ID, " & strTablePrefix & "TOPICS.CAT_ID, " & strMemberTablePrefix & "MEMBERS.MEMBER_ID, " & strMemberTablePrefix & "MEMBERS.M_NAME, " & strTablePrefix & "TOPICS.T_SUBJECT, " & strTablePrefix & "TOPICS.T_MESSAGE, " & strTablePrefix & "TOPICS.T_DATE, " & strMemberTablePrefix & "MEMBERS.M_SIG" strSql = strSql & " FROM " & strTablePrefix & "FORUM INNER JOIN (" & strMemberTablePrefix & "MEMBERS INNER JOIN " & strTablePrefix & "TOPICS ON " & strMemberTablePrefix & "MEMBERS.MEMBER_ID = " & strTablePrefix & "TOPICS.T_AUTHOR) ON (" & strTablePrefix & "FORUM.FORUM_ID = " & strTablePrefix & "TOPICS.FORUM_ID) AND (" & strTablePrefix & "FORUM.CAT_ID = " & strTablePrefix & "TOPICS.CAT_ID)" strSql = strSql & " WHERE " & strTablePrefix & "FORUM.FORUM_ID=" & strNewsForum_ID & " and " & strTablePrefix & "TOPICS.T_STATUS < 2" strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.T_DATE DESC" set rs = Server.CreateObject("ADODB.Recordset") rs.open strSql, my_conn if not (rs.EOF or rs.BOF) then rs.movefirst
newsCount=0 do while (not rs.EOF) %> <tr> <td width="100%" bgcolor="<% =strHeadCellColor %>"> <a href="/community/forums/topic.asp?TOPIC_ID=<%=rs.Fields("TOPIC_ID")%>"> <font face="<%=strDefaultFontFace%>" size="<%=strDefaultFontSize %>" color="<%=strHeadFontColor %>"> <b><%=rs.Fields("T_SUBJECT")%></b></font></a> </td> </tr> <tr> <td width="100%" bgcolor="<% =strCategoryCellColor %>"> <font face="<%=strDefaultFontFace%>" size="1" color="<%=strCategoryFontColor %>"> Posted by <a href=/community/forums/pop_profile.asp?mode=display&id=<%=rs.Fields("MEMBER_ID")%>><%=rs.Fields("M_Name")%></a> On <%=ChkDate(rs.Fields("T_Date")," At ",true)%></font></a> </td> </tr>
<tr> <td width=100% bgcolor="<% =strForumFirstCellColor %>"> <table border="0" width="100%"> <tr> <td bgcolor="<% =strForumFirstCellColor %>" width="5"> </td> <td bgcolor="<% =strForumFirstCellColor %>"> <font color="<% =strForumFontColor %>" face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"> <% =formatStr(RemoveSignature(rs.Fields("T_MESSAGE"), rs.Fields("M_SIG"))) %></font> </td> </tr> </table> </td> </tr> <% rs.MoveNext Loop end if %> </table> </td> </tr> </table> <br><br> <% '****** End News Display *******
rs.Close Set rs = Nothing
Function RemoveSignature(strExpression, strRemove) if strRemove <> " " then RemoveSignature = Replace(strExpression, strRemove, "") else RemoveSignature = strExpression end if End Function
%> |
|
|
~dream~
Starting Member
10 Posts |
Posted - 21 January 2004 : 13:43:36
|
Forgot to mention i'm running Access 2000 Database w/ IIS on my local machine (for now anyway)... ^_^ Otherwise i'd be posting links n such... ~dream |
|
|
The Impact
Junior Member
Australia
398 Posts |
Posted - 21 January 2004 : 17:37:52
|
Looking at that code I believe that this recordset is causing trouble.<%
strSql = "SELECT " & strTablePrefix & "FORUM.F_SUBJECT" &_
" FROM " & strTablePrefix & "FORUM " &_
" WHERE " & strTablePrefix & "FORUM.FORUM_ID = " & strNewsForum_ID
set rs = Server.CreateObject("ADODB.Recordset")
rs.open strSql, my_conn
forumTitle = rs("F_SUBJECT")
rs.Close
Set rs = Nothing
%> So that SQL isn't bring any data back... You might like to check the SQL by goingResponse.Write strSql Then you'll know if there is something wrong the that. |
|
|
~dream~
Starting Member
10 Posts |
Posted - 21 January 2004 : 20:48:35
|
Where do I put in the Response.Write? If I enter it after that recordset then the error is still occuring. If i put it before the record set I get: - SELECT COUNT(*) AS SubCount FROM FORUM_SUBSCRIPTIONS ADODB.Field error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/community/forums/inc_news.asp, line 8 - or if i do Response.Write strSql = ... then i get: - False ADODB.Recordset error '800a0cc1'
Item cannot be found in the collection corresponding to the requested name or ordinal.
/community/forums/inc_news.asp, line 7 - Still don't see how the SQL strings work fine if the homepage.asp is in the forum directory but not the default directory.... Guess i'm lost =P ~dream |
|
|
~dream~
Starting Member
10 Posts |
Posted - 22 January 2004 : 00:01:07
|
Ok... after taking a break from the forums. I decided to try to view the homepage.asp again (no changes made) and it worked. Dunno why, something may have been in the cache who knows. But i'll post if I fine anything else out ^_^ Go SNITZ... ~dream |
|
|
~dream~
Starting Member
10 Posts |
Posted - 31 January 2004 : 18:06:35
|
Problem: Only displaying 1 news topic... - Setup: using http://127.0.0.1/ as my site for now. I have the news setup as default.asp under /default.asp.... the forums and everything is setup under /community/forums/ and all the includes have been changed to virtual and everything seems to work great. If I copy that exact default.asp and put it in /community/forums/ as a test.asp then it displays all the news articles. I know snitz was designed with files being in one directory, but I thought I made all the changes needed. My guess would be that the sql loop or something is wrong to work in a base directory. I'm using Access 2000 and below is my current CODE: - default.asp - <!--#INCLUDE VIRTUAL="/community/forums/config.asp"--> <!--#INCLUDE VIRTUAL="/community/forums/inc_func_common.asp"--> <!--#INCLUDE VIRTUAL="/community/forums/inc_func_secure.asp"--> <!--#INCLUDE VIRTUAL="/community/forums/inc_sha256.asp"--> <!--#INCLUDE VIRTUAL="/community/forums/inc_header.asp"--> <!--#INCLUDE VIRTUAL="/community/forums/inc_func_member.asp"--> <!--#INCLUDE VIRTUAL="/community/forums/inc_moderation.asp"--> <!--#INCLUDE VIRTUAL="/community/forums/inc_subscription.asp"--><%
Response.Write " <table border=""0"" cellpadding=""0"" cellspacing=""0"" width=""100%"">" & vbNewLine & _ " <tr>" & vbNewLine & _ " <td>" & vbNewLine
strSql = "SELECT " & strTablePrefix & "FORUM.F_SUBJECT" &_ " FROM " & strTablePrefix & "FORUM " &_ " WHERE " & strTablePrefix & "FORUM.FORUM_ID = " & strNewsForum_ID set rs = Server.CreateObject("ADODB.Recordset") rs.open strSql, my_conn forumTitle = rs("F_SUBJECT") rs.Close Set rs = Nothing
Response.Write " <table border=""0"" cellpadding=""0"" cellspacing=""0"" width=""100%"" bgcolor=""" & strTableBorderColor & """>" & vbNewLine & _ " <tr valign=""top"">" & vbNewLine & _ " <td height=""22"" bgcolor=""" & strPageBGColor & """ align=""center"" nowrap><acronym title=""View " & forumTitle & " Forum""><a href=""/community/forums/forum.asp?FORUM_ID=" & strNewsForum_ID & """><b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strDefaultFontColor & """>" & forumTitle & "</a></b></font></acronym></td>" & vbNewLine & _ " </tr>" & vbNewLine & _ " <tr>" & vbNewLine & _ " <td align=""center"">" & vbNewLine & _ " <table border=""0"" cellpadding=""4"" cellspacing=""1"" width=""100%"" bgcolor=""" & strTableBorderColor & """>" & vbNewLine
strSql ="SELECT TOP "& strNewsTopicCount & " " & strTablePrefix & "FORUM.F_SUBJECT, " & strTablePrefix & "TOPICS.FORUM_ID, " & strTablePrefix & "TOPICS.TOPIC_ID, " & strTablePrefix & "TOPICS.CAT_ID, " & strMemberTablePrefix & "MEMBERS.MEMBER_ID, " & strMemberTablePrefix & "MEMBERS.M_NAME, " & strTablePrefix & "TOPICS.T_SUBJECT, " & strTablePrefix & "TOPICS.T_MESSAGE, " & strTablePrefix & "TOPICS.T_DATE, " & strMemberTablePrefix & "MEMBERS.M_SIG" strSql = strSql & " FROM " & strTablePrefix & "FORUM INNER JOIN (" & strMemberTablePrefix & "MEMBERS INNER JOIN " & strTablePrefix & "TOPICS ON " & strMemberTablePrefix & "MEMBERS.MEMBER_ID = " & strTablePrefix & "TOPICS.T_AUTHOR) ON (" & strTablePrefix & "FORUM.FORUM_ID = " & strTablePrefix & "TOPICS.FORUM_ID) AND (" & strTablePrefix & "FORUM.CAT_ID = " & strTablePrefix & "TOPICS.CAT_ID)" strSql = strSql & " WHERE " & strTablePrefix & "FORUM.FORUM_ID=" & strNewsForum_ID & " and " & strTablePrefix & "TOPICS.T_STATUS < 2" strSql = strSql & " ORDER BY " & strTablePrefix & "TOPICS.T_DATE DESC" set rs = Server.CreateObject("ADODB.Recordset") rs.open strSql, my_conn if not (rs.EOF or rs.BOF) then rs.movefirst newsCount=0 do while (not rs.EOF)
Response.Write " <tr>" & vbNewLine & _ " <td width=""100%"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _ " <a href=""/community/forums/topic.asp?TOPIC_ID=" & rs.Fields("TOPIC_ID") & """>" & vbNewLine & _ " <font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHeadFontColor & """>" & vbNewLine & _ " <b>" & rs.Fields("T_SUBJECT") & "</b></font></a>" & vbNewLine & _ " </td>" & vbNewLine & _ " </tr>" & vbNewLine & _ " <tr>" & vbNewLine & _ " <td width=""100%"" bgcolor=""" & strCategoryCellColor & """>" & vbNewLine & _ " <font face=""" & strDefaultFontFace & """ size=""1"" color=""" & strCategoryFontColor & """>" & vbNewLine & _ " Posted by <a href=""/community/forums/pop_profile.asp?mode=display&id=" & rs.Fields("MEMBER_ID") & """>" & rs.Fields("M_Name") & "</a> On " & ChkDate(rs.Fields("T_Date")," At ",true) & "</font></a>" & vbNewLine & _ " </td>" & vbNewLine & _ " </tr>" & vbNewLine & _ " <tr>" & vbNewLine & _ " <td width=""100%"" bgcolor=""" & strForumFirstCellColor & """>" & vbNewLine & _ " <table border=""0"" width=""100%"">" & vbNewLine & _ " <tr>" & vbNewLine & _ " <td bgcolor=""" & strForumFirstCellColor & """ width=""5""></td>" & vbNewLine & _ " <td bgcolor=""" & strForumFirstCellColor & """>" & vbNewLine & _ " <font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _ " " & formatStr(RemoveSignature(rs.Fields("T_MESSAGE"), rs.Fields("M_SIG"))) & "</font>" & vbNewLine & _ " </td>" & vbNewLine & _ " </tr>" & vbNewLine & _ " </table>" & vbNewLine & _ " </td>" & vbNewLine & _ " </tr>" & vbNewLine
rs.MoveNext Loop end if
Response.Write " </table>" & vbNewLine & _ " </td>" & vbNewLine & _ " </tr>" & vbNewLine & _ " </table>" & vbNewLine
rs.Close Set rs = Nothing
Function RemoveSignature(strExpression, strRemove) if strRemove <> " " then RemoveSignature = Replace(strExpression, strRemove, "") else RemoveSignature = strExpression end if End Function
Response.Write " </td>" & vbNewLine & _ " </tr>" & vbNewLine & _ " </table>" & vbNewLine%> <!--#INCLUDE VIRTUAL="/community/forums/inc_footer.asp"--> - I hope someone can help me out here. I'm trying to learn more and more asp as I go and I can't figure out why it's not looping when the file isn't in the forum directory. Again I'll mention that I am not getting any physical error messages. ~ thx, Dream |
|
|
The Impact
Junior Member
Australia
398 Posts |
Posted - 31 January 2004 : 19:26:53
|
Great to hear its working, sorry I couldn't have been of more help earlier - I have been away for a few days.
I think that you can set how many topic to display in the News Forum Admin... You might like to give it a try. |
|
|
rouxjean
Starting Member
10 Posts |
Posted - 23 February 2004 : 18:20:39
|
Where do i find this mod now ???? |
|
|
K.Storm
Starting Member
Andorra
23 Posts |
Posted - 01 March 2004 : 08:41:08
|
i still have the error:
ADODB.Recordset.1 error '80004005' SQLState: 42000 Native Error Code: 1064 [TCX][MyODBC]You have an error in your SQL syntax near 'FROM FORUM_FORUM INNER JOIN (FORUM_MEMBERS INNER JOIN FORUM_TOPICS ON FORUM_MEMB' at line 1
inc_news.asp, line 33
Why ??? i have tryed all that is in this topic !!!!
/K.storm
|
|
|
Thomas
Starting Member
Belgium
20 Posts |
Posted - 02 March 2004 : 09:07:28
|
I've successfully added this MOD to my forum, but I'm having some difficulties when logging in using the homepage.asp file included in the MOD. You can try it out @ the following location: http://scouting.webhop.net/
Error when loging in from homepage.asp:
quote:
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'sha256'
/inc_header.asp, line 189
Weird thing is, the login works when using another page then homepage.asp! Any ideas? |
Edited by - Thomas on 02 March 2004 10:00:04 |
|
|
Topic |
|