Forum
Jeg er igang med at lave et forum og jeg er noget til at jeg skal lave en side til at tilføje et \"tread\" og det her nogenlunde sådan ud:If Request.ServerVariables(\"REQUEST_METHOD\") = \"POST\" Then
Response.Cookies(\"Forum\")(\"T_Alias\") = Request.Form(\"T_Alias\")
Response.Cookies(\"Forum\")(\"T_Email\") = Request.Form(\"T_Email\")
Response.Cookies(\"Forum\").Expires = Date+365
End If
strNickname = Request.Cookies(\"Forum\")(\"T_Alias\")
strEmail = Request.Cookies(\"Forum\")(\"T_Email\")
If Request.Form(\"Add\") <> \"\" Then
strError = \"\"
strT_Alias = Trim(Request.Form(\"T_Alias\"))
strT_Email = Trim(Request.Form(\"T_Email\"))
strT_Topic = Trim(Request.Form(\"T_Topic\"))
strT_Post = Trim(Request.Form(\"T_Post\"))
arr = split(strT_Post,\" \")
for i = lbound(arr) to ubound(arr)
If Len(arr(i)) > 25 Then
strError = \"A word can not be longer than 25 chapters!\"
End If
next
If Len(strT_Alias) = 0 Then
strError = \"You have to type your name or alias!\"
ElseIf Len(strT_Alias) > 20 Then
strError = \"Your name or handle is too long!\"
ElseIf checkEmail(strT_Email) = False Then
strError = \"You have to type a valid e-mail adress!\"
ElseIf Len(strT_Topic) = 0 Then
strError = \"Your subject is too long!\"
ElseIf Len(strT_Post) = 0 Then
strError = \"You have to type a post!\"
end If
If Len(strError) = 0 Then
Set newtreadtemp = Server.CreateObject(\"ADoDB.Connection\")
DSN = \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\" & server.mappath(\"db/clan_ld_db.mdb\")
newtreadtemp.open DSN
SQLNEWT = \"SELECT * FROM [F_Treads]\"
Set rstemp = newtreadtemp.execute(SQLNEWT)
SQLNEWT = \"SELECT * FROM [F_Treads] WHERE FID = \"& Request(\"FID\")
Set rstemp = newtreadtemp.execute(SQLNEWT)
Response.Redirect(\"forum.asp\")
If (rstemp.BOF or rstemp.EOF) Then
rstemp.AddNew
rstemp(\"FID\") = Request.Form(\"FID\")
rstemp(\"T_Date\") = Now
rstemp(\"T_Alias\") = RemoveHTML(strT_Alias)
rstemp(\"T_Email\") = RemoveHTML(strT_Email)
rstemp(\"T_Topic\") = RemoveHTML(strT_Topic)
rstemp(\"T_Post\") = RemoveHTML(strT_Post)
rstemp.Update
End If
Response.Redirect(\"forum.asp\")
Else
strError = \"<font face=\"\"verdana\"\" size=\"\"1\"\" color=\"\"#333333\"\"><b>\"& strError &\"</b></font>\"
End If
End If
Response.Write \"<td align=\"\"center\"\" valign=\"\"top\"\" height=\"\"135\"\" width=\"\"425\"\" background=\"\"design/Middle.jpg\"\">\"
Response.Write \"<font color=\"\"#333333\"\" face=\"\"verdana\"\" size=\"\"2\"\"><br><br><br><br><br><br><br><br><br><br><br><b>Add tag</b></font></td>\"
Response.Write \"<td align=\"\"left\"\" valign=\"\"top\"\" height=\"\"135\"\" colspan=\"\"3\"\">\"
Response.Write \"<img src=\"\"design/Right.jpg\"\" width=\"\"103\"\" height=\"\"199\"\"></td></tr>\"
Response.Write \"<tr>\"
Response.Write \"<td align=\"\"left\"\" valign=\"\"top\"\" width=\"\"31\"\"> </td>\"
Response.Write \"<td align=\"\"left\"\" valign=\"\"top\"\" width=\"\"16\"\"><img src=\"\"gIf/pixel.gIf\"\" width=\"\"1\"\" height=\"\"1\"\"></td>\"
Response.Write \"<td align=\"\"left\"\" valign=\"\"top\"\" background=\"\"gIf/dims2B.gIf\"\" width=\"\"12\"\"> </td>\"
Response.Write \"<td align=\"\"left\"\" valign=\"\"top\"\" width=\"\"425\"\" bgcolor=\"\"C5C5C5\"\">\"
Response.Write \"<table align=\"\"center\"\" border=\"\"0\"\" cellpadding=\"\"0\"\" cellspacing=\"\"0\"\" width=\"\"425\"\"><tr>\"
Response.Write \"<td align=\"\"center\"\" width=\"\"100%\"\">\"& strError &\"</td></tr></table>\"
Response.Write \"<br><table border=\"\"0\"\" cellpadding=\"\"3\"\" cellspacing=\"\"0\"\" width=\"\"425\"\"><tr><td>\"
Response.Write \"<table border=\"\"0\"\" cellpadding=\"\"0\"\" cellspacing=\"\"0\"\" width=\"\"400\"\"><tr>\"
Response.Write \"<form action=\"\"forum.asp?mode=newtread\"\" method=\"\"POST\"\">\"
Response.Write \"<input type=\"\"hidden\"\" name=\"\"FID\"\" value=\"\"\"& Request(\"FID\") &\"\"\">\"
Response.Write \"<td align=\"\"right\"\" width=\"\"25%\"\"><font color=\"\"#333333\"\" face=\"\"verdana\"\" size=\"\"1\"\">Alias: </font></td>\"
Response.Write \"<td align=\"\"left\"\" width=\"\"75%\"\"><input size=\"\"30\"\" type=\"\"text\"\" name=\"\"T_Alias\"\" value=\"& strT_Alias &\"></td></tr>\"
Response.Write \"<tr><td align=\"\"right\"\" width=\"\"25%\"\"><font color=\"\"#333333\"\" face=\"\"verdana\"\" size=\"\"1\"\">E-mail: </font></td>\"
Response.Write \"<td align=\"\"left\"\" width=\"\"75%\"\"><input size=\"\"30\"\" type=\"\"text\"\" name=\"\"T_Email\"\" value=\"& strT_Email &\"></td></tr>\"
Response.Write \"<tr><td align=\"\"right\"\" width=\"\"25%\"\"><font color=\"\"#333333\"\" face=\"\"verdana\"\" size=\"\"1\"\">Topic: </font></td>\"
Response.Write \"<td align=\"\"left\"\" width=\"\"75%\"\"><input size=\"\"30\"\" type=\"\"text\"\" name=\"\"T_Topic\"\" value=\"& strT_Topic &\"></td></tr>\"
Response.Write \"<tr><td align=\"\"right\"\" valign=\"\"top\"\" width=\"\"25%\"\"><font color=\"\"#333333\"\" face=\"\"verdana\"\" size=\"\"1\"\">Post: </font></td>\"
Response.Write \"<td align=\"\"left\"\" width=\"\"75%\"\"><textarea cols=\"\"40\"\" rows=\"\"10\"\" name=\"\"T_Post\"\" value=\"& strT_Post &\"></textarea></td></tr>\"
Response.Write \"<tr><td width=\"\"25%\"\"> </td>\"
Response.Write \"<td width=\"\"75%\"\"><input type=\"\"submit\"\" value=\"\" New Tread \"\" name=\"\"Add\"\"></td></tr></table>\"
Response.Write \"</td></tr></table></form>\"
Der kommer ikke nogen fejl, men til gengæld redirecter den bare til siden UDEN at oprette noget tread.
I tabelen F_Treads har jeg følgende:
TID
FID
T_Alias
T_Email
T_Topic
T_Post
T_Date
Nogen der kan hjælpe...jeg skal nok forklare det nærmerer hvis det er svært at forstå.
