Advertisement
sehia

kirim.py

May 1st, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #!/Python27/python
  2. import cgi,cgitb
  3. import datetime
  4. import sqlite3
  5.  
  6. #Nama : Budi Darmawan
  7. #Kelas : 4A
  8. #NIM : 15090088
  9. # kirim.py
  10. #create intance of FieldStorage
  11. form = cgi.FieldStorage()
  12.  
  13. conn=sqlite3.connect('C:\Users\SeHia\Documents\userpasswd.db')
  14. cur=conn.cursor()
  15.  
  16. username = form.getvalue('username')
  17. password = form.getvalue('password')
  18.  
  19. print "Content-type: text/html"
  20. print
  21. print "<html>"
  22. print "<head><title> Test form</title></head>"
  23. print "<body>"
  24. print "<form method='post' action='Kirim.py'>"
  25. cur.execute('SELECT * FROM userpasswd WHERE user = ? AND password=?',(username,password))
  26. if cur.fetchall() :
  27. print "selamat datang <b>"+username+"</b> anda login pada " + str(datetime.datetime.now())
  28. else:
  29. print "username atau password salah"
  30. print "</body>"
  31. print "</html>"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement