리스트 접속 전에 지정된 패스워드로 접근 여부 확인 하려 합니다.
본문
해당 게시판 리스트 접속 전에 디자인 페이지 하나를 만들어 지정된 패스워드를 확인하고자 합니다.
1. 디자인 페이지
<form name="fwrite" method="post" onsubmit="return fwrite_submit(this);" enctype="multipart/form-data" style="margin:0px;">
<input type=hidden name=null>
<table cellspacing="0" cellpadding="0" class="boardview" align="center">
<col width="130" />
<col width="" />
<tr>
<th>비밀번호</th>
<td><INPUT type=password maxLength=20 size=15 name="wr_password" itemname="패스워드" required></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:50px;">
<tr>
<td width="100%" align="center" valign="top" style="padding-top:30px;">
<input type=image id="btn_submit" src="<?=$g4[path]?>/sub/image/btn_search.jpg" border=0 accesskey='s'>
<a href="javascript:history.back()"><img id="btn_list" src="<?=$g4[path]?>/sub/image/btn_cancle.jpg" border=0></a></td>
</tr>
</table>
</form>
<script type="text/javascript">
<!--
function fwrite_submit(f)
{
/*
if (!check_kcaptcha(f.wr_key)) {
return false;
}
*/
<input type=hidden name=null>
<table cellspacing="0" cellpadding="0" class="boardview" align="center">
<col width="130" />
<col width="" />
<tr>
<th>비밀번호</th>
<td><INPUT type=password maxLength=20 size=15 name="wr_password" itemname="패스워드" required></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:50px;">
<tr>
<td width="100%" align="center" valign="top" style="padding-top:30px;">
<input type=image id="btn_submit" src="<?=$g4[path]?>/sub/image/btn_search.jpg" border=0 accesskey='s'>
<a href="javascript:history.back()"><img id="btn_list" src="<?=$g4[path]?>/sub/image/btn_cancle.jpg" border=0></a></td>
</tr>
</table>
</form>
<script type="text/javascript">
<!--
function fwrite_submit(f)
{
/*
if (!check_kcaptcha(f.wr_key)) {
return false;
}
*/
document.getElementById('btn_submit').disabled = true;
document.getElementById('btn_list').disabled = true;
f.target = "hiddenframe";
<?
if ($g4[https_url])
echo "f.action = '$g4[https_url]/sub/board_ok_update.php';";
else
echo "f.action = './board_ok_update.php';";
?>
return true;
}
//-->
</script>
document.getElementById('btn_list').disabled = true;
f.target = "hiddenframe";
<?
if ($g4[https_url])
echo "f.action = '$g4[https_url]/sub/board_ok_update.php';";
else
echo "f.action = './board_ok_update.php';";
?>
return true;
}
//-->
</script>
2. board_ok_update.php
<?
include_once("./_common.php");
include_once("./_common.php");
$bodpassword = '12345';//비번지정
//넘어온비번과 지정한 비번 대조
if ($bodpassword != $password) {
alert("패스워드가 틀립니다.");
} else {
goto_url("./board.php?bo_table=$bo_table");//게시판으로 보냄
}
if ($bodpassword != $password) {
alert("패스워드가 틀립니다.");
} else {
goto_url("./board.php?bo_table=$bo_table");//게시판으로 보냄
}
?>
패스워드 값을 어떻게 넘겨야 할지 모르겠어요
답변 1
폼을 새로 하나 만드셔야 될겁니다.
list.skin.php 페이지에
//$wr_password2 값은 서밋하면 값이 암호화 되니까 원하는 암호란에 확인하시고 기재
// 원하는 암호로 회원가입된 db 정보보면 알 수 있을 거예요
<? if(!$wr_password2 or $wr_password2 == "원하는 암호" ) { // 패스워드가 없다면 아래 출력?>
<form name="fwrite2" method="post">
<input type=hidden name=null>
<table cellspacing="0" cellpadding="0" class="boardview" align="center">
<col width="130" />
<col width="" />
<tr>
<th>비밀번호</th>
<td><INPUT type=password maxLength=20 size=15 name="wr_password2" itemname="패스워드" required></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:50px;">
<tr>
<td width="100%" align="center" valign="top" style="padding-top:30px;">
<input type=image id="btn_submit2" src="<?=$g4[path]?>/sub/image/btn_search.jpg" border=0 accesskey='s'>
<a href="javascript:history.back()"><img id="btn_list" src="<?=$g4[path]?>/sub/image/btn_cancle.jpg" border=0></a></td>
</tr>
</table>
</form>
<input type=hidden name=null>
<table cellspacing="0" cellpadding="0" class="boardview" align="center">
<col width="130" />
<col width="" />
<tr>
<th>비밀번호</th>
<td><INPUT type=password maxLength=20 size=15 name="wr_password2" itemname="패스워드" required></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:50px;">
<tr>
<td width="100%" align="center" valign="top" style="padding-top:30px;">
<input type=image id="btn_submit2" src="<?=$g4[path]?>/sub/image/btn_search.jpg" border=0 accesskey='s'>
<a href="javascript:history.back()"><img id="btn_list" src="<?=$g4[path]?>/sub/image/btn_cancle.jpg" border=0></a></td>
</tr>
</table>
</form>
<? } else { //패스워드가 있다면 아래 출력 ?>
"원래 있던 list.skin.php 내용"
//그리고 여기에 잇는 폼 아래에
<input type='hidden' name=wr_password2 value='<?=$wr_password2?>'>
// 를 추가해 줘야 다시 패스워드를 묻는 일이 없을 겁니다.
//쿠키로 하는게 더 좋지만요 임시로 이렇게
<?}?>
답변을 작성하시기 전에 로그인 해주세요.