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