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

Coding Part 1 Pta

The document is an HTML page for logging into a system to record attendance of a council meeting. It contains forms to enter a username and password and buttons to log in or sign up. On login, it will redirect to a home page.

Uploaded by

DPPSKR0620 Jenny
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Coding Part 1 Pta

The document is an HTML page for logging into a system to record attendance of a council meeting. It contains forms to enter a username and password and buttons to log in or sign up. On login, it will redirect to a home page.

Uploaded by

DPPSKR0620 Jenny
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

<!

DOCTYPE html>
<html lang="en">
<head>
<body>
<meta charset="UTF-8">
<meta http-equiv="x-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>KEHADIRAN DEWAN PERDANA</title>
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/
Dwwykc2MPK8M2HN" crossorigin="anonymous">

</body>
</head>

<?php

$hostName = "localhost";
$dbUser = "root";
$dbPassword = "";
$dbName = "dewanperdana";
$conn = mysqli_connect($hostName, $dbUser, $dbPassword, $dbName);
if (!$conn) {
die("Something went wrong;");

}
// Create connection
$connection = new mysqli($hostName, $dbUser, $dbPassword, $dbName);

//add mew client to database


$sql ="INSERT INTO login_signup (USERNAME, PASSWORD)".
"VALUES ('$USERNAME', '$PASSWORD')";
$result = $connection->query($sql);

if (!$result){
$errorMessage = "Invalid query;" . $connection->error;
break;
}
?>

<style>
body{
background-image:
url('https://img.freepik.com/free-vector/watercolor-paper-with-floral-
design_53876-97360.jpg?
size=626&ext=jpg&ga=GA1.1.1803636316.1700611200&semt=ais');
background-size: cover;
background-position: center;
background-repeat: no-repeat;
height: 100vh;
margin: 0vh;
display: flex;
justify-content: center;
align-items: center;
}

</style>

<head>
<body>
<h1 style="text-align: center; font-size: 50px;">KEHADIRAN DEWAN
PERDANA</h1>

<form id="LoginForm">
<p style="text-align: center; font-size: 20px;">
<label for="username">USERNAME</label>
<input type="text" id="username" name="username" required>
</p>

<p style="text-align: center; font-size: 20px;">


<label for="password">PASSWORD</label>
<input type="password" id="password" name="password" required>
</p>

<p style="text-align: center;">


<button type="button" onclick="attemptLogin()">LOGIN</button>
</p>

<p style="text-align: center;">


<button type="button" onclick="location.href='signup.php'">SIGN
UP</button>

</form>
</body>
</head>

<script>
function attemptLogin() {
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;

if (username.trim() ==="" || password.trim() ===""){


alert("Please enter both username and password");
return;
}

window.location.href="home.php";

console.log("USERNAME" + username);
console.log("PASSWORD" + password);

</script>
</html>

You might also like