그누보드 [G4/G5] 회원 로그인후 글 작성시 이름과 이메일 입력해서 글저장
페이지 정보
본문
회원 로그인후 글작성(글쓰기)할때 이름과 이메일을 변경해서 글 게시하도록 하는 방법입니다
회원로그인하면 이름(글쓴이/작성자), 이메일은 회원정보의 것이 자동으로 삽입되는데, 그것을 회원 스스로 입력하도록 할 수 있습니다
1-1. 그누보드5.4 / skin / board / 스킨 / write.skin.php
[수정전]
<?php if ($is_name) { ?>
<label for="wr_name" class="sound_only">이름<strong>필수</strong></label>
<input type="text" name="wr_name" value="<?php echo $name ?>" id="wr_name" required class="frm_input half_input required" placeholder="이름">
<?php } ?>
<?php if ($is_password) { ?>
<label for="wr_password" class="sound_only">비밀번호<strong>필수</strong></label>
<input type="password" name="wr_password" id="wr_password" <?php echo $password_required ?> class="frm_input half_input <?php echo $password_required ?>" placeholder="비밀번호">
<?php } ?>
<?php if ($is_email) { ?>
<label for="wr_email" class="sound_only">이메일</label>
<input type="text" name="wr_email" value="<?php echo $email ?>" id="wr_email" class="frm_input half_input email " placeholder="이메일">
<?php } ?>
<?php if ($is_homepage) { ?>
<label for="wr_homepage" class="sound_only">홈페이지</label>
<input type="text" name="wr_homepage" value="<?php echo $homepage ?>" id="wr_homepage" class="frm_input half_input" size="50" placeholder="홈페이지">
<?php } ?>
[수정후]
<?php //if ($is_name) { ?>
<label for="wr_name" class="sound_only">이름<strong>필수</strong></label>
<input type="text" name="wr_name" value="<?php echo $name; ?>" id="wr_name" required class="frm_input half_input required" placeholder="이름">
<?php //} ?>
<?php //if ($is_password) { ?>
<label for="wr_password" class="sound_only">비밀번호<strong>필수</strong></label>
<input type="password" name="wr_password" id="wr_password;" <?php echo $password_required; ?> class="frm_input half_input <?php echo $password_required; ?>" placeholder="비밀번호">
<?php //} ?>
<?php //if ($is_email) { ?>
<label for="wr_email" class="sound_only">이메일</label>
<input type="text" name="wr_email" value="<?php echo $email; ?>" id="wr_email" class="frm_input half_input email " placeholder="이메일">
<?php //} ?>
<?php //if ($is_homepage) { ?>
<label for="wr_homepage" class="sound_only">홈페이지</label>
<input type="text" name="wr_homepage" value="<?php echo $homepage; ?>" id="wr_homepage" class="frm_input half_input" size="50" placeholder="홈페이지">
<?php //} ?>
<?php if ($is_admin) { ?>
<label for="wr_ip" class="sound_only">IP</label>
<input type="text" name="wr_ip" value="<?php echo $write['wr_ip']; ?>" id="wr_ip" class="frm_input half_input" size="50" placeholder="IP">
<?php } ?>
1-2. 그누보드4 / skin / board / 스킨 / write.skin.php
[수정전]
<? if ($is_name) { ?>
<tr>
<td class=write_head>이 름</td>
<td><input class='ed' maxlength=20 size=15 name=wr_name itemname="이름" required value="<?=$name?>"></td></tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>
<? if ($is_email) { ?>
<tr>
<td class=write_head>이메일</td>
<td><input class='ed' maxlength=100 size=50 name=wr_email email itemname="이메일" value="<?=$email?>"></td></tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>
<? if ($is_homepage) { ?>
<tr>
<td class=write_head>홈페이지</td>
<td><input class='ed' size=50 name=wr_homepage itemname="홈페이지" value="<?=$homepage?>"></td></tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>
[수정후]
<?php //if ($is_name) { ?>
<tr>
<td class="write_head">이 름</td>
<td><input class='ed' maxlength="20" size="15" name="wr_name" title="이름" required value="<?php echo $name; ?>"></td>
</tr>
<tr><td colspan="2" height="1" bgcolor="#e7e7e7">
</td></tr>
<?php //} ?>
<?php //if ($is_email) { ?>
<tr>
<td class="write_head">이메일</td>
<td><input class='ed' maxlength="100" size="50" name="wr_email" email itemname="이메일" value="<?php echo $email; ?>"></td></tr>
<tr><td colspan="2" height="1" bgcolor="#e7e7e7"></td></tr>
<?php //} ?>
<?php //if ($is_homepage) { ?>
<tr>
<td class=write_head>홈페이지</td>
<td><input class='ed' size="50" name="wr_homepage" itemname="홈페이지" value="<?php echo $homepage; ?>"></td></tr>
<tr><td colspan="2" height="1" bgcolor="#e7e7e7"></td></tr>
<?php //} ?>
<?php if($is_admin) { ?>
<tr>
<td class="write_head" 아 이 피</td>
<td><input class=ed size="20" name="wr_ip" itemname="아이피" required value="<?php echo $write['wr_ip']; ?>"></td></tr>
<tr><td colspan="2" height="1" bgcolor="#e7e7e7"></td></tr>
<?php } ?>
2. 그누보드 / skin / board / 스킨 / write_update.skin.php 수정 (파일이 없으면 생성하세요)
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// 자신만의 코드를 넣어주세요.
// 작성자정보를 변경하기
if ($_POST['wr_name'] || $_POST['wr_password'] || $_POST['wr_homepage'] || $_POST['wr_email'] || $_POST['wr_ip']) {
$sql_update_writer = " update `{$write_table}` set ";
//if ($_POST['wr_password']) $sql_update_writer .= "wr_password = '{$_POST['wr_password']}' , ";
if ($_POST['wr_homepage']) $sql_update_writer .= "wr_homepage = '{$_POST['wr_homepage']}' , ";
if ($_POST['wr_email']) $sql_update_writer .= "wr_email = '{$_POST['wr_email']}' , ";
if ($_POST['wr_ip']) $sql_update_writer .= "wr_ip = '{$_POST['wr_ip']}' ";
$sql_update_writer .= "wr_name = '{$_POST['wr_name']}' ";
$sql_update_writer .= "where wr_id = '{$wr_id}' ";
sql_query($sql_update_writer);
}
참고자료
http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=32457
회원로그인하면 이름(글쓴이/작성자), 이메일은 회원정보의 것이 자동으로 삽입되는데, 그것을 회원 스스로 입력하도록 할 수 있습니다
1-1. 그누보드5.4 / skin / board / 스킨 / write.skin.php
[수정전]
<?php if ($is_name) { ?>
<label for="wr_name" class="sound_only">이름<strong>필수</strong></label>
<input type="text" name="wr_name" value="<?php echo $name ?>" id="wr_name" required class="frm_input half_input required" placeholder="이름">
<?php } ?>
<?php if ($is_password) { ?>
<label for="wr_password" class="sound_only">비밀번호<strong>필수</strong></label>
<input type="password" name="wr_password" id="wr_password" <?php echo $password_required ?> class="frm_input half_input <?php echo $password_required ?>" placeholder="비밀번호">
<?php } ?>
<?php if ($is_email) { ?>
<label for="wr_email" class="sound_only">이메일</label>
<input type="text" name="wr_email" value="<?php echo $email ?>" id="wr_email" class="frm_input half_input email " placeholder="이메일">
<?php } ?>
<?php if ($is_homepage) { ?>
<label for="wr_homepage" class="sound_only">홈페이지</label>
<input type="text" name="wr_homepage" value="<?php echo $homepage ?>" id="wr_homepage" class="frm_input half_input" size="50" placeholder="홈페이지">
<?php } ?>
[수정후]
<?php //if ($is_name) { ?>
<label for="wr_name" class="sound_only">이름<strong>필수</strong></label>
<input type="text" name="wr_name" value="<?php echo $name; ?>" id="wr_name" required class="frm_input half_input required" placeholder="이름">
<?php //} ?>
<?php //if ($is_password) { ?>
<label for="wr_password" class="sound_only">비밀번호<strong>필수</strong></label>
<input type="password" name="wr_password" id="wr_password;" <?php echo $password_required; ?> class="frm_input half_input <?php echo $password_required; ?>" placeholder="비밀번호">
<?php //} ?>
<?php //if ($is_email) { ?>
<label for="wr_email" class="sound_only">이메일</label>
<input type="text" name="wr_email" value="<?php echo $email; ?>" id="wr_email" class="frm_input half_input email " placeholder="이메일">
<?php //} ?>
<?php //if ($is_homepage) { ?>
<label for="wr_homepage" class="sound_only">홈페이지</label>
<input type="text" name="wr_homepage" value="<?php echo $homepage; ?>" id="wr_homepage" class="frm_input half_input" size="50" placeholder="홈페이지">
<?php //} ?>
<?php if ($is_admin) { ?>
<label for="wr_ip" class="sound_only">IP</label>
<input type="text" name="wr_ip" value="<?php echo $write['wr_ip']; ?>" id="wr_ip" class="frm_input half_input" size="50" placeholder="IP">
<?php } ?>
1-2. 그누보드4 / skin / board / 스킨 / write.skin.php
[수정전]
<? if ($is_name) { ?>
<tr>
<td class=write_head>이 름</td>
<td><input class='ed' maxlength=20 size=15 name=wr_name itemname="이름" required value="<?=$name?>"></td></tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>
<? if ($is_email) { ?>
<tr>
<td class=write_head>이메일</td>
<td><input class='ed' maxlength=100 size=50 name=wr_email email itemname="이메일" value="<?=$email?>"></td></tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>
<? if ($is_homepage) { ?>
<tr>
<td class=write_head>홈페이지</td>
<td><input class='ed' size=50 name=wr_homepage itemname="홈페이지" value="<?=$homepage?>"></td></tr>
<tr><td colspan=2 height=1 bgcolor=#e7e7e7></td></tr>
<? } ?>
[수정후]
<?php //if ($is_name) { ?>
<tr>
<td class="write_head">이 름</td>
<td><input class='ed' maxlength="20" size="15" name="wr_name" title="이름" required value="<?php echo $name; ?>"></td>
</tr>
<tr><td colspan="2" height="1" bgcolor="#e7e7e7">
</td></tr>
<?php //} ?>
<?php //if ($is_email) { ?>
<tr>
<td class="write_head">이메일</td>
<td><input class='ed' maxlength="100" size="50" name="wr_email" email itemname="이메일" value="<?php echo $email; ?>"></td></tr>
<tr><td colspan="2" height="1" bgcolor="#e7e7e7"></td></tr>
<?php //} ?>
<?php //if ($is_homepage) { ?>
<tr>
<td class=write_head>홈페이지</td>
<td><input class='ed' size="50" name="wr_homepage" itemname="홈페이지" value="<?php echo $homepage; ?>"></td></tr>
<tr><td colspan="2" height="1" bgcolor="#e7e7e7"></td></tr>
<?php //} ?>
<?php if($is_admin) { ?>
<tr>
<td class="write_head" 아 이 피</td>
<td><input class=ed size="20" name="wr_ip" itemname="아이피" required value="<?php echo $write['wr_ip']; ?>"></td></tr>
<tr><td colspan="2" height="1" bgcolor="#e7e7e7"></td></tr>
<?php } ?>
2. 그누보드 / skin / board / 스킨 / write_update.skin.php 수정 (파일이 없으면 생성하세요)
<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// 자신만의 코드를 넣어주세요.
// 작성자정보를 변경하기
if ($_POST['wr_name'] || $_POST['wr_password'] || $_POST['wr_homepage'] || $_POST['wr_email'] || $_POST['wr_ip']) {
$sql_update_writer = " update `{$write_table}` set ";
//if ($_POST['wr_password']) $sql_update_writer .= "wr_password = '{$_POST['wr_password']}' , ";
if ($_POST['wr_homepage']) $sql_update_writer .= "wr_homepage = '{$_POST['wr_homepage']}' , ";
if ($_POST['wr_email']) $sql_update_writer .= "wr_email = '{$_POST['wr_email']}' , ";
if ($_POST['wr_ip']) $sql_update_writer .= "wr_ip = '{$_POST['wr_ip']}' ";
$sql_update_writer .= "wr_name = '{$_POST['wr_name']}' ";
$sql_update_writer .= "where wr_id = '{$wr_id}' ";
sql_query($sql_update_writer);
}
참고자료
댓글목록
등록된 댓글이 없습니다.