Help request for a vb6 noob (even more now)

Discussion in 'Code Snippets and Tutorials' started by Poprockz, Jul 13, 2007.

  1. Poprockz

    Poprockz Level II

    Joined:
    Jul 10, 2007
    Messages:
    202
    Likes Received:
    1
    Location:
    Unknown
    Okay, so I just started learning VB6 and I just got through a login source, figuring out all the code along the way. If I were to make a, say, autobuyer, what step would I take next? Can someone with experience point me in the right direction? Thanks in advance.


    See the bottom of this thread for my current issue..
     
  2. Billy

    Billy Level IV

    Joined:
    Feb 21, 2007
    Messages:
    1,856
    Likes Received:
    39
    Re: Help request for a vb6 noob

    you cant expect to make an aber right after you started learning. i recommend learning how to use functions in the wrapper and other functions like findstring and instr to help make programs more dynamic
     
  3. the_skip

    the_skip Level IV

    Joined:
    Dec 25, 2006
    Messages:
    2,354
    Likes Received:
    1
    Location:
    Indiana
    I would learn how to make a money tree grabber. I would recomend looking at some source to get the feel of the language
     
  4. Snowman

    Snowman Level IV

    Joined:
    Apr 9, 2007
    Messages:
    825
    Likes Received:
    0
    Maybe try making something really simple like a spider program since you just started. Making a ABer is way too hard for begineers
     
  5. Poprockz

    Poprockz Level II

    Joined:
    Jul 10, 2007
    Messages:
    202
    Likes Received:
    1
    Location:
    Unknown
    Alright, thanks for the help, guys. I already understand some commands, I think. Like InStr..

    Anyway, I'll go look for some money tree grabber sources/spiderer sources if I can find any.

    While I'm here.. can anyone explain to me why this isn't working? Keep in mind that it's for Subeta, not Neopets.

    Code (Text):
    1. Private Sub cmdStart_Click()
    2. Dim strHTML As String
    3.  
    4. lblStatus.Caption = "Starting up!"
    5. strHTML = wrapper.GetWrapper("http://www.subetax.org /explore/ocean_depths.php", "http://www.subetax.org/ explore/unknown.php")
    6.  
    7. If InStr(1, strHTML, "welcome") Then
    8. lblStatus.Caption = "It's working, captain."
    9. ElseIf InStr(1, strHTML, "Ocean Depths Vending Machine") Then
    10. lblStatus.Caption = "Not quite there, captain."
    11. Else
    12. lblStatus.Caption = "Unknown :("
    13. End If
    14. End Sub
    15.  
     
  6. the_skip

    the_skip Level IV

    Joined:
    Dec 25, 2006
    Messages:
    2,354
    Likes Received:
    1
    Location:
    Indiana
    first remove spaces, secondsly teh instr is case sensitive. if you need help fell free to pm/msn me. Also remebr if you have to be logged int to veiw the page you will not be logged in sicne you;ll nned to manually login with the httpwrapper
     
  7. Poprockz

    Poprockz Level II

    Joined:
    Jul 10, 2007
    Messages:
    202
    Likes Received:
    1
    Location:
    Unknown
    I've added you on msn. :). Thanks for the help so far

    EDIT: In case I don't get in contact with you soon enough: The problem still occurs.. I changed the InStr to "Welcome" to be more accurate, but it still return and unknown error. For the login part.. are you saying I have to include a login to my program for it to work? Or can I just manually log in on firefox and start the program?

    EDIT again: Another thing.. can anyone here successfully make a login for Subetax.org? If they could and show me the source, I'd greatly appreciate it, for I have failed every attempt :(
     
  8. the_skip

    the_skip Level IV

    Joined:
    Dec 25, 2006
    Messages:
    2,354
    Likes Received:
    1
    Location:
    Indiana
    well I'm really supoosed to be asleep right now so I cannot be on right now. And yes you will need a working sebetax.org login for this program to work unless you grab the bookie from firefox which is next to impossible for a begiiner.
     
  9. Poprockz

    Poprockz Level II

    Joined:
    Jul 10, 2007
    Messages:
    202
    Likes Received:
    1
    Location:
    Unknown
    Damn.. I tried to make a login for Subeta but it wouldn't work..
    Well, thanks for the help D:
     
  10. Poprockz

    Poprockz Level II

    Joined:
    Jul 10, 2007
    Messages:
    202
    Likes Received:
    1
    Location:
    Unknown
    Well, along with this not working:

    Code (Text):
    1. Private Sub cmdStart_Click()
    2. Dim strHTML As String
    3.  
    4. lblStatus.Caption = "Starting up!"
    5. strHTML = wrapper.GetWrapper("http://www.subetax.org/explore/ocean_depths.php", "http://www.subetax.org/ explore/unknown.php")
    6.  
    7. If InStr(1, strHTML, "welcome") Then
    8. lblStatus.Caption = "It's working, captain."
    9. ElseIf InStr(1, strHTML, "Ocean Depths Vending Machine") Then
    10. lblStatus.Caption = "Not quite there, captain."
    11. Else
    12. lblStatus.Caption = "Unknown :("
    13. End If
    14. End Sub
    15.  
    I tried to make a login, but it's not working either. Here's the code:

    Code (Text):
    1.  
    2. Private Sub cmdLogin_Click()
    3. Dim strHTML As String
    4.  
    5. strHTML = wrapper.GetWrapper("http://www.subetax.org/")
    6. lblStatus.Caption = "Logging in 1 . . ."
    7. strHTML = wrapper.GetWrapper("http://www.subetax.org/login.php", "http://www.subetax.org/")
    8. lblStatus.Caption = "Logging in 2 . . ."
    9. strHTML = wrapper.Postwrapper("http://www.subetax.org/login.php", "Name=" & txtUser.Text & "&Password=" & txtPass.Text & "&act=login&actcode=&Login=Login")
    10. lblStatus.Caption = "Logging in 3 . . ."
    11.  
    12. If InStr(1, strHTML, "Incorrect") Then
    13. lblStatus.Caption = "Bad password. Try again."
    14. ElseIf InStr(1, strHTML, "http://www.subetax.org/news.php") Then
    15. lblStatus.Caption = "You have logged in."
    16. Else
    17. lblStatus.Caption = "Error. :("
    18. End If
    19.  
    20. End Sub
    21.  
    The login tells me if the pass is bad, which is good. But it won't recognize it when I put in a GOOD user/pass. If I do, it gives me an error.
     
  11. expon

    expon Administrator
    Staff Member

    Joined:
    Oct 30, 2006
    Messages:
    1,393
    Likes Received:
    56
    Location:
    UK
    add a breakpoint on this line

    ElseIf InStr(1, strHTML, "http://www.subetax.org/news.php") Then

    and hover your mouse over strHTML and see what code that string contains, paste it here.

    also when you say an error do you mean a proper error or the 'Error :(' message in the label?
     
  12. Poprockz

    Poprockz Level II

    Joined:
    Jul 10, 2007
    Messages:
    202
    Likes Received:
    1
    Location:
    Unknown
    What's a breakpoint?
    and I hovered but I don't get anything.. only the mouse is there :(.
    and the error is my error, not the proper error.

    Also,

    Code (Text):
    1.  
    2. ElseIf InStr(1, strHTML, "http://www.subetax.org/news.php")
    The url in that code doesn't have to be there.. I could just change it to something else contained on the page after you login (right?)
     
  13. Billy

    Billy Level IV

    Joined:
    Feb 21, 2007
    Messages:
    1,856
    Likes Received:
    39
    a break is where you click on the left margin on the line you want it to stop at and a red circle will appear and when your running the program the code window will come up and you can check the values of your variables.
     
  14. Poprockz

    Poprockz Level II

    Joined:
    Jul 10, 2007
    Messages:
    202
    Likes Received:
    1
    Location:
    Unknown
    Okay, I clicked the side and the red circle appeared.. I ran the program.. then it stopped and there's a yellow circle and yellow background on that line now. What do I do next?

    Wait, I hovered over strHTML and got this:

    Code (Text):
    1. strHTML = "HTTP/1.1 302 FoundDate: Fri, 13 Jul 2007 16:07:39 GMTServer: ...
    2.  
    That's all it says..
     
  15. Billy

    Billy Level IV

    Joined:
    Feb 21, 2007
    Messages:
    1,856
    Likes Received:
    39
    you need the whole strhtml, so after the instr, put msgbox(strhtml) and that should be enough to see at least to the part your looking for.
     
  16. expon

    expon Administrator
    Staff Member

    Joined:
    Oct 30, 2006
    Messages:
    1,393
    Likes Received:
    56
    Location:
    UK
    there should be a button to expand it and view all the html code? I think that's only the start of it...
     
  17. the_skip

    the_skip Level IV

    Joined:
    Dec 25, 2006
    Messages:
    2,354
    Likes Received:
    1
    Location:
    Indiana
    nope thats ,net I belive this is vb6
     
  18. Poprockz

    Poprockz Level II

    Joined:
    Jul 10, 2007
    Messages:
    202
    Likes Received:
    1
    Location:
    Unknown
    So I still have no idea what to do..
    no idea where to put the MsgBox bit and yes, this is vb6...
     
  19. the_skip

    the_skip Level IV

    Joined:
    Dec 25, 2006
    Messages:
    2,354
    Likes Received:
    1
    Location:
    Indiana
    right after any httpwrapper.get.post.
     
  20. Poprockz

    Poprockz Level II

    Joined:
    Jul 10, 2007
    Messages:
    202
    Likes Received:
    1
    Location:
    Unknown
    Code (Text):
    1. Private Sub cmdLogin_Click()
    2. Dim strHTML As String
    3.  
    4. strHTML = wrapper.GetWrapper("http://www.subetax.org/")
    5. lblStatus.Caption = "Logging in 1 . . ."
    6. strHTML = wrapper.GetWrapper("http://www.subetax.org/login.php", "http://www.subetax.org/")
    7. lblStatus.Caption = "Logging in 2 . . ."
    8. strHTML = wrapper.Postwrapper("http://www.subetax.org/login.php", "Name=" & txtUser.Text & "&Password=" & txtPass.Text & "&act=login&actcode=&Login=Login")
    9. MsgBox(strHTML)
    10. lblStatus.Caption = "Logging in 3 . . ."
    11.  
    12. If InStr(1, strHTML, "Incorrect") Then
    13. lblStatus.Caption = "Bad password. Try again."
    14. ElseIf InStr(1, strHTML, "http://www.subetax.org/news.php") Then
    15. lblStatus.Caption = "You have logged in."
    16. Else
    17. lblStatus.Caption = "Error. :("
    18. End If
    19.  
    20. End Sub
    Like that?

    EDIT:
    [​IMG]

    So by the looks of it, it works? News.php is where it goes when you log in..