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

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 Coding help - HTML data
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

jeffery
Junior Member

USA
176 Posts

Posted - 29 July 2003 :  17:13:59  Show Profile
I have this code which reads text from a text file and posts it to the forum as a new topic. This code is called pop3retrieve.asp

page_to_read= "pop3temp\textfile.txt"
    set fso = createobject("scripting.filesystemobject")
    set act = fso.opentextfile(server.mappath(page_to_read))
    read_text = act.readall
    act.close
    strMessage =   "<pre>" & server.htmlencode(read_text) & "</pre>"
    
    Response.Write strMessage
    
    Response.Write "Posting to forum ..."
    
   		strSql = "INSERT INTO " & strTablePrefix & "TOPICS (FORUM_ID"
		strSql = strSql & ", CAT_ID"
		strSql = strSql & ", T_SUBJECT"
		strSql = strSql & ", T_MESSAGE"

		strSql = strSql & ", T_AUTHOR"
		strSql = strSql & ", T_LAST_POST"
		strSql = strSql & ", T_LAST_POST_AUTHOR"
		strSql = strSql & ", T_LAST_POST_REPLY_ID"
		strSql = strSql & ", T_DATE"
		strSql = strSql & ", T_STATUS"

		strSql = strSql & ", T_STICKY"
		strSql = strSql & ", T_SIG"
		strSql = strSql & ", T_ARCHIVE_FLAG"
		strSql = strSql & ", T_REPLIES"
		strSql = strSql & ", T_UREPLIES"
		strSql = strSql & ", T_ISEVENT"
		strSql = strSql & ", T_ALLOWREG"
		strSql = strSql & ", T_MSGICON"
		strSql = strSql & ") VALUES ("
		strSql = strSql & 46
		strSql = strSql & ", " & 21
		strSql = strSql & ", '" & FixUpItems(Mailer.Subject) & "'"
                
                strSql = strSql & ", '" & strMessage & "'"
                
		strSql = strSql & ", " & 21
		strSql = strSql & ", '" & DateToStr(strForumTimeAdjust) & "'"
		strSql = strSql & ", " & 1
		strSql = strSql & ", 0 "
		strSql = strSql & ", '" & DateToStr(strForumTimeAdjust) & "'"
		strSql = strSql & ", 1 "
		strSql = strSql & ", 0 "
		strSql = strSql & ", 0 "
		strSql = strSql & ", 0 "
		strSQL = strSQL & ", 0 "
		strSQL = strSQL & ", 0 "
		strSql = strSql & ", " & 0
		strSql = strSql & ", " & 0
		strSql = strSql & ", " & 2
        strSql = strSql & ")"

		my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords


the textifle.txt contains text which looks like this:

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">


