From 280f6d0639c157d5a6163f962e0f77dc62001dd3 Mon Sep 17 00:00:00 2001 From: Matthew Florentino Date: Fri, 28 Nov 2025 11:45:35 +0700 Subject: [PATCH] fix: fitur register --- src/css/style.css | 36 +++++++++++++++++++++++++++++------- src/register.php | 35 ++++++++++++++++------------------- 2 files changed, 45 insertions(+), 26 deletions(-) diff --git a/src/css/style.css b/src/css/style.css index f87a6fe..da2a1f6 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -171,13 +171,35 @@ align-content: center; } -.container-board table { - margin: 0 auto; +.container-board .board table { + width: 600px; + margin: 40px auto; + border-collapse: collapse; + /*menghilangkan gap antar border*/ + font-family: "Segoe UI", Tahoma, sans-serif; + color: white; border-radius: 10px; - width: 400px; - border: 1px solid; - height: 40px; - align-content: center; + overflow: hidden; +} + +.container-board .board table th, +td { + border: 5px solid #ffffffb8; + padding: 14px 18px; + white-space: nowrap; + text-align: center; +} + +.container-board .board table thead th { + font-weight: 400; + font-size: 20px; + color: #bbd000; + letter-spacing: .4px; +} + + +.container-board .board table tbody tr:hover { + background: #c1fc0032; } .container-onboard { @@ -192,7 +214,7 @@ background-size: cover; */ } -.container-onboard h1{ +.container-onboard h1 { font-size: 150px; color: yellow; font-weight: 400; diff --git a/src/register.php b/src/register.php index 1120b0e..c13a336 100644 --- a/src/register.php +++ b/src/register.php @@ -14,14 +14,14 @@ if(isset($_POST['register'])){ $rpassword = $_POST['rpassword']; if(empty($email) || empty($username) || empty($password)){ - $pesan_gagal= "Semua data harus terisi"; + $_SESSION['flash'] = "Semua data harus terisi"; }else if($password !== $rpassword){ - $pesan_gagal= "password tidak sama"; + $_SESSION['flash']= "password tidak sama"; } else{ $hashpw = password_hash($password, PASSWORD_DEFAULT); - $sql = "INSERT INTO users (email,username,password)VALUES(?,?,?)"; + $sql = "INSERT INTO users (email,username,password,score)VALUES(?,?,?,0)"; $stmt = $db -> prepare($sql); @@ -30,26 +30,14 @@ if(isset($_POST['register'])){ if($stmt->execute()){ - $new_user_id =$db-> insert_id; - - $sql_char = "INSERT INTO users (user_id, name, score) VALUES (?, ?, 0)"; + header("location:index.php"); + exit(); - $stmt_char = $db->prepare($sql_char); - $stmt_char->bind_param("is", $new_user_id, $username); - - if($stmt_char->execute()){ - header("location:index.php"); - exit(); - }else{ - $pesan_gagal = "Registrasi user berhasil, tapi gagal membuat karakter: " . $stmt_char->error; - } - $stmt_char->close(); - }else{ if($stmt->erno==1602){ - $pesan_gagal = "email atau username sudah pernah terdaftar"; + $_SESSION['flash'] = "email atau username sudah pernah terdaftar"; }else{ - $pesan_sukses = "Regitrasi gagal: ".$stmt->error; + $_SESSION['flash'] = "Regitrasi gagal: ".$stmt->error; } } $stmt -> close(); @@ -70,6 +58,15 @@ if(isset($_POST['register'])){
+ showNotif(" . json_encode($_SESSION['flash']) . ");"; + unset($_SESSION['flash']); + } + ?> +

codebeater

Register to get account