Auth help

Discussion in 'Code Snippets and Tutorials' started by Violent_J, Dec 6, 2008.

  1. Violent_J

    Violent_J Level I

    Joined:
    Oct 21, 2008
    Messages:
    41
    Likes Received:
    1
    Ricky tried to convert this in vb6 for me.
    Now, I myself done vb6 in a while so I am a bit out of practice.

    So someone fix this slightly converted code?

    Code (Text):
    1. Dim strHTML As String, ProgID As Integer, strName As String
    2.  
    3. Private Sub cmdauth_click()
    4. strName = "Your program" 'Put your program's name exactly as you will put it in the downloads section
    5. ProgID = 666 'Put your program ID here. You will get it once you go to the "Add download" page.
    6. strHTML = w.GetWrapper("http://www.neofriends.net/auth.php?username=" & txtAuth_Username.Text & "&password=" & txtAuth_Password.Text & "&program=" & ProgID)
    7. strHTML = GetBetween(strHTML, "<td style="height: 100px;" align=center><h2>", "</h2></td>")
    8. Select Case strHTML
    9.     Case "Authorized to use the program.":
    10.       'Show your main form here
    11. Default:
    12.       MsgBox strHTML
    13. end case
    14. End Sub
    Code (Text):
    1. End case is in red
    2. strHTML = GetBetween(strHTML, "<td style="height: 100px;" align=center><h2>", "</h2></td>") is in red
     
  2. Belaarx

    Belaarx Level I

    Joined:
    Sep 23, 2008
    Messages:
    135
    Likes Received:
    16
    Location:
    San Diego
    You aren't escaping the quotes out of the GetBetween. I'm sure there is an easier way but I just would use this:

    Code (Text):
    1.  
    2. strHTML = GetBetween(strHTML, "<td style=" . chr(34) . height: 100px;" . chr(34) . " align=center><h2>", "</h2></td>")
    3.  
     
  3. Zer0

    Zer0 Level IV

    Joined:
    Mar 2, 2008
    Messages:
    3,037
    Likes Received:
    180
    Location:
    Home sweet home
    I don't know if this works in VB, but try using \"
    using backslash to escape characters is pretty universal usage across languages.
     
  4. Belaarx

    Belaarx Level I

    Joined:
    Sep 23, 2008
    Messages:
    135
    Likes Received:
    16
    Location:
    San Diego
    True zero, but VB is old school and didn't like me typing in that :/
     
  5. turato

    turato Level III

    Joined:
    Aug 3, 2007
    Messages:
    408
    Likes Received:
    0
    Wait are you trying to convert this from vb6 to vb.net or other way around
     
  6. Belaarx

    Belaarx Level I

    Joined:
    Sep 23, 2008
    Messages:
    135
    Likes Received:
    16
    Location:
    San Diego
    I think he isn't trying to do any conversion, just a problem with the code and the "End Case".
     
  7. Violent_J

    Violent_J Level I

    Joined:
    Oct 21, 2008
    Messages:
    41
    Likes Received:
    1
    If I was back in my prime then I would have caught it. lol
    Sorry guys, I haven't done this language in a while. :/

    Thanks