🔓데이터베이스/쇼핑몰 프로젝트

쇼핑몰 만들기

하얀성 2023. 12. 10. 11:49

참고: notepad++ 말고, vscode로 작업했습니다. (문서가 많아지면 관리가 어려워서 바꿨습니다. ) 

 

- 초기화면: 2점

(사용자로 들어가면 라면을 쇼핑하는 창이 나온다. 후기를 볼 수 있는 페이지와 버튼으로 연결했다.)

(라면 목록만 확인 가능할뿐 상세보기는 불가한 페이지다. 아래에 라면리스트로 이동해서 상세정보 확인 가능한 라면 리스트로 안내한다.)

 

<?php //home.php

$conn = mysqli_connect('localhost','root','apmsetup','shop_db');

session_start();

$user_id = $_SESSION['user_id'];

if(!isset($user_id)){
   header('location:login.php');
}

if(isset($_POST['add_to_cart'])){

   $product_name = $_POST['product_name'];
   $product_price = $_POST['product_price'];
   $product_image = $_POST['product_image'];
   $product_quantity = $_POST['product_quantity'];

   $check_cart_numbers = mysqli_query($conn, "SELECT * FROM `cart` WHERE name = '$product_name' AND user_id = '$user_id'");

   if(mysqli_num_rows($check_cart_numbers) > 0){
      $message[] = '이미 장바구니에 있습니다!';
   }else{
      mysqli_query($conn, "INSERT INTO `cart`(user_id, name, price, quantity, image) VALUES('$user_id', '$product_name', '$product_price', '$product_quantity', '$product_image')");
      $message[] = '상품이 장바구니에 담겼습니다!';
   }

}

?>

<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <title>메인 페이지</title>

   <!-- font awesome cdn link  -->

   <!-- custom css file link  -->
   <link rel="stylesheet" href="css/style.css">
   <style>
      .announcement {
      background: #fff;
      border: 1px solid #ccc;
      padding: 10px;
      box-shadow: 0 2px 5px rgba(0,0,0,0.2);
      max-width: 300px; /* 공지사항의 최대 너비 */
   }

   .announcement .post h3 {
      margin-bottom: 5px;
      font-size: 2.9rem;
   }

   .announcement .post p {
      font-size: 2.9rem;
      color: red;
      font-weight: bold;
   }
   </style>
</head>
<body>
   
<?php include 'header.php'; ?>

<section class="home">

   <div class="content">
      <h3>라면을 원하는대로 마음껏 집어보세요! </h3>
      <p>우리는 유통마진은 싹 빼면서, 빠르고 안전하게 라면을 배송해 드립니다.</p>
      <a href="about.php" class="white-btn">후기 보러 가기</a>
   </div>
   <section class="announcement" style="position: absolute; top: 300px; left: 100px; z-index: 10;">
    <?php
    $select_posts = mysqli_query($conn, "SELECT * FROM `posts` ORDER BY created_at DESC LIMIT 1");
    if($post = mysqli_fetch_assoc($select_posts)){
        echo "<div class='post'>";
        echo "<h3>" . htmlspecialchars($post['title']) . "</h3>";
        echo "<p>" . nl2br(htmlspecialchars($post['content'])) . "</p>";
        echo "</div>";
    }
    ?>
</section>
</section>

<section class="products">

   <h1 class="title">라면 빠르게 사기</h1>

   <div class="box-container">

      <?php  
         $select_products = mysqli_query($conn, "SELECT * FROM `products` LIMIT 6") or die('query failed');
         if(mysqli_num_rows($select_products) > 0){
            while($fetch_products = mysqli_fetch_assoc($select_products)){
      ?>
     <form action="" method="post" class="box">
      <img class="image" src="photo/<?php echo $fetch_products['image']; ?>" alt="">
      <div class="name"><?php echo $fetch_products['name']; ?></div>
      <div class="price">최저<?php echo $fetch_products['price']; ?>원 + 10포인트</div>
      <input type="number" min="1" name="product_quantity" value="1" class="qty">
      <input type="hidden" name="product_name" value="<?php echo $fetch_products['name']; ?>">
      <input type="hidden" name="product_price" value="<?php echo $fetch_products['price']; ?>">
      <input type="hidden" name="product_image" value="<?php echo $fetch_products['image']; ?>">
      <input type="submit" value="장바구니 담기" name="add_to_cart" class="btn">
     </form>
      <?php
         }
      }else{
         echo '<p class="empty">아직 상품이 담기지 않았습니다!</p>';
      }
      ?>
   </div>

   <div class="load-more" style="margin-top: 2rem; text-align:center">
      <a href="shop.php" class="option-btn">라면들 상세정보 보러가기</a>
   </div>

