1

so I've created a website using html and a code in python that redirects to it if you have the password and username correct(blank is a substitute for private info):

import time
import webbrowser
print("To access the website Enter your username and password bellow")
x=input("Username:")
y=input("Password:")
if x=="dsafro9156" and y=="D24$m?!tdy":
    print("Access granted rederecting you to the website")
    time.sleep(1)
    webbrowser.open('nasa.gov')
else:
    while x!="dsafro9156" and y!="D24$m?!tdy":
        print("Access denied. Please try again")
        print("                ")
        print("-------------------------------------------------------")
        print("                       ")
        x=input("Username:")
        y=input("Password:")
        if x=="dsafro9156" and y=="D24$m?!tdy":
            print("Access granted rederecting you to the website")
            time.sleep(1)
            webbrowser.open('nasa.gov')

    

is there any way I can make the website inaccessible? I'm not looking for hackerproof stuff just something to make sure you couldn't just bookmark the tab but actually had to log in.

  • BTW all passwords usernames and websites are substituted so this isn't the real thing just an (edited to keep stuff private) version – David Safro Jun 22 '20 at 21:32
  • Beside the point, but check out [this question](https://stackoverflow.com/q/23294658/4518341) for tips on making your input validation cleaner. Also BTW welcome to SO! Check out the [tour] and [ask] if you want advice. – wjandrea Jun 22 '20 at 21:33
  • 2
    If you're trying to block people from accessing the site, why not require a login *on the site*? – wjandrea Jun 22 '20 at 21:37
  • THe problem is I don't have enough experience with javascript to do that. I just started webdev – David Safro Jun 22 '20 at 22:45

0 Answers0