Created
July 10, 2018 09:51
-
-
Save tkdgma0724/1fd5713fce19491a6b3b6554b56d4b61 to your computer and use it in GitHub Desktop.
html login form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8" /> | |
<form method='post' action='login_ok.php'> | |
<table> | |
<tr> | |
<td>아이디</td> | |
<td><input type='text' name='user_id' tabindex='1'/></td> | |
<td rowspan='2'><input type='submit' tabindex='3' value='로그인' style='height:50px'/></td> | |
</tr> | |
<tr> | |
<td>비밀번호</td> | |
<td><input type='password' name='user_pw' tabindex='2'/></td> | |
</tr> | |
</table> | |
</form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8" /> | |
<form method='post' action='login_ok.php'> | |
<table> | |
<tr> | |
<td>아이디</td> | |
<td><input type='text' name='user_id' tabindex='1'/></td> | |
<td rowspan='2'><input type='submit' tabindex='3' value='로그인' style='height:50px'/></td> | |
</tr> | |
<tr> | |
<td>비밀번호</td> | |
<td><input type='password' name='user_pw' tabindex='2'/></td> | |
</tr> | |
</table> | |
</form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(!isset($_POST['user_id']) || !isset($_POST['user_pw'])) exit; | |
$user_id = $_POST['user_id']; | |
$user_pw = $_POST['user_pw']; | |
$members = array('user1'=>array('pw'=>'pw1', 'name'=>'윤상흠'), | |
'user2'=>array('pw'=>'pw2', 'name'=>'이지연'), | |
'user3'=>array('pw'=>'pw3', 'name'=>'박태호')); | |
if(!isset($members[$user_id])) { | |
echo "<script>alert('아이디 또는 패스워드가 잘못되었습니다.');history.back();</script>"; | |
exit; | |
} | |
if($members[$user_id]['pw'] != $user_pw) { | |
echo "<script>alert('아이디 또는 패스워드가 잘못되었습니다.');history.back();</script>"; | |
exit; | |
} | |
$_SESSION['user_id'] = $user_id; | |
$_SESSION['user_name'] = $members[$user_id]['name']; | |
?> | |
<meta http-equiv='refresh' content='0;url=main.php'> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
location.href='./index.php'; | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8" /> | |
<?php | |
$user_id = $_SESSION['user_id']; | |
$user_name = $_SESSION['user_name']; | |
echo "<p>안녕하세요. $user_name(윤상흠)님</p>"; | |
echo "<p><a href='logout.php'>로그아웃</a></p>"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment