Skip to content
Snippets Groups Projects
Commit 292e813e authored by Candra HP's avatar Candra HP
Browse files

Mengakses data username dan password dari database

parent a4dacae1
No related merge requests found
@fontface {
font-family : bebas;
src : ();
}
.containerlogin {
width: 23em;
height: 28em;
......@@ -28,7 +33,7 @@ span.makeline {
font-size: 45px;
padding: 0 7.5px;
font-weight: bold;
background-color: rgb(139, 189, 60);
background-color: rgb(139, 189, 60);
color: rgb(2, 112, 44);
text-align: center;
font-family: 'Oswald', sans-serif;
......@@ -39,7 +44,7 @@ span.makeline {
}
.space2 {
padding: 8px;
padding: 18px;
}
.space3 {
......@@ -78,28 +83,26 @@ input[type=text], input[type=password] {
font-family: sans-serif;
}
.containerbutton {
padding: 16px;
margin-left: 8px;
margin-right: 8px;
text-align: left;
}
.noaccount {
padding-top: 8px;
float: left;
text-align: left;
}
#linkaccount {
#linkRegister {
color: black;
}
.containerbutton {
float: right;
}
button {
background-color: rgb(130, 216, 0);
border-radius: 5px;
cursor: pointer;
font-size: 18px;
text-align: center;
float: right;
padding: 6px 22px;
border: 2px solid rgb(0, 0, 0);
font-family: 'Lora', sans-serif;
......
<!DOCTYPE html>
<html>
<head>
<title>Tugas Besar 1 IF3110</title>
<title>Laman Login</title>
<link rel="stylesheet" type="text/css" href="login.css">
<link href="https://fonts.googleapis.com/css?family=Oswald:600" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Lora" rel="stylesheet">
......@@ -18,23 +18,24 @@
</div>
<div class="space1"></div>
<div class="containerform">
<form>
<form action="loginserver.php" method="POST">
<label>Username</label>
<input type="text" placeholder="Enter Username" name="uname" required>
<div class="space3"></div>
<label>Password</label>
<input type="password" placeholder="Enter Password" name="psw" required>
<div class="space2"></div>
<div class="noaccount">
<a href="register.html" id="linkRegister">Don't have an account?</a>
</div>
<div class="containerbutton">
<button type="submit" name="submit">GO!</button>
</div>
</form>
</div>
<div class="space2"></div>
<div class="containerbutton">
<button type="submit">GO!</button>
<div class="noaccount">
<a href="link_buat_akun" id="linkaccount">Don't have an account?</a>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
<?php
$error='';
if (isset($_POST['submit'])) {
if (empty($_POST['uname']) || empty($_POST['psw'])) {
$error = "Username or Password is Invalid";
}
else {
$uname=$_POST['uname'];
$psw=$_POST['psw'];
$connect = mysqli_connect("localhost", "root", "");
$db = mysqli_select_db($connect, "projek_db");
$query = mysqli_query($connect, "SELECT * FROM users WHERE psw='$psw' AND uname='$uname'");
$rows = mysqli_num_rows($query);
if ($rows > 0) {
header("Location: welcome.php");
} else {
$error = "Username or Password is Invalid";
}
mysqli_close($connect);
}
}
?>
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment