10원짜리 검색어 관리 시스템 정보
10원짜리 검색어 관리 시스템
본문
요상한 단어로 검색한 리스트 삭제하기 입니다.
참조: 페이징처리 무
g4/del.php 이라는 파일을 생성한후 사용
<?
include_once("./_common.php");
include_once("$g4[path]/head.sub.php");
if (!$is_admin){
alert_close("관리자만 이용하실 수 있습니다.");
}
$list = array();
$sql = " select * from $g4[popular_table] ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$list[$i] = $row;
$list[$i][pp_id] = $row[pp_id];
$list[$i][pp_word] = addslashes($row[pp_word]);
$list[$i][pp_date] = $row[pp_date];
$list[$i][pp_ip] = $row[pp_ip];
$list[$i][del_href] = "del.php?del_no={$list[$i][pp_id]}";
}
?>
<table width=500 cellpadding=1 cellspacing=1 border=0>
<tr bgcolor=#E1E1E1 align=center>
<td width=10% height=24>no</td>
<td width=35%><b>단어</b></td>
<td width=25%><b>날짜</b></td>
<td width=20%><b>아이피</b></td>
<td width=20%><b>삭제</b></td>
</tr>
<? for ($i=0; $i<count($list); $i++) { ?>
<tr height=25 bgcolor=#F6F6F6 align=center>
<td width="10%"><?=$list[$i][pp_id]?></td>
<td width="35%"><?=get_text($list[$i][pp_word])?></td>
<td width="25%"><?=$list[$i][pp_date]?></td>
<td width="20%"><?=$list[$i][pp_ip]?></td>
<td width="20%"><a href='<?=$list[$i][del_href]?>'>삭제</a></td>
</tr>
<? } ?>
<? if ($i==0) { echo "<tr><td height=100 align=center colspan=4>자료가 없습니다.</td></tr>"; } ?>
</table>
<?
if ($del_no) {
if (!$is_admin) {
alert_close("관리자만 이용하실 수 있습니다.");
}
//del
sql_query(" delete from $g4[popular_table] where pp_id = '$del_no' ");
goto_url("./del.php");
}
?>
<?
include_once("$g4[path]/tail.sub.php");
?>
미리보기: http://kkk.myhome.tv/admins/del.php
참조: 페이징처리 무
g4/del.php 이라는 파일을 생성한후 사용
<?
include_once("./_common.php");
include_once("$g4[path]/head.sub.php");
if (!$is_admin){
alert_close("관리자만 이용하실 수 있습니다.");
}
$list = array();
$sql = " select * from $g4[popular_table] ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$list[$i] = $row;
$list[$i][pp_id] = $row[pp_id];
$list[$i][pp_word] = addslashes($row[pp_word]);
$list[$i][pp_date] = $row[pp_date];
$list[$i][pp_ip] = $row[pp_ip];
$list[$i][del_href] = "del.php?del_no={$list[$i][pp_id]}";
}
?>
<table width=500 cellpadding=1 cellspacing=1 border=0>
<tr bgcolor=#E1E1E1 align=center>
<td width=10% height=24>no</td>
<td width=35%><b>단어</b></td>
<td width=25%><b>날짜</b></td>
<td width=20%><b>아이피</b></td>
<td width=20%><b>삭제</b></td>
</tr>
<? for ($i=0; $i<count($list); $i++) { ?>
<tr height=25 bgcolor=#F6F6F6 align=center>
<td width="10%"><?=$list[$i][pp_id]?></td>
<td width="35%"><?=get_text($list[$i][pp_word])?></td>
<td width="25%"><?=$list[$i][pp_date]?></td>
<td width="20%"><?=$list[$i][pp_ip]?></td>
<td width="20%"><a href='<?=$list[$i][del_href]?>'>삭제</a></td>
</tr>
<? } ?>
<? if ($i==0) { echo "<tr><td height=100 align=center colspan=4>자료가 없습니다.</td></tr>"; } ?>
</table>
<?
if ($del_no) {
if (!$is_admin) {
alert_close("관리자만 이용하실 수 있습니다.");
}
//del
sql_query(" delete from $g4[popular_table] where pp_id = '$del_no' ");
goto_url("./del.php");
}
?>
<?
include_once("$g4[path]/tail.sub.php");
?>
미리보기: http://kkk.myhome.tv/admins/del.php
추천
1
1
댓글 7개

덤으로 한꺼번에 왕창 비우기......ㅋㅋㅋ
원하시는 아무 곳이나 (일반페이지, 게시판 등등) 아래코드를 넣어준후
if ($popular =="cb") {
$sql = " TRUNCATE $g4[popular_table] ";
sql_query($sql);
}
링크에서 &popular=cb 를 추가해 주면 검색어 테이블을 전부 비우게 됩니다.
링크예제:홈주소/페이지명 또는 게시판링크&popular=cb
이 코드를 원글에 있는 코드에 포함시켜서 링크를 걸어 사용두 가능합니다.
g4/del.php?popular=cb
원하시는 아무 곳이나 (일반페이지, 게시판 등등) 아래코드를 넣어준후
if ($popular =="cb") {
$sql = " TRUNCATE $g4[popular_table] ";
sql_query($sql);
}
링크에서 &popular=cb 를 추가해 주면 검색어 테이블을 전부 비우게 됩니다.
링크예제:홈주소/페이지명 또는 게시판링크&popular=cb
이 코드를 원글에 있는 코드에 포함시켜서 링크를 걸어 사용두 가능합니다.
g4/del.php?popular=cb
와우 질문으로 올라왔던 것을 단번에 만들어 올려주셨네요!
이야..대단하세요~~
10원짜리라뇨??..필요한 분에겐 천금의 팁일것같은데..
10원짜리라뇨??..필요한 분에겐 천금의 팁일것같은데..

단어 리스트를 뿌려 주는 부분에서 수정이 되었습니다.
단어 출력에서 스크립트 실행방지 get_text() 를 사용함
단어 출력에서 스크립트 실행방지 get_text() 를 사용함
전체 삭제는 그냥 디비에서 비우는게 빠르지 않을까요?
감사합니다.
감사합니다, 적용완료 2009.10.21