none
Can someone help me with my login system? RRS feed

  • Question

  • Well first of all, let me tell you that I am only 12 years old. I started programming this basic login system in Small Basic 1.0, I am having trouble with setting the textwindow background and foreground. I am also having problems with setting up choices. Here is my codes:

    'Login System, Made On May 13, 2012
    'Brought to you by Cyrus Lybbert Programs
    
    'stating the variables (user and password)
    user = "clybbert"
    pass = "Im1ssmymom
    
    'setting up the layout
    TextWindow.BackgroundColor = "Ivory"
    TextWindow.ForegroundColor = "DarkKhaki"
    
    'setting up the beginning
    start:
    TextWindow.Clear()
    TextWindow.WriteLine("Username: ")
    name = TextWindow.Read()
    TextWindow.WriteLine("Password: ")
    password = TextWindow.Read()
    Goto check
    
    'setting up errors
    oops:
    TextWindow.Clear()
    TextWindow.WriteLine("You have made an error, would you like to start over, type Y or N.")
    answer = TextWindow.Read()
    If answer = "Y" Then
      Goto start
      EndIf
      If answer = "N" then
      Goto End
    EndIf
    
    'setting up end
    end:
    TextWindow.Clear()
    TextWindow.WriteLine("You now have permission to close Login System.")
    
    'setting up check
    check:
    If name = user Then
      Goto love
    Else 
      Goto oops
      EndIf
    If password = pass then
      Goto love
    Else 
      Goto oops
    EndIf
    
    love:
    TextWindow.Clear()
    TextWindow.WriteLine("What would you like to do?")
    answer = TextWindow.Read()
    If answer = things Then 
      goto things
      EndIf
      
      
      
      'setting up things
       TextWindow.clear()
      things = quote + changepass + changeuser + logout
      things:
      'view quote
      quote:
      If answer = things or quote Then
        TextWindow.clear()
        TextWindow.WriteLine("When life gives you lemons, you eat them!")
        Goto love
      EndIf
      'changepass
      If answer = things Or changepass Then
         TextWindow.clear()
        TextWindow.WriteLine("What would you like your new password to be? ")
        pass = TextWindow.Read()
        Goto love
      EndIf
      'changeuser
      If answer = things Or changeuser Then
         TextWindow.clear()
         TextWindow.WriteLine("What would you like your new username to be? ")
         user = TextWindow.Read()
         Goto love
       EndIf
       'logout
       If answer = things Or logout Then 
         TextWindow.clear()
          TextWindow.WriteLine("Are you sure you want to logout? Y or N")
         yesno = TextWindow.Read()
         If yesno = "Y" Then 
           Goto Start
         EndIf 
         If yesno = "N" Then 
           goto love
         EndIf
         
       EndIf
       'end of coding
       

    Thanks for the help,

    Cyrus Lybbert

    Sunday, May 13, 2012 1:34 PM

Answers

  • Cyrus,

    When I try to run your program, there are errors about variables not initalised (section setting up things)

    After deleting part of the program I also saw that the colors didn't worked, but changing to e.g. red/green

    DID work !

    Furthermore I saw a error in your logic in checking user/password: If the username is right the program goes to "love" without checking the password. If user=name your goto must point to the "if password=pass" part.

    I hope  this will help you to get your program started.

    EDIT:

    In the Manual, chapter "our second program" there are 16 colors to be used in the textwindow.  In Appendix B there are many more colors, which work only in the graphicswindow!

    Sunday, May 13, 2012 3:18 PM
    Answerer