</section>





<?php include 'footer.php'; ?>

<!-- custom js file link  -->
<script src="js/script.js"></script>

</body>
</html>

 

header.php

<header class="header">

   <div class="header-1">
      <div class="flex">
         <div class="share">
            <a href="#" class="fab fa-facebook-f"></a>
            <a href="#" class="fab fa-instagram"></a>
         </div>
         <p> <a href="login.php">login 다시하기</a> | <a href="register.php">신규가입</a> </p>
      </div>
   </div>

   <div class="header-2">
      <div class="flex">
         <a href="home.php" class="logo">elecch</a>

         <nav class="navbar">
            <a href="home.php"></a>
            <a href="about.php">elecch?</a>
            <a href="shop.php">라면리스트</a>
            <a href="orders.php">주문확인</a>
         </nav>

         <div class="icons">
            <div id="menu-btn" class="fas fa-bars"></div>
            <a href="search_page.php" class="fas fa-search"></a>
            <div id="user-btn" class="fas fa-user"></div>
            <?php
               $select_cart_number = mysqli_query($conn, "SELECT * FROM `cart` WHERE user_id = '$user_id'");
               $cart_rows_number = mysqli_num_rows($select_cart_number);
            ?>
            <a href="cart.php"> <i class="fas fa-shopping-cart"></i> <span>(<?php echo $cart_rows_number; ?>)</span> </a>
         </div>

         <div class="user-box">
            <p>닉네임 : <span><?php echo $_SESSION['user_name']; ?></span></p>
            <p>email : <span><?php echo $_SESSION['user_email']; ?></span></p>
            <a href="logout.php" class="delete-btn">로그아웃</a>
         </div>
      </div>
   </div>

</header>

 

footer.php


<section class="footer">
   <div class="box-container">

      <div class="box">
         <h3>links</h3>
         <a href="home.php">홈페이지</a>
         <a href="about.php">회사소개</a>
      </div>

      <div class="box">
         <h3>쇼핑</h3>
         <a href="cart.php">장바구니 담기</a>
         <a href="orders.php">주문하기</a>
      </div>

      <div class="box">
         <h3>사업문의</h3>
         <p> <i class="fas fa-phone"></i> +111-222-3333 </p>
         <p> <i class="fas fa-envelope"></i> 20151020@changwon.ac.kr</p>
      </div>

      <div class="box">
         <h3>주소</h3>
         <a href="#"> <i class="fab fa-facebook-f"></i> facebook </a>
         <a href="#"> <i class="fab fa-instagram"></i> instagram </a>
      </div>

   </div>

   <p class="credit"> copyright@<?php echo date('Y'); ?>  <span>20151020 박찬홍</span> </p>

</section>

- 관리자 페이지: 3점,

(상품등록, 수정, 삭제 모두 가능하다.)

 

admin_header.php

<header class="header">

   <div class="flex">

      <a href="admin_products.php" class="logo"><span>관리자페이지</span></a>

      <nav class="navbar">
         <a href="admin_products.php">상품등록 & 리스트</a>
         <a href="admin_users.php">유저관리</a>
         <a href="admin_orders.php">주문관리</a>
         <a href="admin_post.php">공지관리</a>
      </nav>

      <div class="icons">
         <div id="menu-btn" class="fas fa-bars"></div>
         <div id="user-btn" class="fas fa-user"></div>
      </div>

      <div class="account-box">
         <p>유저이름 : <span><?php echo $_SESSION['admin_name']; ?></span></p>
         <p>email : <span><?php echo $_SESSION['admin_email']; ?></span></p>
         <a href="logout.php" class="delete-btn">로그아웃</a>
         <div><a href="login.php">login</a> | <a href="register.php">신규가입</a></div>
      </div>

   </div>

</header>

 

admin_products.php

<?php

$conn = mysqli_connect('localhost','root','apmsetup','shop_db');

session_start();

$admin_id = $_SESSION['admin_id'];

if(!isset($admin_id)){
   header('location:login.php');
};

