안효원 안효원 2022-01-13
login add
@c06b296f1300f820a84fcb5e16170689e4d339ec
 
20220113/login.php (added)
+++ 20220113/login.php
@@ -0,0 +1,36 @@
+<!doctype html>
+<html lang="ko">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport"
+          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+    <title>Document</title>
+    <style>
+        #page {margin: 0 auto; width: 360px; background-color: antiquewhite; text-align: center; position: relative; top: 100px;}
+        .send {width: 100%; height: 4em;}
+        form {position: relative; left: 65px;}
+    </style>
+</head>
+<body>
+    <div id="page">
+        <h2>Login</h2>
+        <hr>
+        <form action="loginBack.php" method="post">
+            <table border="1">
+                <tr>
+                    <td><label for="id">ID : </label></td>
+                    <td><input type="text" name="userId" id="id"></td>
+                </tr>
+                <tr>
+                    <td><label for="pw">P/W : </label></td>
+                    <td><input type="password" name="userPw" id="pw"></td>
+                </tr>
+                <tr>
+                    <td colspan="2"><input type="submit" value="Login" class="send"></td>
+                </tr>
+            </table>
+        </form>
+    </div>
+</body>
+</html>(No newline at end of file)
 
20220113/loginBack.php (added)
+++ 20220113/loginBack.php
@@ -0,0 +1,24 @@
+<?php
+    $userId = $_POST["userId"];
+    $userPw = $_POST["userPw"];
+
+    $id = "test";
+    $pw = "1234";
+
+    $result = "";
+
+    if($userId == $id && $userPw == $pw){
+        $result = "true";
+    }else{
+        $result = "false";
+    }
+
+    if($result == "true"){
+        echo "<script>document.location.href='success.php'</script>";
+    }else{
+        echo "<script>alert('Login Fail!')</script>";
+        echo "<script>document.location.href='login.php'</script>";
+    }
+
+
+
 
20220113/success.php (added)
+++ 20220113/success.php
@@ -0,0 +1,14 @@
+<!doctype html>
+<html lang="ko">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport"
+          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+    <title>Document</title>
+</head>
+<body>
+    <h1>Login Success!!!</h1>
+    <button onclick="document.location.href='login.php'">돌아가기</button>
+</body>
+</html>
Add a comment
List