ganti css
This commit is contained in:
parent
3bf544feac
commit
eaa0f0542f
29
login.css
29
login.css
@ -1,13 +1,5 @@
|
|||||||
body {
|
body
|
||||||
<<<<<<< HEAD
|
{
|
||||||
font-family: Arial, sans-serif;
|
|
||||||
background: #1e90ff;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
height: 100vh;
|
|
||||||
margin: 0;
|
|
||||||
=======
|
|
||||||
font-family: Poppins, Arial, sans-serif;
|
font-family: Poppins, Arial, sans-serif;
|
||||||
background: linear-gradient(135deg, #d9a7ff, #fbc2eb, #a1c4fd);
|
background: linear-gradient(135deg, #d9a7ff, #fbc2eb, #a1c4fd);
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
@ -15,7 +7,6 @@ body {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
>>>>>>> 149dc47c4d90a64a3fe437ba26e7cf4d1cbbbf50
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Background animation circles */
|
/* Background animation circles */
|
||||||
@ -75,22 +66,34 @@ body {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin-bottom: 25px;
|
margin-bottom: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-circle {
|
.icon-circle {
|
||||||
background: linear-gradient(135deg, #7928ff, #ff0080);
|
background: linear-gradient(135deg, #7928ff, #ff0080);
|
||||||
padding: 22px;
|
padding: 22px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
box-shadow: 0 6px 20px rgba(255,0,128,0.4);
|
box-shadow: 0 6px 20px rgba(255,0,128,0.4);
|
||||||
}
|
}
|
||||||
.login-icon { width: 45px; height: 45px; }
|
|
||||||
|
.login-icon {
|
||||||
|
width: 45px;
|
||||||
|
height: 45px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Header Text */
|
/* Header Text */
|
||||||
.header-text { text-align: center; margin-bottom: 20px; }
|
.header-text {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
.header-text h2 {
|
.header-text h2 {
|
||||||
background: linear-gradient(45deg, #7928ff, #ff0080);
|
background: linear-gradient(45deg, #7928ff, #ff0080);
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
background-clip: text;
|
||||||
color: transparent;
|
color: transparent;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-text p {
|
.header-text p {
|
||||||
color: #333;
|
color: #333;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|||||||
101
login.php
101
login.php
@ -1,50 +1,39 @@
|
|||||||
<?php
|
<?php
|
||||||
<<<<<<< HEAD
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
// untuk halaman login
|
//untuk halaman login
|
||||||
include "koneksi.php";
|
include "koneksi.php";
|
||||||
|
if (isset($_POST['username']))
|
||||||
$username = isset($_POST['username']) ? $_POST['username'] : '';
|
{
|
||||||
$password = isset($_POST['password']) ? $_POST['password'] : '';
|
$username=$_POST['username'];
|
||||||
|
}
|
||||||
// Pastikan kedua field terisi
|
else $username ='';
|
||||||
if ($username != '' && $password != '') {
|
if (isset($_POST['password']))
|
||||||
$stmt = mysqli_prepare($conn, "select * from user where username=? and password=?");
|
{
|
||||||
$enc = md5($password);
|
$password=$_POST['password'];
|
||||||
mysqli_stmt_bind_param($stmt, "ss", $username, $enc);
|
}
|
||||||
mysqli_stmt_execute($stmt);
|
else $password ='';
|
||||||
|
if ($username!='' || $password!='')
|
||||||
$result = mysqli_stmt_get_result($stmt);
|
{
|
||||||
if ($row = mysqli_fetch_assoc($result)) {
|
$stmt = mysqli_prepare($conn,"select * from user where username=? and password=?");
|
||||||
// Simpan session dengan nama yang benar
|
$enc=md5($password);
|
||||||
$_SESSION['firstname'] = $row['firstname'];
|
mysqli_stmt_bind_param($stmt,"ss", $username,$enc);
|
||||||
$_SESSION['lastname'] = $row['lastname'];
|
mysqli_stmt_execute($stmt);
|
||||||
|
|
||||||
// Jika request AJAX, kembalikan JSON, jika bukan, redirect ke dashboard
|
$result = mysqli_stmt_get_result($stmt);
|
||||||
$isAjax = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest';
|
if ($row=mysqli_fetch_assoc($result))
|
||||||
if ($isAjax) {
|
{
|
||||||
header('Content-Type: application/json');
|
echo "Login sukses";
|
||||||
echo json_encode(['success' => true, 'message' => 'Login sukses']);
|
$_session['firstname'] = $row['firstname']; //simpan session firstname
|
||||||
exit;
|
$_session['lastname'] = $row['lastname'];
|
||||||
} else {
|
header("Location:dashboard.php"); //untuk pindah ke halaman dashboard.php
|
||||||
header("Location: dashboard.php");
|
|
||||||
exit;
|
echo "firstname:".$row['firstname']."<br>";//kalo di file yang sama
|
||||||
}
|
echo "lastname:".$row['lastname']."<br>";
|
||||||
} else {
|
}
|
||||||
$isAjax = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest';
|
else echo "Username/password salah";
|
||||||
if ($isAjax) {
|
|
||||||
header('Content-Type: application/json');
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Username/password salah']);
|
|
||||||
exit;
|
|
||||||
} else {
|
|
||||||
echo "Username/password salah";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!doctype html>
|
|
||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
@ -53,32 +42,4 @@ if ($username != '' && $password != '') {
|
|||||||
<input type="submit">
|
<input type="submit">
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
=======
|
|
||||||
include "koneksi.php";
|
|
||||||
|
|
||||||
$username = $_POST['username'];
|
|
||||||
$password = $_POST['password'];
|
|
||||||
|
|
||||||
$query = mysqli_query($conn, "SELECT * FROM users WHERE username='$username'");
|
|
||||||
$user = mysqli_fetch_assoc($query);
|
|
||||||
|
|
||||||
if (!$user) {
|
|
||||||
echo json_encode(["status" => "error", "msg" => "Username tidak ditemukan"]);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($user["password"] !== $password) {
|
|
||||||
echo json_encode(["status" => "error", "msg" => "Password salah"]);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo json_encode([
|
|
||||||
"status" => "success",
|
|
||||||
"id" => $user["id"],
|
|
||||||
"username" => $user["username"],
|
|
||||||
"email" => $user["email"],
|
|
||||||
"role" => $user["role"]
|
|
||||||
]);
|
|
||||||
?>
|
|
||||||
>>>>>>> 034e71546358d1709edc3df62da8342c7a9fa647
|
|
||||||
Loading…
x
Reference in New Issue
Block a user