More fun from the world of Bad Classic ASP



  • Here's an interesting snippet from a mass mail tool that reads in an Excel spreadsheet that needs to be uploaded to the web server prior to using it (That's not the WTF - it actually makes sense because the manager can target specific subsets of customers, instead of all of them):

    action = request.querystring("a")
    if request.QueryString("fn")<>"" then
         fn=request.QueryString("fn")
    end if



    select case action

        case 1

            FileUploaded("File Uploaded")
        case 2

            FileUploaded("File Uploaded")

        case else

            FileUploaded("File Uploaded")
    end select

    The function "File Uploaded" A) Doesn't use the variable that it's passed at all, and B) includes a whole HTML form within its declaration, like so:

    <% Function FileUploaded(str) %>


        <b><font size=2>Mass Mail Tool</font></b>
    <form enctype="multipart/form-data" action="wtf_massMail_tool.asp?a=1" name="form" onSubmit="return validate(document.form)">
    <table>
      <tr>
        <th>Step 1: Upload File</th>
    <!-- snip - other HTML -->
    <% End Function %>

    Is this supposed to be some kind of poor man's Model View Controller (not that I think the original developer knew what M-V-C was to begin with)?  The funniest part, though, is that the tool REQUIRES you to split the HTML up for the mail message into two text areas, so that it can inject the recipient's name into the body of the message.  Otherwise, it won't work properly (or just not show the person's name).


Log in to reply