if(isset($_POST['add_product'])){

   $name = mysqli_real_escape_string($conn, $_POST['name']);
   $price = $_POST['price'];
   $image = $_FILES['image']['name'];
   $image_size = $_FILES['image']['size'];
   $image_tmp_name = $_FILES['image']['tmp_name'];
   $image_folder = 'photo/'.$image;
   $video_url = mysqli_real_escape_string($conn, $_POST['video_url']);
   $description = mysqli_real_escape_string($conn, $_POST['description']);

   
   



   $select_product_name = mysqli_query($conn, "SELECT name FROM `products` WHERE name = '$name'");

   if(mysqli_num_rows($select_product_name) > 0){
      $message[] = '이미 추가된 상품 이름입니다.';
   }else{
      $add_product_query = mysqli_query($conn, "INSERT INTO `products`(name, price, image, video_url, description) VALUES('$name', '$price', '$image', '$video_url', '$description')");
     
      if($add_product_query){
         if($image_size > 2000000){
            $message[] = '이미지 크기가 너무 큽니다.';
         }else{
            move_uploaded_file($image_tmp_name, $image_folder);
            $message[] = '상품이 추가되었습니다';
         }
      }else{
         $message[] = '상품을 추가할 수 없습니다.';
      }
   }
}

if(isset($_GET['delete'])){
   $delete_id = $_GET['delete'];
   $delete_image_query = mysqli_query($conn, "SELECT image FROM `products` WHERE id = '$delete_id'");
   $fetch_delete_image = mysqli_fetch_assoc($delete_image_query);
   unlink('photo/'.$fetch_delete_image['image']);
   mysqli_query($conn, "DELETE FROM `products` WHERE id = '$delete_id'");
   header('location:admin_products.php');
}

if(isset($_POST['update_product'])){

   $update_p_id = $_POST['update_p_id'];
   $update_name = $_POST['update_name'];
   $update_price = $_POST['update_price'];

   mysqli_query($conn, "UPDATE `products` SET name = '$update_name', price = '$update_price', video_url = '$update_video_url', description = '$update_description' WHERE id = '$update_p_id'");
   $update_image = $_FILES['update_image']['name'];
   $update_image_tmp_name = $_FILES['update_image']['tmp_name'];
   $update_image_size = $_FILES['update_image']['size'];
   $update_folder = 'photo/'.$update_image;
   $update_video_url = mysqli_real_escape_string($conn, $_POST['update_video_url']);
   $update_old_image = $_POST['update_old_image'];
   $update_description = mysqli_real_escape_string($conn, $_POST['update_description']);


   


   if(!empty($update_image)){
      if($update_image_size > 2000000){
         $message[] = '이미지 파일이 너무큽니다.';
      }else{
         mysqli_query($conn, "UPDATE `products` SET image = '$update_image' WHERE id = '$update_p_id'");
         move_uploaded_file($update_image_tmp_name, $update_folder);
         unlink('photo/'.$update_old_image);
      }
   }

   header('location:admin_products.php');

}

?>

<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <title>상품 목록</title>


   <link rel="stylesheet" href="css/admin_style.css">

</head>
<body>
   
<?php include 'admin_header.php'; ?>



<section class="add-products">

   <h1 class="title">상품 등록</h1>

   <form action="" method="post" enctype="multipart/form-data">
      <h3>상품 추가</h3>
      <input type="text" name="name" class="box" placeholder="상품 이름 추가" required>
      <input type="number" min="0" name="price" class="box" placeholder="상품 가격 추가" required>
      <textarea name="description" class="box" required placeholder="상품 설명 추가"></textarea>
      <input type="file" name="image" accept="image/jpg, image/jpeg, image/png" class="box" required>
      <input type="text" name="video_url" class="box" placeholder="상품 동영상 URL 추가" required>
      <input type="submit" value="상품 추가" name="add_product" class="btn">
   </form>

</section>



<section class="show-products">

   <div class="box-container">

      <?php
         $select_products = mysqli_query($conn, "SELECT * FROM `products`");
         if(mysqli_num_rows($select_products) > 0){
            while($fetch_products = mysqli_fetch_assoc($select_products)){
      ?>
      <div class="box">
         <img src="photo/<?php echo $fetch_products['image']; ?>" alt="">
         <div class="name"><?php echo $fetch_products['name']; ?></div>
         <div class="price">최저 <?php echo $fetch_products['price']; ?>원 / 포인트 10점 </div>
         <p class="description"><?php echo substr($fetch_products['description'], 0, 50) . '...'; ?></p>
         <a href="admin_products.php?update=<?php echo $fetch_products['id']; ?>" class="option-btn">수정</a>
         <a href="admin_products.php?delete=<?php echo $fetch_products['id']; ?>" class="delete-btn" onclick="return confirm('delete this product?');">취소</a>
      </div>
      <?php
         }
      }else{
         echo '<p class="empty">상품이 추가되지 않았습니다.</p>';
      }
      ?>
   </div>

