Results 1 to 3 of 3

Thread: password script and more :)

  1. #1
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    51
    Posts
    934
    Rep Power
    109

    password script and more :)

    hi all

    I have found yesterday an old password script on my notebook( I have to create it new! worked with sub function method) but it didn't fit into thinbasic language or do what I wished... eros has helped a little, so I have built this example...

    may be one day thinbasic or your own little thinbasic script has to get a password to start the application or you are using a trial version... doesn't matter...

    one little example with two loops

    info: use "q" and then "f" to quit the console script! to make it faster...

    more to come... I have some new ideas with this script...

    my bad example looked like this:

    [code=thinbasic]
    Function Passwort() As String
    Dim strPasswort As String
    Dim strBuffer As String
    DIM strInput as String

    Printl strInput
    Do
    Sleep 10
    strBuffer = Console_InKeyB()
    If strBuffer <> "" Then
    If Asc(Left$(strBuffer, 1)) = 13 Then Exit Do
    If Asc(Left$(strBuffer, 1)) = 8 Then
    strPasswort = Left$(strPasswort, Len(strPasswort) - 1)
    Len(strPasswort) + Len(strInput) + 1
    Printl (" ")
    Len(strPasswort) + Len(strInput) + 1
    Else
    strPasswort += strBuffer
    Printl ("******")
    EndIf
    End If
    Loop
    PrintL ("")
    Return strPasswort
    End Function
    [/code]

    I was very near at the aim

    sincerely Mr. Lionhead
    ...unfortunately with headache from a birthday and wine party last night...

    saturday early in the mornging edit: ps: sorry, I delete the attachment for building new "password" script version complete and with some new functions so I have in mind... better to make a clear big issue than three, four little parts - all work in progress...
    Attached Images Attached Images
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  2. #2
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    51
    Posts
    934
    Rep Power
    109

    Re: password script and more :)

    => topic: password...

    hi dear thinbasic friends

    have done a new password example and what a surprise I have one more question about this example ...

    first of all here the password console script !!!

    [code=thinbasic]'-------- password try by lionheart 08.april2009
    '-------- new version at 28.april2009

    Uses "Console", "UI","File"

    Dim InputUser, InputUser1 As String
    Dim StringBuffer As String
    Dim StringBuffer1 As String
    dim trialPassword as string = "Lionheart"
    dim lColor as long
    dim Hiddenpassword as string = "Franko Lionheart"

    printl
    printl "-..enter your first password for LIONBASIC-Module than type ENTER.. -"
    printl

    '---Loop and collect entered chars till user press ENTER key
    Do
    sleep 10
    InputUser = Console_InKeyB()
    Select Case Len(InputUser)
    Case 1
    print "# "
    StringBuffer += inputUser
    Case 2
    if right$(InputUser, 1) = chr$(13) then exit do
    Case 3
    if left$(InputUser, -1) = chr$(9) then exit do

    End Select

    Loop

    '---Now check password and output results
    printl
    if StringBuffer = trialPassword then
    '---Color green highlighted
    lColor = Console_ForegroundRGB(0,1,0,1)
    Console_SetTextAttribute(lColor)
    printl
    printl "Perfect! you have got the right password."
    else
    '---Color red highlighted
    lColor = Console_ForegroundRGB(1,0,0,1)
    Console_SetTextAttribute(lColor)
    printl
    printl " I'm sorry, password is not correct, generate new one "
    printl
    printl " You have failed just entered: " & StringBuffer
    printl " so your open Trial Password for 30 days is: " & trialpassword
    printl
    printl " Hidden password for LIONBASIC Module Fullversion is: " '& hiddenpassword
    printl " Send now your new password by e-mail: " ' & hiddenpassword
    end if

    '---Color yellow highlighted
    lColor = Console_ForegroundRGB(1,0,1,1)
    Console_SetTextAttribute(lColor)
    File_save("hidden.txt", hiddenpassword)

    '---Finish
    printl
    printl "--- Thanks for trying LIONBASIC Module. Press any key to next task ---"
    sleep 50
    printl
    waitkey
    '------------------------

    TYPE UserAccount
    Username as String * 16
    UserPassword as string * 16
    END TYPE

    dim u as UserAccount

    DIM f, i, found as integer
    DIM usr, usr1, pwd, yesno as string
    usr = "Lionbasic"
    usr1 = "Fantomas"

    console_cls

    printl
    printl "-- do you want create a new log-in account [yes/no] ", YesNo
    printl
    sleep 50

    '---Color yellow highlighted
    lColor = Console_ForegroundRGB(1,1,0,1)
    Console_SetTextAttribute(lColor)

    printl "Hey, try a new log-in account with password ..."
    printl
    printl "-- type in something new exciting stuff --"
    Do
    sleep 10

    'IF UCASE$(YN) = "Y" Then
    InputUser1 = Console_InKeyB()
    Select Case Len(InputUser1)
    Case 1
    print " * "
    StringBuffer1 += inputUser1
    Case 2
    if right$(InputUser1, 1) = chr$(13) then exit do
    Case 3
    if left$(InputUser, -1) = chr$(9) then exit do
    end select
    sleep 10
    'End if
    Loop

    printl
    if StringBuffer1 = usr then
    lColor = Console_ForegroundRGB(0,1,0,1)
    Console_SetTextAttribute(lColor)
    printl
    printl "Great! You have got now the Second right Password."
    else
    lColor = Console_ForegroundRGB(1,0,0,1)
    Console_SetTextAttribute(lColor)
    printl
    printl " I'm sorry, NEW password is not correct."
    printl
    printl " You have entered for NEW Account: " & StringBuffer1
    printl
    printl " so... you have got NEW Loginpassword for 30 days Trialperiode : " & usr
    end if

    printl
    lColor = Console_ForegroundRGB(0,0,0,1)
    Console_SetTextAttribute(lColor)
    printl
    printl "Great! You have got now the Second right Password."
    printl "all is ok, your new account was created..."
    printl
    printl "... have sent your correct password by e-mail again "
    printl

    File_save("hidden2.txt", usr1)

    printl "- push any key and exit script -"
    waitkey[/code]

    this script works nearly perfect

    next task: I would like to interrogate such a callback with "YES / NO" callbacks.. I will see

    printl "-- do you want create a new log-in account [yes/no] ", YesNo
    servus, have all a nice day, Lionheart

    Attached Files Attached Files
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  3. #3
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,128
    Rep Power
    732

    Re: password script and more :)

    Hi Frank,

    interesting script! I would recommend to support deleting characters while entering password.

    To get input from user, you can pick attached custom function:
    [code=thinbasic]uses "Console"

    dim name as string = GetInput("Enter your name: ")
    printl "Your name is "+name
    waitkey

    function GetInput(sPrompt as string) as string

    console_write sPrompt
    function = console_read

    end function[/code]

    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

Similar Threads

  1. username and password in script
    By sandyrepope in forum thinBasic General
    Replies: 11
    Last Post: 25-07-2007, 09:25

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •