제로보드 新 게시물 날짜 수정하기
페이지 정보
본문
1. 제로보드4 / dbconfig.php 생성
<?php
$mysql_host = "디비서버주소";
$mysql_user = "디비아이디";
$mysql_password = "디비비밀번호";
$mysql_db = "디비이름";
$dbconn = mysql_connect($mysql_host,$mysql_user,$mysql_password) or die("데이터베이스 연결에 실패하였습니다.");
mysql_select_db($mysql_db,$dbconn);
//@mysql_query("set names euckr"); // 한글문제 생기면 주석 해제
?>
2. 제로보드4 / hp_date_edit_ok.php 파일 생성
<?php
include_once "./dbconfig.php";
$hpcheck = $_POST['hpcheck'];
if ($hpcheck=="Admin") { // 관리자 체크
$id = $_POST['id'];
$page = $_POST['page'];
$sn1 = $_POST['sn1'];
$divpage = $_POST['divpage'];
$sn = $_POST['sn'];
$ss = $_POST['ss'];
$sc = $_POST['sc'];
$select_arrange = $_POST['select_arrange'];
$desc = $_POST['desc'];
$no = $_POST['no'];
// 변경 날짜 ( 2004-11-11 12:59:23 )
$hp_date = $_POST['hp_date'];
// 날짜 추출
$year = substr($hp_date, 0, 4);
$mon = substr($hp_date, 5, 2);
$day = substr($hp_date, 8, 2);
$hour = substr($hp_date, 11, 2);
$min = substr($hp_date, 14, 2);
$sec = substr($hp_date, 17, 2);
// 변경 날짜를 1100145563 형식으로 변경하기
$reg_date = mktime($hour, $min, $sec, $mon, $day, $year);
$query = " update zetyx_board_". $id ." set reg_date = '". $reg_date ."' where no = '". $no ."' ";
$result = mysql_query($query);
if(!$result) die(mysql_error());
mysql_close($dbconn);
echo " <script>alert('날짜가 변경되었습니다.'); document.location.href='zboard.php?id=".$id."&page=".$page."&sn1=".$sn1."&divpage=".$divpage."&sn=".$sn."&ss=".$ss."&sc=".$sc."&select_arrange=".$select_arrange."&desc=".$desc."&no=".$no."'; </script>";
} else {
echo " <script>document.location.href='./'; </script>";
}
?>
3. 제로보드4 / skin / 폴더 / view.php 에 내용 추가
<?php
//if ($_SERVER['REMOTE_ADDR'] == "내컴퓨터") {
if($member[level] <= 1) {
?>
<form name="hp_edit_date" method="post" action="hp_date_edit_ok.php">
<input type="hidden" name="hpcheck" value="<?php if(isAdmin) { echo "Admin"; } ?>">
<input type="hidden" name="id" value="<?php echo $id; ?>">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="sn1" value="<?php echo $sn1; ?>">
<input type="hidden" name="divpage" value="<?php echo $divpage; ?>">
<input type="hidden" name="sn" value="<?php echo $sn; ?>">
<input type="hidden" name="ss" value="<?php echo $ss; ?>">
<input type="hidden" name="sc" value="<?php echo $sc; ?>">
<input type="hidden" name="select_arrange" value="<?php echo $select_arrange; ?>">
<input type="hidden" name="desc" value="<?php echo $desc; ?>">
<input type="hidden" name="no" value="<?php echo $no; ?>">
<table style="width:99%; background-color:#FFC">
<tr>
<td>
※ 관리자일때만 보이는 화면입니다.<br>
날짜수정 : <input name="hp_date" type="text" value="<?php echo $date; ?>">
<input type="submit" name="submit" value=" 날짜수정 ">
년(0000)-월(00)-일(00) 시(00):분(00):초(00) 규칙을 준수해주세요<br>
</td>
</tr>
</table>
</form>
<?php
} else {
}
//}
?>
4. 제로보드4 / zboard.php 내용중
order by headnum,arrangenum
를 아래와 같이 변경 ( 2개 )
order by reg_date desc,headnum,arrangenum
5. 제로보드4 / outlogin.php 내용중
order by no desc
를 다음과 같이 변경 ( 2개 )
order by reg_date desc, no desc
댓글목록
등록된 댓글이 없습니다.