자바스크립트로 로그인 기능 구현하기
7.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script>
password = prompt("비밀번호");
if(password == 1111) {
document.write("안녕하세요. 주인님");
} else {
document.write("뉘신지?");
}
</script>
</body>
</html>
PHP로 로그인 기능 구현하기
8-1.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<form action="8-2.php">
<p>비밀번호를 입력해주세요.</p>
<input type="text" name="password">
<input type="submit">
</form>
</body>
</html>
8-2.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<?php
$password = $_GET["password"];
if($password == "1111"){
echo "주인님 환영합니다";
} else {
echo "뉘신지?";
}
?>
</body>
</html>
소스코드
github