-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheck.py
More file actions
29 lines (22 loc) · 741 Bytes
/
Check.py
File metadata and controls
29 lines (22 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!C:\Users\HP\AppData\Local\Programs\Python\Python38\Python
import cgi
import mysql.connector as mycon
print("Content-type: text/html")
print()
form=cgi.FieldStorage()
id=form.getvalue("uid")
ps=form.getvalue("psw")
con=mycon.connect(host='localhost',user='root',password='12345',database='python')
curs=con.cursor()
curs.execute("select count(*) from users where userid='%s' and pswd='%s';" %(id,ps))
cnt=curs.fetchone()
print(cnt)
if cnt[0]==1:
#print("<h2>Welcome to python web development</h2>")
print("<html>")
print("<head>")
print("<meta http-equiv='refresh' content='0;url=Admin.html'/>")
print("</head>")
print("</html>")
else:
print("<h2>Sorry password failed</h2>")