0% found this document useful (0 votes)
4 views

ACTIVITY-NO.1-3

The document outlines three activities related to creating a database and a login form. It includes SQL commands to create a database and a users table, insert user data, and provides HTML code for a styled login form. Additionally, it includes PHP code for establishing a database connection using MySQLi.

Uploaded by

sarcon52215221
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

ACTIVITY-NO.1-3

The document outlines three activities related to creating a database and a login form. It includes SQL commands to create a database and a users table, insert user data, and provides HTML code for a styled login form. Additionally, it includes PHP code for establishing a database connection using MySQLi.

Uploaded by

sarcon52215221
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

ACTIVITY NO.

1
MAKE A DATABASE AND TABLE

CREATE DATABASE my_database;

USE my_database;

CREATE TABLE users (

id INT AUTO_INCREMENT PRIMARY KEY,

username VARCHAR(50) NOT NULL,

password VARCHAR(255) NOT NULL

);

INSERT INTO users (username, password) VALUES ('admin', '1234');

If you want to Add user:

MySQL query to insert a value into the users table:

INSERT INTO users (username, password) VALUES ('delsa', 'mypassword123');


ACTIVITY NO.2

LOGIN FORM

HTML CODE (LOGIN)

<!DOCTYPE html>
<html>
<head>
<title>Login Form</title>
<style>
body {
margin: 0;
padding: 0;
background: linear-gradient(135deg, #74ebd5, #ACB6E5);
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.login-box {
background-color: #ffffff;
padding: 40px 30px;
border-radius: 15px;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
width: 320px;
text-align: center;
}

.login-box h2 {
margin-bottom: 25px;
color: #333;
}

.login-box label {
display: block;
text-align: left;
margin: 10px 0 5px;
font-weight: bold;
color: #555;
}

.login-box input[type="text"],
.login-box input[type="password"] {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 8px;
margin-bottom: 15px;
font-size: 14px;
}
.login-box input[type="submit"] {
width: 100%;
padding: 12px;
background-color: #007BFF;
border: none;
color: white;
font-size: 16px;
border-radius: 8px;
cursor: pointer;
transition: background-color 0.3s ease;
}

.login-box input[type="submit"]:hover {
background-color: #0056b3;
}
</style>
</head>
<body>

<div class="login-box">
<h2>Login</h2>
<form action="database_login.php" method="post">
<label for="username">Username:</label>
<input type="text" name="username" required>

<label for="password">Password:</label>
<input type="password" name="password" required>

<input type="submit" value="Login">


</form>
</div>

</body>
</html>
ACTIVITY NO.3

DATABASE CONNECTION

Database Connection

<?php
// Define your database connection parameters
$servername = "localhost";
$username = "root";
$password = ""; // default is blank for local servers
$dbname = "my_database";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection

if (!$conn->connect_error) {
echo "Connected successfully!";
}
?>

Remember:
http://localhost/yourfolder/basic_info.html

You might also like