<% 'setup db object strConnString = "driver={SQL Server};server=sql7.globalgold.co.uk;uid=betterthinking;pwd=master-point;database=betterthinking" set my_Conn = Server.CreateObject("ADODB.Connection") my_Conn.Open strConnString 'call variables name = Replace(request("varchar_name"), "'", "''") email = Replace(request("varchar_email"), "'", "''") town = Replace(request("varchar_town"), "'", "''") varchar_subject = Replace(request("varchar_subject"), "'", "''") varchar_post = Replace(request("varchar_post"), "'", "''") idForum_topic = request("idforum_topic") contact = request("contact") 'process variables If request("contact") = "on" Then contact = 1 else contact = 0 End if 'process user update or add Select Case request("update_details") Case 1 'update idUser = request.cookies("betterthinking") sql = "update users set name='" & name & "', email='" & email & "', location='" & town & "', contact='" & contact & "' where idUser=" & idUser set rs = my_Conn.Execute(sql) 'response.write(sql) Case 2 'add new sql = "execute insert_users " & "'" & name & "'," & "'" & email & "'," & "'" & town & "'," & "'" & contact & "'" set rs = my_Conn.Execute(sql) idUser = rs("iduser") response.cookies("betterthinking") = idUser Response.Cookies("betterthinking").Expires=#May 10,2006# 'response.write(sql) Case Else idUser = request.cookies("betterthinking") end Select 'Insert new post strsql ="insert into forum_posts (varchar_subject, varchar_post, binary_display, id_forum_topics, idUser) values('" & varchar_subject & "', '" & varchar_post & "', 0, " & idforum_topic & ", " & idUser & ")" set rs = my_Conn.Execute (strSql) session("idUser") = idUser strSql = "SELECT * from forum_topics where idforum_topic=" & request("idforum_topic") 'response.write("sorry cate, just testing!!! :" & strsql) set rs = my_Conn.Execute (strSql) id_forum_topic = rs("idforum_topic") title_graphic_root = rs("title_graphic_root") title_graphic_main = rs("title_graphic_main") add_comment = rs("add_comment") topic_summary = rs("topic_summary") topic_brief = rs("topic_brief") binary_display = rs("binary_display") Response.Buffer = True 'Dimension variables Dim strBody 'Holds the body of the e-mail Dim objCDOMail 'Holds the mail server object Dim strMyEmailAddress 'Holds your e-mail address Dim strCCEmailAddress 'Holds any carbon copy e-mail addresses if you want to send carbon copies of the e-mail Dim strBCCEmailAddress 'Holds any blind copy e-mail addresses if you wish to send blind copies of the e-mail Dim strReturnEmailAddress 'Holds the return e-mail address of the user '----------------- Place your e-mail address in the following sting ---------------------------------- strMyEmailAddress = "cate@betterthinking.co.uk" '----------- Place Carbon Copy e-mail address's in the following sting, separated by ; -------------- strCCEmailAddress = "" 'Use this string only if you want to send the carbon copies of the e-mail '----------- Place Blind Copy e-mail address's in the following sting, separated by ; -------------- strBCCEmailAddress = "" 'Use this string only if you want to send the blind copies of the e-mail '----------------------------------------------------------------------------------------------------- 'Read in the users e-mail address strReturnEmailAddress = email strBody = "Hi Kate, " & name & " added a post to the forum" strBody = strBody & "

Subject: -" & varchar_subject strBody = strBody & "

Post: -" & varchar_post strBody = strBody & "

Forum Topic graphic: -" If Len(strReturnEmailAddress) < 5 OR NOT Instr(1, strReturnEmailAddress, " ") = 0 OR InStr(1, strReturnEmailAddress, "@", 1) < 2 OR InStrRev(strReturnEmailAddress, ".") < InStr(1, strReturnEmailAddress, "@", 1) Then 'Set the return e-mail address to your own strReturnEmailAddress = strMyEmailAddress End If 'response.write(strBody) 'response.write(strMyEmailAddress) 'Send the e-mail 'Create the e-mail server object Set objCDOMail = Server.CreateObject("CDONTS.NewMail") 'Who the e-mail is from (this needs to have an e-mail address in it for the e-mail to be sent) objCDOMail.From = name & " <" & strReturnEmailAddress & ">" 'Who the e-mail is sent to objCDOMail.To = strMyEmailAddress 'Who the carbon copies are sent to objCDOMail.Cc = strCCEmailAddress 'Who the blind copies are sent to objCDOMail.Bcc = strBCCEmailAddress 'Set the subject of the e-mail objCDOMail.Subject = "Forum Posting Recieved" 'Set the e-mail body format (0=HTML 1=Text) objCDOMail.BodyFormat = 0 'Set the mail format (0=MIME 1=Text) objCDOMail.MailFormat = 0 'Set the main body of the e-mail objCDOMail.Body = strBody 'Importance of the e-mail (0=Low, 1=Normal, 2=High) objCDOMail.Importance = 1 'Send the e-mail objCDOMail.Send 'Close the server object Set objCDOMail = Nothing %> the perfect t-shirt