#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2009
    Posts
    113
    Rep Power
    16

    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
    Any help would be much appreciated.

    Thanks,
    DSFX
    Last edited by dsfx; October 24th, 2012 at 07:44 PM.
  2. #2
  3. A Not To Shabby Code Smurf
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2008
    Posts
    1,169
    Rep Power
    184
    I think your code is Internet Information Services (IIS) 6.0 - ASP Built-in Objects; you might want to start here; to read up on it's documentation: http://msdn.microsoft.com/en-us/libr...(v=vs.90).aspx
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2009
    Posts
    113
    Rep Power
    16
    Originally Posted by web_loone08
    I think your code is Internet Information Services (IIS) 6.0 - ASP Built-in Objects; you might want to start here; to read up on it's documentation: http://msdn.microsoft.com/en-us/libr...(v=vs.90).aspx
    Thanks for the info. No wonder why it wasn't making total sense.

    DSFX.
  6. #4
  7. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,443
    Rep Power
    4539
    Also fyi the code you posted appears to be vbscript. // isn't a comment in vbscript, an apostrophe starts comment text in vbs.
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0
    I remember doing this assignment, cheater cheater pumpkin eater.

    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.

    I will help you if you post your attempt at this method.

IMN logo majestic logo threadwatch logo seochat tools logo