</section>

<section class="edit-product-form">

   <?php
      if(isset($_GET['update'])){
         $update_id = $_GET['update'];
         $update_query = mysqli_query($conn, "SELECT * FROM `products` WHERE id = '$update_id'");
         if(mysqli_num_rows($update_query) > 0){
            while($fetch_update = mysqli_fetch_assoc($update_query)){
   ?>
   <form action="" method="post" enctype="multipart/form-data">
      <input type="hidden" name="update_p_id" value="<?php echo $fetch_update['id']; ?>">
      <input type="hidden" name="update_old_image" value="<?php echo $fetch_update['image']; ?>">
      <img src="photo/<?php echo $fetch_update['image']; ?>" alt="">
      <input type="text" name="update_name" value="<?php echo $fetch_update['name']; ?>" class="box" required placeholder="상품 이름 추가">
      <input type="number" name="update_price" value="<?php echo $fetch_update['price']; ?>" min="0" class="box" required placeholder="상품 가격 추가">
      <textarea name="update_description" class="box" required placeholder="상품 설명 수정"><?php echo $fetch_update['description']; ?></textarea>
      <input type="file" class="box" name="update_image" accept="image/jpg, image/jpeg, image/png">
      <input type="text" name="update_video_url" value="<?php echo $fetch_update['video_url']; ?>" class="box" required placeholder="상품 동영상 URL 수정">
      <input type="submit" value="수정" name="update_product" class="btn">
      <input type="reset" value="취소" id="close-update" class="option-btn">
   </form>
   <?php
         }
      }
      }else{
         echo '<script>document.querySelector(".edit-product-form").style.display = "none";</script>';
      }
   ?>

</section>


<!-- custom admin js file link  -->
<script src="js/admin_script.js"></script>

</body>
</html>

 

admin_product_detail.php(상품 상세정보 관리)

<?php
// 라면 상세정보를 가져오는 코드 (데이터베이스 연결 및 쿼리 포함)
$conn = mysqli_connect('localhost','root','apmsetup','shop_db');

// 상품 ID가 URL을 통해 전달되었는지 확인
if(isset($_GET['id'])){
   $product_id = $_GET['id'];
   $product_details_query = mysqli_query($conn, "SELECT * FROM `products` WHERE id = '$product_id'");
   if(mysqli_num_rows($product_details_query) == 1){
      $fetch_details = mysqli_fetch_assoc($product_details_query);
   } else {
      header('location:admin_products.php');
      exit;
   }
} else {
   header('location:admin_products.php');
   exit;
}


?>

<!DOCTYPE html>
<html lang="ko">
<head>
   <meta charset="UTF-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <title>라면 상세 정보</title>
   <!-- 나머지 head 내용 -->
</head>
<body>
   
<section class="ramen-detail">
   <div class="container">
      <h2 class="title"><?php echo $fetch_details['name']; ?></h2>
      <div class="ramen-image">
         
      <a href="<?php echo $fetch_products['video_url']; ?>" target="_blank" class="option-btn">동영상 보기</a>
         <img src="photo/<?php echo $fetch_details['image']; ?>" alt="<?php echo $fetch_details['name']; ?>">
      </div>
      <div class="ramen-description">
         <p>가격: <?php echo $fetch_details['price']; ?></p>
         <p class="description"><?php echo $fetch_details['description']; ?></p>
      </div>
      <div class="ramen-video">
         <iframe width="560" height="315" src="<?php echo $video_url; ?>" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
      </div>
   </div>
</section>


</body>
</html>

 

admin_users.php (유저 관리페이지)

<?php

$conn = mysqli_connect('localhost','root','apmsetup','shop_db');

session_start();

$admin_id = $_SESSION['admin_id'];

if(!isset($admin_id)){
   header('location:login.php');
}