<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 10">
<meta name=Originator content="Microsoft Word 10">
<link rel=File-List href="cid:filelist.xml@01C355D6.2654CD80">
<link rel=Edit-Time-Data href="cid:editdata.mso@01C355D6.2654CD80">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
..shape {behavior:url(#default#VML);}
</style>
<![endif]--><!--[if gte mso 9]><xml>
 <o:OfficeDocumentSettings>
  <o:DoNotRelyOnCSS/>
 </o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:SpellingState>Clean</w:SpellingState>
  <w:GrammarState>Clean</w:GrammarState>
  <w:DocumentKind>DocumentEmail</w:DocumentKind>
  <w:EnvelopeVis/>
  <w:Compatibility>
   <w:BreakWrappedTables/>
   <w:SnapToGridInCell/>
   <w:WrapTextWithPunct/>
   <w:UseAsianBreakRules/>
  </w:Compatibility>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]-->
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;
	text-underline:single;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	mso-style-noshow:yes;
	mso-ansi-font-size:10.0pt;
	mso-bidi-font-size:10.0pt;
	font-family:Arial;
	mso-ascii-font-family:Arial;
	mso-hansi-font-family:Arial;
	mso-bidi-font-family:Arial;
	color:windowtext;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */ 
 table.MsoNormalTable
	{mso-style-name:"Table Normal";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-parent:"";
	mso-padding-alt:0in 5.4pt 0in 5.4pt;
	mso-para-margin:0in;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman";}
</style>
<![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple style='tab-interval:.5in'>

<div class=Section1>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Not sure what this will do but #8230;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><img width=311 height=400 id="_x0000_i1025"
src="cid:image001.jpg@01C355D6.2654CD80"><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>

<p class=MsoNormal><em><b><i><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial;font-weight:bold;mso-no-proof:yes'>Jeff </span></font></i></b></em><span
style='mso-no-proof:yes'><o:p></o:p></span></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial;mso-no-proof:yes'><a href="mailto:jeff@xxxx.xxxxxx.com"><font
size=3 face="Times New Roman"><span style='font-size:12.0pt;font-family:"Times New Roman"'>jeff@nrxxxx.xxxxxx.com</span></font></a></span></font><span
style='mso-no-proof:yes'><o:p></o:p></span></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial;mso-no-proof:yes'><a href="http://xxxx.xxxxx.com/forum/"><font
size=3 face="Times New Roman"><span style='font-size:12.0pt;font-family:"Times New Roman"'>http://xxxx.xxxxx.com/forum/</span></font></a></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

</div>

</body>

</html>


This is the error I get:

Microsoft OLE DB Provider for SQL Server error '80040e14'

Line 96: Incorrect syntax near 'tab'.

/pop3retrieve.asp, line 293


Line 293 being this line:

my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords


Anyone help me understand how I would do this?

www.thomasforum.com

Edited by - jeffery on 29 July 2003 17:24:12

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 29 July 2003 :  17:34:39  Show Profile
you probably need to do a replace on that field for single quotes.

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

jeffery
Junior Member

USA
176 Posts

Posted - 29 July 2003 :  18:28:12  Show Profile
Nikkol, would you clarify that for me. Im pretty rusty on db stuff. Thanks.

www.thomasforum.com
Go to Top of Page

OneWayMule
Dev. Team Member & Support Moderator

Austria
4969 Posts

Posted - 29 July 2003 :  18:38:34  Show Profile  Visit OneWayMule's Homepage  Send OneWayMule an ICQ Message
Changing the line
strSql = strSql & ", '" & strMessage & "'"

to
strSql = strSql & ", '" & chkString(strMessage, "SQLString") & "'"

should do the trick.

My MODs:
Birthdays - Custom Policy - F.A.Q. Administration - Forum Rules - Guestbook
Links Manager - MyOwnGoogle - Profile Views - Search Log - WebSearch

Useful stuff:
Forum and MOD Installation - MOD Installation Guide - Snitz v3.4.05 Readme - Free ASP Hosts - Support Snitz

Edited by - OneWayMule on 29 July 2003 18:38:47
Go to Top of Page

jeffery
Junior Member

USA
176 Posts

Posted - 29 July 2003 :  19:12:00  Show Profile
That takes away the error but I'm losing the html formatting in the post.

www.thomasforum.com
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 29 July 2003 :  20:08:18  Show Profile
I think you should replace all the ' in your textfile with " Is there an easy VBScript function to do that ?
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 29 July 2003 :  20:20:50  Show Profile
you are losing html formatting because you are doing a htmlencode on that file before you insert it.

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

jeffery
Junior Member

USA
176 Posts

Posted - 29 July 2003 :  23:23:04  Show Profile
Can I email a link to someone (private forum) so you can see what my posts are showing?

www.thomasforum.com
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 30 July 2003 :  14:06:32  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
you can shoot me an email and will see if i can see anything

Brad
Oklahoma City Online Entertainment Guide
Oklahoma Event Tickets
Go to Top of Page

jeffery
Junior Member

USA
176 Posts

Posted - 30 July 2003 :  17:11:32  Show Profile
redbrad0 message sent.

I tried changing it to this

strMessage = chkString(read_text, "HTMLString")

Am I out in left field?

Its almost there.

www.thomasforum.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 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.4 seconds. Powered By: Snitz Forums 2000 Version 3.4.07