The Daily WTF
LK was browsing a local job site for a new position. The site was flaky, which lead LK to look into the code, and it looks like if anything, this job site should be hiring a new web developer.
function startSWBanner() { browserType = “new”; timenow = new Date(); secs = timenow.getTime () / 1000; modnum = 2 * 10; range = secs % modnum; n = Math.floor(range / 10); urlArray = new Array(2); banArray = new Array(2); altArray = new Array(2); popupArray = new Array(2); urlArray[0] = ‘/cgi-bin/banner_track.cgi?banner_id=2627’; banArray[0] = ‘/rot_ban/v2lbanner.gif’; urlArray[1] = ‘/cgi-bin/banner_track.cgi?banner_id=4245’; banArray[1] = ‘/rot_ban/ir35_banner.gif’; if (browserType == “new”) { document.swbanner.src = banArray[n]; startThread = setTimeout(“rotateSWBanner()”, 10000); } }
For starters, we have a nice big pile of global variables. We do a bunch of odd datetime operations, to populate the variable n. We have to give a special shoutout to modnum, which is set to
To read the full article click on the 'post' link at the top.