if(isset($_GET['delete'])){
   $delete_id = $_GET['delete'];
   mysqli_query($conn, "DELETE FROM `users` WHERE id = '$delete_id'") or die('query failed');
   header('location:admin_users.php');
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <title>users</title>

   <!-- font awesome cdn link  -->

   <!-- custom admin css file link  -->
   <link rel="stylesheet" href="css/admin_style.css">

</head>
<body>
   
<?php include 'admin_header.php'; ?>

<section class="users">

   <h1 class="title"> 사용자 계정목록</h1>

   <div class="box-container">
      <?php
         $select_users = mysqli_query($conn, "SELECT * FROM `users`");
         while($fetch_users = mysqli_fetch_assoc($select_users)){
      ?>
      <div class="box">
         <p> 유저 넘버 : <span><?php echo $fetch_users['id']; ?></span> </p>
         <p> 아이디 : <span><?php echo $fetch_users['name']; ?></span> </p>
         <p> email : <span><?php echo $fetch_users['email']; ?></span> </p>
         <p> 가입 유형 : <span style="color:<?php if($fetch_users['user_type'] == 'admin'){ echo 'var(--orange)'; } ?>"><?php echo $fetch_users['user_type']; ?></span> </p>
         <a href="admin_users.php?delete=<?php echo $fetch_users['id']; ?>" onclick="return confirm('삭제하시겠습니까?');" class="delete-btn">삭제</a>
      </div>
      <?php
         };
      ?>
   </div>

</section>



<!-- custom admin js file link  -->
<script src="js/admin_script.js"></script>

</body>
</html>

 

admin_orders.php(주문확인, 포인트 확인)

<?php

$conn = mysqli_connect('localhost','root','apmsetup','shop_db');

session_start();

$admin_id = $_SESSION['admin_id'];

if(!isset($admin_id)){
   header('location:login.php');
}

if(isset($_POST['update_order'])){
   $order_update_id = $_POST['order_id'];
   $update_payment = $_POST['update_payment'];

   // 주문의 총 상품 수를 가져옵니다.
   $order_query = mysqli_query($conn, "SELECT total_products FROM `orders` WHERE id = '$order_update_id'");
   $order_data = mysqli_fetch_assoc($order_query);
   $total_products_str = $order_data['total_products'];

   // 상품 수량을 파싱합니다. "1x2,2x1,3x4" 형태의 문자열을 예로 듭니다.
   $product_quantities = explode(',', $total_products_str); // 각 상품 분리
   $total_quantity = 10;

   foreach ($product_quantities as $product_quantity) {
       $parts = explode('x', $product_quantity); // 상품 ID와 수량 분리
       $quantity = (int)$parts[1]; // 수량 추출
       $total_quantity += ($quantity+10); // 총 수량에 추가
   }

   // 포인트를 계산합니다.
   $points = $total_quantity;

   // 결제 상태와 포인트를 업데이트합니다.
   mysqli_query($conn, "UPDATE `orders` SET payment_status = '$update_payment', points = '$points' WHERE id = '$order_update_id'");
   $message[] = ' 결제 상태가 변경되었습니다!';
}

if(isset($_GET['delete'])){
   $delete_id = $_GET['delete'];
   mysqli_query($conn, "DELETE FROM `orders` WHERE id = '$delete_id'");
   header('location:admin_orders.php');
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <title>orders</title>

   <!-- font awesome cdn link  -->

   <!-- custom admin css file link  -->
   <link rel="stylesheet" href="css/admin_style.css">

</head>
<body>
   
<?php include 'admin_header.php'; ?>

<section class="orders">

   <h1 class="title">총 주문목록</h1>

   <div class="box-container">
      <?php
      $select_orders = mysqli_query($conn, "SELECT * FROM `orders`");
      if(mysqli_num_rows($select_orders) > 0){
         while($fetch_orders = mysqli_fetch_assoc($select_orders)){
      ?>
      <div class="box">
         <p> 유저 넘버 : <span><?php echo $fetch_orders['user_id']; ?></span> </p>
         <p> 주문날짜 : <span><?php echo $fetch_orders['placed_on']; ?></span> </p>
         <p> 닉네임 : <span><?php echo $fetch_orders['name']; ?></span> </p>
         <p> 전화번호 : <span><?php echo $fetch_orders['number']; ?></span> </p>
         <p> email : <span><?php echo $fetch_orders['email']; ?></span> </p>
         <p> 배송지 : <span><?php echo $fetch_orders['address']; ?></span> </p>
         <p> 주문 정보 : <span><?php echo $fetch_orders['total_products']; ?></span> </p>
         <p> 전체 주문가격  : <span><?php echo $fetch_orders['total_price']; ?></span> </p>
         <p> 지불 방식 : <span><?php echo $fetch_orders['method']; ?></span> </p>
         <p> 적립포인트 : <span><?php echo $fetch_orders['points']; ?></span> </p>
         <form action="" method="post">
            <input type="hidden" name="order_id" value="<?php echo $fetch_orders['id']; ?>">
            <select name="update_payment">
               <option value="" selected disabled><?php echo $fetch_orders['payment_status']; ?></option>
               <option value="미결제">미결제</option>
               <option value="결제완료">결제완료</option>
            </select>
            <input type="submit" value="수정" name="update_order" class="option-btn">
            <a href="admin_orders.php?delete=<?php echo $fetch_orders['id']; ?>" onclick="return confirm('주문을 제거하실건가요?');" class="delete-btn">삭제</a>
         </form>
      </div>
      <?php
         }
      }else{
         echo '<p class="empty">아직 주문이 없어요</p>';
      }
      ?>
   </div>

</section>


<!-- custom admin js file link  -->
<script src="js/admin_script.js"></script>

</body>
</html>

 

admin_post.php(관리자 공지설정란)

<?php
$conn = mysqli_connect('localhost','root','apmsetup','shop_db');

session_start();

$admin_id = $_SESSION['admin_id'];

if(!isset($admin_id)){
   header('location:login.php');
}

if(isset($_POST['update_post'])){
    $title = mysqli_real_escape_string($conn, $_POST['title']);
    $content = mysqli_real_escape_string($conn, $_POST['content']);

    // 공지사항을 posts 테이블에 추가합니다.
    mysqli_query($conn, "INSERT INTO posts (title, content) VALUES ('$title', '$content')");
    // 추가적인 확인 필요: 오류 처리, 성공 메시지 등
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <!-- font awesome cdn link  -->

    <!-- custom admin css file link  -->
    <link rel="stylesheet" href="css/admin_style.css">
    <style>
        /* admin_style.css */

/* 공지사항 업데이트 폼 기본 스타일 */
.update-post-form {
    width: 100%; /* 전체 너비 사용 */
    max-width: 700px; /* 최대 너비 설정 */
    margin: 30px auto; /* 상하 30px, 좌우 자동 (가운데 정렬) */
    padding: 20px; /* 내부 여백 */
    background: #fff; /* 배경색 */
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1); /* 그림자 효과 */
    border-radius: 5px; /* 모서리 둥글게 */
}

.update-post-form input[type="text"],
.update-post-form textarea {
    width: 100%; /* 전체 너비 사용 */
    padding: 10px; /* 패딩 */
    margin-bottom: 20px; /* 하단 여백 */
    border: 1px solid #ccc; /* 테두리 */
    border-radius: 5px; /* 모서리 둥글게 */
}

.update-post-form textarea {
    height: 200px; /* 텍스트 영역 높이 */
    resize: vertical; /* 세로 크기 조절 가능 */
}

.update-post-form button {
    padding: 10px 30px; /* 상하 10px, 좌우 30px 패딩 */
    border: none; /* 테두리 없음 */
    background: #333; /* 배경색 */
    color: #fff; /* 글자색 */
    font-size: 16px; /* 글자 크기 */
    cursor: pointer; /* 커서 모양 */
    border-radius: 5px; /* 모서리 둥글게 */
}

.update-post-form button:hover {
    background: #555; /* 호버시 배경색 변경 */
}

    </style>
    <title>공지사항</title>
</head>
<body>
    <?php include 'admin_header.php'; ?>

    <!-- 공지사항 업데이트 폼 -->
    <form action="admin_post.php" method="post" class="update-post-form">
        <input type="text" name="title" placeholder="공지 제목" required>
        <textarea name="content" placeholder="공지 내용" required></textarea>
        <button type="submit" name="update_post">공지 업데이트</button>
    </form>

    <script src="js/admin_script.js"></script>
</body>
</html>

 


'🔓데이터베이스 > 쇼핑몰 프로젝트' 카테고리의 다른 글

쇼핑몰 기능 확인 영상  (0) 2023.12.15
쇼핑몰 만들기(3)  (0) 2023.12.15
쇼핑몰 만들기(2)  (0) 2023.12.15
쇼핑몰 개략도  (0) 2023.12.13
프로젝트 쇼핑몰 만들기  (0) 2023.12.05