Python

Moderators: None (Apply to moderate this forum)
Number of threads: 474
Number of posts: 1166

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
hey everyone, check out this cool database-type script i made! Posted by zamnedix on 30 Jul 2005 at 9:12 AM
#!/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

Report
Re: hey everyone, check out this cool database-type script i made! Posted by Drost on 31 Jul 2005 at 1:42 AM
: #!/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:")
: [/red]passwordagain=='33tg8'[/red]
: 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


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



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.