%
Set databaseConnection = getDatabaseConnection()
// force them to login if they are not already
If Not isLoggedIn() Or isStillAnonymous() Then
Response.Redirect("signup.asp")
End If
// if neither of the above, you are logged in and can enter your story with no problem
formFields = Array("hon_sto_title", "hon_sto_text")
errorMessage = ""
userID = CStr(Request.Cookies("hon")("hon_use_id"))
// set up a dictionary for form info
Set formInfo = CreateObject("Scripting.Dictionary")
// set defaults if just entering the form
For Each fieldName In formFields
fieldValue = ""
formInfo.Add fieldName, fieldValue
Next
// if the user has submitted the form
If Request("command") = "Submit!" Then
// get form info
For Each fieldName In formFields
fieldValue = CStr(Request.Form(fieldName))
formInfo.Item(fieldName) = fieldValue
Next
// validate required fields
errorMessage = ternaryOperator((formInfo.Item("hon_sto_title") = ""), errorMessage & "Please provide a title for this submission.
", errorMessage)
errorMessage = ternaryOperator((formInfo.Item("hon_sto_text") = ""), errorMessage & "Please provide the text of your submission.
", errorMessage)
errorMessage = ternaryOperator((Len(formInfo.Item("hon_sto_text")) > 3000), errorMessage & "Your submission must be less than 3000 characters long. It is currently " & Len(formInfo.Item("hon_sto_text")) & " characters long.
", errorMessage)
If errorMessage = "" Then
// now insert story
Call executeSQL("INSERT INTO hon_sto_stories (hon_sto_authorID, hon_sto_title, hon_sto_text) VALUES (" & userID & ", '" & safeDBEncode(formInfo.Item("hon_sto_title")) & "', '" & safeDBEncode(formInfo.Item("hon_sto_text")) & "')", databaseConnection)
// now set the success session and send to success page
Session("success") = "submit"
Response.Redirect("success.asp")
End If
End If
destroyConnection(databaseConnection)
%>
HACK or NOT Writing Evaluation |
|
Submit a sample of your writing, and let HACK or NOT's users tell you how much they like it! <% If errorMessage <> "" Then %> <%= errorMessage %> <% End If %>Do's and Don'ts Do:
|
<%= getRightBarAd() %> |
|