그누보드 [G4] 회원정보를 엑셀,워드,파워포인트로 다운받기
페이지 정보
본문
사용법)
파일명.php?ms=다운형식
예)
<a href="./member_xls.php?ms=excel">엑셀 문서 다운로드</a>
<a href="./member_xls.php?ms=power">파워포인트 문서 다운로드</a>
<a href="./member_xls.php?ms=word">워드 문서 다운로드</a>
<a href="./member_xls.php?ms=memo">메모 문서 다운로드</a>
<?php
include_once("./_common.php");
if (!$is_admin =="super")
alert_close("최고 관리자 영역 입니다.");
$ms = $_GET["ms"];
$filename = 'member';
if ($ms =="excel"){
$g4[title] = "엑셀 문서 다운로드";
header( "Content-type: application/vnd.ms-excel; charset=utf-8" );
header( "Content-Disposition: attachment; filename=".$filename.".xls" );
//header( "Content-Description: PHP4 Generated Data" );
} else if ($ms =="power"){
$g4[title] = "파워포인트 문서 다운로드";
header( "Content-type: application/vnd.ms-powerpoint; charset=utf-8" );
header( "Content-Disposition: attachment; filename=".$filename.".ppt" );
// header( "Content-Description: PHP4 Generated Data" );
} else if ($ms =="word"){
$g4[title] = "워드 문서 다운로드";
header( "Content-type: application/vnd.ms-word; charset=utf-8" );
header( "Content-Disposition: attachment; filename=".$filename.".doc" );
//header( "Content-Description: PHP4 Generated Data" );
} else if ($ms =="memo"){
$g4[title] = "메모 문서 다운로드";
header( "Content-type: application/vnd.ms-notepad; charset=utf-8" );
header( "Content-Disposition: attachment; filename=".$filename.".txt" );
} else {
header( "Content-type: application/vnd.ms-excel; charset=utf-8" );
header( "Content-Disposition: attachment; filename=".$filename.".xls" );
}
header( "Content-Description: PHP4 Generated Data" );
// 검색어에 대해서 처리
$s_que="";
$temp=mysql_fetch_array(mysql_query("select count(*) from ".$g4['member_table'] . $s_que .""));
// 정보를 구해옴
$result=mysql_query("select * from ".$g4['member_table'] . $s_que." order by mb_id desc");
// 앞에 붙는 가상번호
// $temp=mysql_fetch_array(mysql_query("select count(*) from $g4[member_table] $s_que"));
$number=$temp[0]
?>
<html>
<head>
<title>회원명단</title>
<style type="text/css">
/* 엑셀 다운로드로 저장시 숫자로 표시될 경우 방지 */
.txt {mso-number-format:'\@'}
</style>
</head>
<body>
<table>
<tr>
<td>번호</td>
<td>id명</td>
<td>이름</td>
<td>닉네임</td>
<td>레벨</td>
<td>포인트</td>
<td>가입일</td>
<td>이멜</td>
<td>홈페이지</td>
<td>성별</td>
<td>생일</td>
<td>전화</td>
<td>휴대폰</td>
<td>메일링</td>
<td>정보공개</td>
<td>최근로그인</td>
<td>우편번호</td>
<td>주소1</td>
<td>주소2</td>
<td>SMS 수신여부</td>
<td>서명</td>
<td>자기소개</td>
<td>추천인아이디</td>
</tr>
<?php
while($data = mysql_fetch_array($result)) {
$mb_sex = $data[mb_sex];
$mb_mailling = $data[mb_mailling];
$mb_open = $data[mb_open];
$mb_sms = $data[mb_sms];
$zip1 = $data[mb_zip1];
$zip2 = $data[mb_zip2];
if ($mb_sex =="M") { $mb_sex ="남자"; } else if ($mb_sex =="F"){ $mb_sex ="여자"; }
if ($mb_mailling =="1") { $mb_mailling ="받음"; } else if ($mb_mailling =="0"){ $mb_mailling ="안받음"; }
if ($mb_open =="1") { $mb_open ="공개"; } else if ($mb_open =="0"){ $mb_open ="비공개"; }
if ($mb_sms =="1") { $mb_sms ="받음"; } else if ($mb_sms =="0"){ $mb_sms ="안받음"; }
if ($zip1 <> "") { $zip = $zip1 ."-". $zip2; }
echo "
<tr>
<td class='txt'>$number</td>
<td class='txt'>$data[mb_id]</td>
<td class='txt'>$data[mb_name]</td>
<td class='txt'>$data[mb_nick]</td>
<td class='txt'>$data[mb_level]</td>
<td class='txt'>$data[mb_point]</td>
<td class='txt'>$data[mb_datetime]</td>
<td class='txt'>$data[mb_email]</td>
<td class='txt'>$data[mb_homepage]</td>
<td class='txt'>$mb_sex</td>
<td class='txt'>$data[mb_birth]</td>
<td class='txt'>$data[mb_tel]</td>
<td class='txt'>$data[mb_hp]</td>
<td class='txt'>$mb_mailling</td>
<td class='txt'>$mb_open</td>
<td class='txt'>$data[mb_today_login]</td>
<td class='txt'>$zip</td>
<td class='txt'>$data[mb_addr1]</td>
<td class='txt'>$data[mb_addr2]</td>
<td class='txt'>$mb_sms</td>
<td class='txt'>$data[mb_signature]</td>
<td class='txt'>$data[mb_profile]</td>
<td class='txt'>$data[mb_recommend]</td>
</tr>
";
}
?>
</table>
</body>
</html>
참고자료
http://sir.co.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=2198
파일명.php?ms=다운형식
예)
<a href="./member_xls.php?ms=excel">엑셀 문서 다운로드</a>
<a href="./member_xls.php?ms=power">파워포인트 문서 다운로드</a>
<a href="./member_xls.php?ms=word">워드 문서 다운로드</a>
<a href="./member_xls.php?ms=memo">메모 문서 다운로드</a>
<?php
include_once("./_common.php");
if (!$is_admin =="super")
alert_close("최고 관리자 영역 입니다.");
$ms = $_GET["ms"];
$filename = 'member';
if ($ms =="excel"){
$g4[title] = "엑셀 문서 다운로드";
header( "Content-type: application/vnd.ms-excel; charset=utf-8" );
header( "Content-Disposition: attachment; filename=".$filename.".xls" );
//header( "Content-Description: PHP4 Generated Data" );
} else if ($ms =="power"){
$g4[title] = "파워포인트 문서 다운로드";
header( "Content-type: application/vnd.ms-powerpoint; charset=utf-8" );
header( "Content-Disposition: attachment; filename=".$filename.".ppt" );
// header( "Content-Description: PHP4 Generated Data" );
} else if ($ms =="word"){
$g4[title] = "워드 문서 다운로드";
header( "Content-type: application/vnd.ms-word; charset=utf-8" );
header( "Content-Disposition: attachment; filename=".$filename.".doc" );
//header( "Content-Description: PHP4 Generated Data" );
} else if ($ms =="memo"){
$g4[title] = "메모 문서 다운로드";
header( "Content-type: application/vnd.ms-notepad; charset=utf-8" );
header( "Content-Disposition: attachment; filename=".$filename.".txt" );
} else {
header( "Content-type: application/vnd.ms-excel; charset=utf-8" );
header( "Content-Disposition: attachment; filename=".$filename.".xls" );
}
header( "Content-Description: PHP4 Generated Data" );
// 검색어에 대해서 처리
$s_que="";
$temp=mysql_fetch_array(mysql_query("select count(*) from ".$g4['member_table'] . $s_que .""));
// 정보를 구해옴
$result=mysql_query("select * from ".$g4['member_table'] . $s_que." order by mb_id desc");
// 앞에 붙는 가상번호
// $temp=mysql_fetch_array(mysql_query("select count(*) from $g4[member_table] $s_que"));
$number=$temp[0]
?>
<html>
<head>
<title>회원명단</title>
<style type="text/css">
/* 엑셀 다운로드로 저장시 숫자로 표시될 경우 방지 */
.txt {mso-number-format:'\@'}
</style>
</head>
<body>
<table>
<tr>
<td>번호</td>
<td>id명</td>
<td>이름</td>
<td>닉네임</td>
<td>레벨</td>
<td>포인트</td>
<td>가입일</td>
<td>이멜</td>
<td>홈페이지</td>
<td>성별</td>
<td>생일</td>
<td>전화</td>
<td>휴대폰</td>
<td>메일링</td>
<td>정보공개</td>
<td>최근로그인</td>
<td>우편번호</td>
<td>주소1</td>
<td>주소2</td>
<td>SMS 수신여부</td>
<td>서명</td>
<td>자기소개</td>
<td>추천인아이디</td>
</tr>
<?php
while($data = mysql_fetch_array($result)) {
$mb_sex = $data[mb_sex];
$mb_mailling = $data[mb_mailling];
$mb_open = $data[mb_open];
$mb_sms = $data[mb_sms];
$zip1 = $data[mb_zip1];
$zip2 = $data[mb_zip2];
if ($mb_sex =="M") { $mb_sex ="남자"; } else if ($mb_sex =="F"){ $mb_sex ="여자"; }
if ($mb_mailling =="1") { $mb_mailling ="받음"; } else if ($mb_mailling =="0"){ $mb_mailling ="안받음"; }
if ($mb_open =="1") { $mb_open ="공개"; } else if ($mb_open =="0"){ $mb_open ="비공개"; }
if ($mb_sms =="1") { $mb_sms ="받음"; } else if ($mb_sms =="0"){ $mb_sms ="안받음"; }
if ($zip1 <> "") { $zip = $zip1 ."-". $zip2; }
echo "
<tr>
<td class='txt'>$number</td>
<td class='txt'>$data[mb_id]</td>
<td class='txt'>$data[mb_name]</td>
<td class='txt'>$data[mb_nick]</td>
<td class='txt'>$data[mb_level]</td>
<td class='txt'>$data[mb_point]</td>
<td class='txt'>$data[mb_datetime]</td>
<td class='txt'>$data[mb_email]</td>
<td class='txt'>$data[mb_homepage]</td>
<td class='txt'>$mb_sex</td>
<td class='txt'>$data[mb_birth]</td>
<td class='txt'>$data[mb_tel]</td>
<td class='txt'>$data[mb_hp]</td>
<td class='txt'>$mb_mailling</td>
<td class='txt'>$mb_open</td>
<td class='txt'>$data[mb_today_login]</td>
<td class='txt'>$zip</td>
<td class='txt'>$data[mb_addr1]</td>
<td class='txt'>$data[mb_addr2]</td>
<td class='txt'>$mb_sms</td>
<td class='txt'>$data[mb_signature]</td>
<td class='txt'>$data[mb_profile]</td>
<td class='txt'>$data[mb_recommend]</td>
</tr>
";
}
?>
</table>
</body>
</html>
참고자료
http://sir.co.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=2198
댓글목록
등록된 댓글이 없습니다.