Create a MysQL database and call it csit101. Now let\'s create a table and call
ID: 3718616 • Letter: C
Question
Create a MysQL database and call it csit101. Now let's create a table and call it administrators. This table contains three fields: adminlD, email, and password. The following shows the sql file that generates the database and the required table. It also populates with two users whose email addresses arei2gmail.com and kk@gmail.com. - create and select the database DROP DATABASE IF EXISTS CSIT101; CREATE DATABASE CSIT101; USE CSIT101; CREATE TABLE administrators adminlD email password VARCHAR 255) NOT NULL firstName VARCHAR 255) NOT NULL lastName VARCHAR(255) NOT NULL PRIMARY KEY (admin D) NOT NULL AUTO INCREMENT INT VARCHAR(255) NOT NULL INSERT INTO administrators (adminlD, email, password, firstName, lastName) VALUES 1, ij@gmail.com', sesame', John', Johnson'), 2, 'kk@gmail.com, password', "Karen, "King': -Create a user named super GRANT SELECT, INSERT, UPDATE, DELETE ON TO super@localhost DENTIFIED BY 'super'; The main purpose for creating the user named super is for use in the creating of PDO. Recall that in order to create a PDO we need a user who have the credential to access the required database. Although we don't need to grant full privileges to this user in order to run this lab, but we may use it later for other exercises.Explanation / Answer
Hi,
login.html
<!DOCTYPE html>
<html>
<center>
<head>
<style>
label {
width:600px;
clear:bottom;
text-align:right;
padding-right:30px;
}
</style>
<title>Login form</title>
<h1>Welcome to CSIT website</h1>
<h2>Please Login</h2>
</head>
<br >
<br >
<br >
<br >
<br >
<br >
<body >
<form action = "login1.py" method = "POST">
<label for="email"><b>Email ID: </b></label>
<input type="text" placeholder="Enter Email" name="email" required>
<br>
<br>
<label for="psw"><b>Password:</b></label>
<input type="password" placeholder="Enter Password" name="psw" required>
<br>
<br>
<br>
<button type="submit">Login</button>
</form>
</body>
</center>
</html>
login.py
#!C:UsersHarikaAppDataLocalProgramsPythonPython36-32python
print("Content-type: text/html")
print()
import cgi,cgitb
import sys
import requests
cgitb.enable()
form=cgi.FieldStorage()
db = pymysql.connect(host="localhost", user="root", passwd="", db="fullstack")# name of the data base
cur = db.cursor()
email=form.getvalue('email')
password = form.getvalue('psw')
def create():
sql = "SELECT email,password FROM login"
row=cur.execute(sql)
for i in row:
if (i[0]==email and i[1]==psw):
print("Good Job! Successfully login!!")
else:
print("Invalid credential,you must login to view the website.")
create()
I have taken the table name:login,database:fullstack,
Please create the database, and table, values,before executin the program, please let me know if you stuck anywhere