WTF from my school website



  • At school I'm the main coder for our website. It's written in ASP+frontpage-powered databases ported from some horrible frontpage-generated code. Not my favorite language, but it was already chosen for me when I got here, the server doesn't support anything else, and nobody feels like rewriting several hundred pages. There are plenty of WTFs with it, but a few days ago I found this nice piece of code to include a sport-specific menu on a sport's page:

    <%
    if bkimgnum > 0 then
        if bkimgnum = 16 then
        %>
            <!--#include virtual='/mhs/sports/include/bowl_team_info.asp'-->
        <%
        end if
        if bkimgnum = 6 or bkimgnum = 5 then
        %>
            <!--#include virtual='/mhs/sports/include/cross_team_info.asp'-->
        <%
        end if
        if bkimgnum = 11 or bkimgnum = 10 then
        %>
            <!--#include virtual='/mhs/sports/include/swim_team_info.asp'-->
        <%
        end if
        if bkimgnum = 9 or bkimgnum = 8 then
        %>
            <!--#include virtual='/mhs/sports/include/golf_team_info.asp'-->
        <%
        end if
        if bkimgnum = 13 then
        %>
            <!--#include virtual='/mhs/sports/include/slow_soft_team_info.asp'-->
        <%
        end if
        if bkimgnum = 7 or bkimgnum = 30 then
        %>
            <!--#include virtual='/mhs/sports/include/foot_team_info.asp'-->
        <%
        end if
        if bkimgnum = 12 or bkimgnum = 29 then
        %>
            <!--#include virtual='/mhs/sports/include/volley_team_info.asp'-->
        <%
        end if
        if bkimgnum = 4 or bkimgnum = 31 then
        %>
            <!--#include virtual='/mhs/sports/include/cheer_team_info.asp'-->
        <%
        end if
        if bkimgnum = 15 or bkimgnum = 33 or bkimgnum = 14 or bkimgnum = 32 then
        %>
            <!--#include virtual='/mhs/sports/include/basket_team_info.asp'-->
        <%
        end if
        if bkimgnum = 18 or bkimgnum = 37 or bkimgnum = 17 or bkimgnum = 36 then
        %>
            <!--#include virtual='/mhs/sports/include/soccer_team_info.asp'-->
        <%
        end if
        if bkimgnum = 19 then
        %>
            <!--#include virtual='/mhs/sports/include/wrestl_team_info.asp'-->
        <%
        end if
        if bkimgnum = 20 or bkimgnum = 34 then
        %>
            <!--#include virtual='/mhs/sports/include/base_team_info.asp'-->
        <%
        end if
        if bkimgnum = 21 then
        %>
            <!--#include virtual='/mhs/sports/include/soft_team_info.asp'-->
        <%
        end if
        if bkimgnum = 22 or bkimgnum = 23 then
        %>
            <!--#include virtual='/mhs/sports/include/tennis_team_info.asp'-->
        <%
        end if
        if bkimgnum = 24 or bkimgnum = 25 then
        %>
            <!--#include virtual='/mhs/sports/include/track_team_info.asp'-->
        <%
        end if
        if bkimgnum = 38 or bkimgnum = 39 then
        %>
            <!--#include virtual='/mhs/sports/include/lacrosse_team_info.asp'-->
        <%
        end if
    else
        bkimg = ""
    end if

    There is a column in the database called "ID" which is, for some reason, put in a variable called "bkimgnum". This is used to select a background image for the header (some sports have customized ones instead of the generic "Mandarin High School" banner), but then it's used for some other stuff too, including this. Why not just call the variable "id"? But the real WTF here is that there's also a column containing the sport's name, in all lower case, for use in pathnames like this. Sigh, I'll be fixing this now.



  • @scgtrp said:

     It's written in ASP+frontpage-powered databases

     

    ?????



  •  ??? indeed. After some searching, it appears that this is actually the correct way to do this in ASP.



  • Well I think we've found TRWTF.



    Also:

    Why not just call the variable "id"?
    Because it originally was only used to select a background image.


  •  using my deductive abilities, bkimgnum stands for BacKground IMaGe NUMber.



  • Nah, clearly the original image was one of several Burger King ad banners.



  • @CDarklock said:

    Nah, clearly the original image was one of several Burger King ad banners.

    Well, it is a school website.  So it's no surprise if the obese little beggars are sponsored by a fast-food chain.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.