hey everyone, check out this cool database-type script i made! - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

hey everyone, check out this cool database-type script i made!

zamnedixzamnedix Posts: 1Member
#!/usr/bin/python
print 'MAIN:'
import time
password=raw_input()
password== '6701302'
if password == '6701302':
exit,
print """MAIN accepted."""

if password != '6701302':
print """Unknown MAIN""",
time.sleep(2)
die
passwordagain=raw_input("password:")
passwordagain=='33tg8'
if passwordagain == '33tg8':
print """hello, Joshua."""
if passwordagain != '33tg8':
print """Warning: Incorrect Password.""",
time.sleep(2)
die
database=raw_input()
database == "quit"
if database == "quit":
print """goodbye, Joshua.""",
time.sleep(2)
die

Comments

  • DrostDrost Posts: 24Member
    [code]: #!/usr/bin/python
    : print 'MAIN:'
    : import time
    : password=raw_input()
    : [red]password== '6701302'[/red]
    : if password == '6701302':
    : exit,
    : print """MAIN accepted."""
    :
    : [purple]if password != '6701302':
    : print """Unknown MAIN""",
    : time.sleep(2)
    : die[/purple]
    : passwordagain=raw_input("password:")
    : [/red]passwordagain=='33tg8'[/red]
    : if passwordagain == '33tg8':
    : print """hello, Joshua."""
    : [purple]if passwordagain != '33tg8':
    : print """Warning: Incorrect Password.""",
    : time.sleep(2)
    : die[/purple]
    : database=raw_input()
    : [red]database == "quit"[/red]
    : if database == "quit":
    : print """goodbye, Joshua.""",
    : time.sleep(2)
    : die
    [/code]

    Hi,
    I checked out your 'database-type script' you've made. By the way what's a database-type script?
    Would you care to explain what task you want to accomplish? Because this is most likely just a stepstone which doesn't run (there's no 'die' builtin function in Python, and 'exit' is a function of the sys module). It asks for passwords which are then simply shown on screen (see the getpass module, to hide input securitywise). Contains the passwords several times, so it's easy to mistype them. Has illogical statements (highlighted in red). Tears appart the if-else structures into two ifs (purple highlight). Almost all string quotation markers are used in such a short script. Now I'm not saying it's wrong but it needs some polishing.

    So what was the goal you wished to achieve?
    A two password authentication and then user input interpretation?

    Drost
Sign In or Register to comment.