Help me figure this code out.

Ok so i've got little to no JS experience. I'm learning as i go but not fast enough. I need some help deciphering what this is doing exactly. This vendor doesn't seem to like doing things the standard way and doesn't have any documentation for their services.

This is a snippet of code they sent me from another users site and said go to town...

I've included my specific questions as comments in the code.

Code:

if Request.QueryString("authtype").Item = "mobile" then
//clears any buffered output
//Why would this be required?
Response.Clear()
if Request.QueryString("cn").Item <> "" then
cn = Request.QueryString("cn").Item
end if
if Request.QueryString("pn").Item <> "" then
pn = Request.QueryString("pn").Item
end if
if pn <> "" and cn <> "" then
//i don't understand this whole block.
//what is auth(), what is it checking and doing?
//What is the p.Item("RECORD#")for?
good = auth()
if good = true then
pt = p.Item("RECORD#")
Response.Write("OK:" & pt)
else
Response.Write("Error: Bad card number or PIN")
end if
end if
Response.End()
else
good = auth()
if good = true then
//why is SC being set and not used?
sc = ""
//What is the p.Item("RECORD#")for?
pt = p.Item("RECORD#")
songurl = "http://www.website.com/libraries/patron/" & pt
Response.Redirect(songurl)
end if
end if

In anycase, you have to create the methods for getIntWithinRange, which is the whole point to the course, its teaching you data validation.

I'm not going to do your homework for you but I will walk you through the computer logic steps.

1. Method getIntWithinRange takes in a Scanner sc, and two integers, one for the minimum range, and maximum range.
2. You need to code out how compare the "nextInt()" from the scanner with the min/max and if its a valid value, store that variable in "testScore".
3. The only answer I will give you is to include sc.next(); to discard a false value.