feat: wait beacuse have bug at index.php
This commit is contained in:
parent
2282f02005
commit
2dd889153b
@ -1,13 +1,15 @@
|
||||
<?php
|
||||
session_start();
|
||||
include "config/db.php";
|
||||
include "notif.php";
|
||||
|
||||
if(isset($_POST['login'])){
|
||||
$username = $_POST['username'];
|
||||
$password = $_POST['password'];
|
||||
|
||||
if(empty($username)||empty($password)){
|
||||
echo "semua data harus terisi";
|
||||
$msg = "data harus diisi!";
|
||||
echo "<script>showNotif(" . json_encode($msg) . ");</script>";
|
||||
}else{
|
||||
$sql = "SELECT * FROM users WHERE username =?";
|
||||
$stmt = $db -> prepare($sql);
|
||||
@ -24,7 +26,8 @@ if(isset($_POST['login'])){
|
||||
header("location:leaderboard.php");
|
||||
exit();
|
||||
}else{
|
||||
echo "password salah";
|
||||
$msg = "Password Salah!";
|
||||
echo "<script>showNotif(" . json_encode($msg) . ");</script>";
|
||||
}
|
||||
}else{
|
||||
echo "username salah";
|
||||
@ -56,6 +59,7 @@ $db->close();
|
||||
<button type="submit" name="login" placeholder="input your password" data-aos="fade-up" data-aos-duration="3000">LOGIN</button>
|
||||
<p placeholder="input your password" data-aos="fade-up" data-aos-duration="3000"><a href="register.php">don't have account yet?<span> register now!</span></a></p>
|
||||
</form>
|
||||
<div id="notif" class="notif"></div>
|
||||
</div>
|
||||
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
|
||||
<script>
|
||||
|
||||
40
src/notif.php
Normal file
40
src/notif.php
Normal file
@ -0,0 +1,40 @@
|
||||
<div id="notif" class="notif"></div>
|
||||
|
||||
<style>
|
||||
.notif {
|
||||
position: fixed;
|
||||
top: 100px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
background-color: #00000060;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
color: yellow;
|
||||
padding: 12px 18px;
|
||||
width: 500px;
|
||||
height: 200px;
|
||||
font-size: 30px;
|
||||
border: 1px solid white;
|
||||
border-radius: 8px;
|
||||
opacity: 0;
|
||||
transition: .3s;
|
||||
z-index: 9999;
|
||||
}
|
||||
.notif.show {
|
||||
opacity: 1;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
function showNotif(msg) {
|
||||
const n = document.getElementById("notif");
|
||||
n.textContent = msg;
|
||||
n.classList.add("show");
|
||||
|
||||
setTimeout(() => {
|
||||
n.classList.remove("show");
|
||||
}, 3000);
|
||||
}
|
||||
</script>
|
||||
Loading…
x
Reference in New Issue
Block a user