+++ 20220113/login.php
... | ... | @@ -0,0 +1,36 @@ |
1 | +<!doctype html> | |
2 | +<html lang="ko"> | |
3 | +<head> | |
4 | + <meta charset="UTF-8"> | |
5 | + <meta name="viewport" | |
6 | + content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> | |
7 | + <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
8 | + <title>Document</title> | |
9 | + <style> | |
10 | + #page {margin: 0 auto; width: 360px; background-color: antiquewhite; text-align: center; position: relative; top: 100px;} | |
11 | + .send {width: 100%; height: 4em;} | |
12 | + form {position: relative; left: 65px;} | |
13 | + </style> | |
14 | +</head> | |
15 | +<body> | |
16 | + <div id="page"> | |
17 | + <h2>Login</h2> | |
18 | + <hr> | |
19 | + <form action="loginBack.php" method="post"> | |
20 | + <table border="1"> | |
21 | + <tr> | |
22 | + <td><label for="id">ID : </label></td> | |
23 | + <td><input type="text" name="userId" id="id"></td> | |
24 | + </tr> | |
25 | + <tr> | |
26 | + <td><label for="pw">P/W : </label></td> | |
27 | + <td><input type="password" name="userPw" id="pw"></td> | |
28 | + </tr> | |
29 | + <tr> | |
30 | + <td colspan="2"><input type="submit" value="Login" class="send"></td> | |
31 | + </tr> | |
32 | + </table> | |
33 | + </form> | |
34 | + </div> | |
35 | +</body> | |
36 | +</html>(No newline at end of file) |
+++ 20220113/loginBack.php
... | ... | @@ -0,0 +1,24 @@ |
1 | +<?php | |
2 | + $userId = $_POST["userId"]; | |
3 | + $userPw = $_POST["userPw"]; | |
4 | + | |
5 | + $id = "test"; | |
6 | + $pw = "1234"; | |
7 | + | |
8 | + $result = ""; | |
9 | + | |
10 | + if($userId == $id && $userPw == $pw){ | |
11 | + $result = "true"; | |
12 | + }else{ | |
13 | + $result = "false"; | |
14 | + } | |
15 | + | |
16 | + if($result == "true"){ | |
17 | + echo "<script>document.location.href='success.php'</script>"; | |
18 | + }else{ | |
19 | + echo "<script>alert('Login Fail!')</script>"; | |
20 | + echo "<script>document.location.href='login.php'</script>"; | |
21 | + } | |
22 | + | |
23 | + | |
24 | + |
+++ 20220113/success.php
... | ... | @@ -0,0 +1,14 @@ |
1 | +<!doctype html> | |
2 | +<html lang="ko"> | |
3 | +<head> | |
4 | + <meta charset="UTF-8"> | |
5 | + <meta name="viewport" | |
6 | + content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> | |
7 | + <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
8 | + <title>Document</title> | |
9 | +</head> | |
10 | +<body> | |
11 | + <h1>Login Success!!!</h1> | |
12 | + <button onclick="document.location.href='login.php'">돌아가기</button> | |
13 | +</body> | |
14 | +</html> |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?