웹마스터 팁

http://seokeen.zio.tocheck.php //제로보드 회원과 연동시키는 부분
SelectBox.js //Say Club 셀렉트박스
include.php //북마크 출력
bookmark.php //북마크 입력
bookmark_ok.php //입력;;
bookmark_del.php //북마크 삭제


설치하시려면 bookmark 라는 테이블을 생성해 주셔야 합니다.
이상있는 부분이 발견되거나;;; 하면 댓글 달아주세요;;;

CREATE TABLE bookmark (
  id int(11) NOT NULL auto_increment,
  member_id varchar(20) NOT NULL default '',
  url varchar(255) NOT NULL default '',
  url_name varchar(50) NOT NULL default '',
  PRIMARY KEY  (id)
) TYPE=MyISAM;


check.php ─────────────────────────────────────

<?
ob_start();

$connect = mysql_connect("localhost" ,"아이디", "패스워드") or die(mysql_error());
mysql_select_db("DB네임");

$user_id  = $HTTP_COOKIE_VARS[zetyxboard_userid];
$password = $HTTP_COOKIE_VARS[zetyxboard_password];

$result = @mysql_query("select * from zetyx_member_table where user_id='$user_id' and password='$password'",$connect) or die(mysql_error());
$check = mysql_fetch_array($result);
?>



SelectBox.js ─────────────────────────────────────

function printZSelectBox(selectBox,option) {
        var tmp, name, value, outString, action;
        var id = selectBox["id"];
        var width = selectBox["width"];
        var height = selectBox["height"];
        var bordercolor = selectBox["bordercolor"];
        var bgcolor = selectBox["bgcolor"];
        var fontcolor = selectBox["fontcolor"];
        var focusbgcolor = selectBox["focusbgcolor"];
        var fontsize = selectBox["fontsize"];
        var padding = selectBox["padding"];
        var bullet = selectBox["bullet"];
        var onChange = selectBox["onChange"];
        var select = option["select"];

        if(bordercolor==null) bordercolor = "#888888";
        if(bgcolor==null) bgcolor= "#ffffff";
        if(fontcolor==null) fontcolor="#333333";
        if(focusbgcolor==null) focusbgcolor= "#ededed";
        if(width==null) width=100;
        if(height!=null) height="height="+height; else height = "";
        if(fontsize==null) fontsize="9";
        if(padding==null) padding="1";
        if(bullet==null) bullet="▽";

        outString = "<input type=hidden name='"+id+"'>";
        outString += "<table width="+width+" "+height+" border=0 cellspacing=1 cellpadding=0 bgcolor="+bordercolor+" style='table-layout:fixed;cursor:hand' onClick="showZSelectBox('layer_"+id+"')">n";
        outString += "<tr bgcolor="+bgcolor+">n";
        outString += "<td>n";
        outString += "<table border=0 width=100% height=100% cellspacing=0 cellpadding="+padding+" style='table-layout:fixed;'>n";
        outString += "<col width=></col><col width=15></col>n";
        outString += "<tr>n";
        outString += "<td style='line-height:100%;padding-top:3px;padding-left:3px;' onMouseOver=this.style.backgroundColor='"+focusbgcolor+"' onMouseOut=this.style.backgroundColor='+ ''><div id="+id+"_value style=color:"+fontcolor+";font-size:"+fontsize+"pt;>Select</div></td>n";
        outString += "<td style='font-size:"+fontsize+"pt;padding:0px;color:"+fontcolor+";' align=center>"+bullet+"</td>n";
        outString += "</tr>n";
        outString += "</table>n";
        outString += "</td>n";
        outString += "</tr>n";
        outString += "</table>n";

        outString += "<div id='layer_"+id+"' style='z-index:100; position:absolute; visibility:hidden' onMouseOver=showZSelectBox('layer_"+id+"') onMouseOut=hideZSelectBox('layer_"+id+"')>n";
        outString += "<table border=0 cellspacing=0 cellpadding=0 height=2><tr><td></td></tr></table><table border=0 cellspacing=1 cellpadding=0 bgcolor="+bordercolor+" width="+width+">n";
        outString += "<tr bgcolor="+bgcolor+">n";
        outString += "<td>n";
        outString += "<table border=0 cellspacing=0 cellpadding=0 width=100% style=table-layout:fixed>n";
        outString += "<col style=padding-left:3px;font-size:"+fontsize+"pt;color:"+fontcolor+" width=></col>n";
        for(i=0;i<option.length;i++) {
                tmp = option[i].split(",");
                name = tmp[0];
                value = tmp[1];
                if(value==null) value = "";
                if(onChange!=null&&value) action= "location.href=""+value+""";
                else action = ""selectZSelectBox('"+name+"','"+value+"'+ ','"+id+"')"";
                outString += "<tr onMouseOver=this.style.backgroundColor='"+focusbgcolor+"' onMouseOut=this.style.backgroundColor='' style=cursor:hand><td onClick="+action+" style='padding-top:1px;font-size:"+fontsize+"pt;color:"+fontcolor+"'>"+name+"</td></tr>n";
        }
        
        outString += "</table>n";
        outString += "</td>n";
        outString += "</tr>n";
        outString += "</table>n";
        outString += "</div>n";
        document.writeln(outString);

        if(select!=null) {
                tmp = option[select].split(",");
                name = tmp[0];
                value = tmp[1];
                if(value==null) value = "";
                document.all[id+"_value"].innerHTML = name;
                document.all[id].value = value;
        }
}

function showZSelectBox(id) {
        document.all[id].style.visibility = '';
}

function hideZSelectBox(id) {
        document.all[id].style.visibility = 'hidden';
}

function selectZSelectBox(name,value,id) {
        document.all[id+"_value"].innerHTML = name;
        document.all[id].value=value;
        document.all["layer_"+id].style.visibility = 'hidden';
}



include.php ────────────────────────────────
include.php 을 원하는 부분에 include 하시면 됩니다.;;;;

<script src="SelectBox.js"></script>
<script>
        var selectBox = new Array();
        var option = new Array();

        selectBox["id"] = "BookMark";
        selectBox["fontsize"] = "9";
        selectBox["width"] = "148";
        selectBox["height"] = "19";
        selectBox["fontcolor"] = "#333333";
        selectBox["bordercolor"] = "#666666";
        selectBox["focusbgcolor"] = "#f0f0f0";
        selectBox["bullet"] = "<img src=select_bul.gif width=10 height=6 border=0>";
        selectBox["padding"] = "0";
        selectBox["onChange"] = true;
        option[0] = "북마크";

        <?
        include ("check.php");

        @$temp   = "select * from bookmark where member_id='$check[user_id]'";
        @$result = mysql_query($temp,$connect);
        $total   = mysql_affected_rows();

        for ($i=0; $i<$total; $i++)
        {
                $m = $i+1;
                $data = mysql_fetch_array($result);
                echo "option[$m] = "$data[url_name],$data[url]";rn";
        }
        ?>

        option["select"] = 0;
        printZSelectBox(selectBox,option);
</script>

<?
if($check[level]) $a_link = "<a href='bookmark.php' title='현재 페이지 북마크하기'>";
else $a_link = "<a href='#' onclick='alert(" 로그인된 회원에 한해 이용하실 수 있습니다. ")' title='현재 페이지 북마크하기'>";
echo $a_link;
?>

북마크추가</a>
</form>



bookmark.php ────────────────────────────────

<?
//$HTTP_REFERER 변수를 받아온다.

include ("check.php");
if(!$check[level]||$check[level]==10) error ("사용권한이 없습니다. 로그인해주세요");
$temp = mysql_query("select * from bookmark where member_id='$check[user_id]'");

<form name='bookMark' action='bookmark_ok.php' method='post' enctype='multipart/form-data'>
북마크 이름 : <input type='text' name='url_name' value=''>
URL : <input type='text' name='url' value='<?=$HTTP_REFERER?>'>
<input type=submit value='  SUBMIT  '>
</form>

<table>
<tr align='center'>
<td><b>Name</b></td><td><b>URL</b></td><td><b>Del</b></td>
</tr>
<?
while ($data=mysql_fetch_array($temp))
{
        echo "<tr>
        <td>$data[url_name]</td>
        <td><a href='$data[url]' target='_blank'>$data[url]</td>
        <td><a href='bookmark_del.php?id=$data[id]'>삭제</a></td>
        </tr>";
}
?>
</table>



bookmark_ok.php ────────────────────────────────

<?
include ("check.php");
mysql_query("insert into bookmark (member_id,url,url_name) values ('$check[user_id]','$url','$url_name')");
echo "<meta http-equiv='refresh' content='0;URL=bookmark.php'>";
?>



bookmark_del.php ────────────────────────────────

<?
include ("check.php");
mysql_query("delete from bookmark where id ='$id'");
echo "<meta http-equiv='refresh' content='0;URL=bookmark.php'>";
?>
제목 글쓴이 날짜
동일서버내 페이지에서 로그인정보 활용하기... [4] 수로 2008.09.06
게시판 에디터 폰트 글자(글씨)크기 변경하는 법 씨에씨에 2008.09.12
주소록 구현 (외부 페이지) [17] CSLab 2008.09.15
"권한이 없습니다." Alert 창 대신 로그인 화면으로 이동시키기 [4] Slur 2008.09.22
VPN 환경에서 제로보드 [4] superion 2008.09.26
[권한이 없습니다] 권한에 따른 다른 메시지 출력하기 [10] [1] 반도체맨 2008.10.03
제로보드XE가입 -> 트랙자동가입 기능 개돌 2008.10.14
제로보드(zbxe) 설치 후 로그인 안되는 문제. [3] sophistlv.myid.net 2008.10.15
개인 웹서버 백업 및 게시물 등록 날짜 수정 방법 [10] file eunbini 2008.10.24
카페24 계정 사용 중에 제로보드XE 로그인 오류가 날 때 [1] vltm 2008.10.24
플래시 BGM 음악 제로보드에 넣는 방법 file 푸른커튼 2008.10.29
외국에서 접속시 로그인 않되는문제 [1] minams 2008.10.30
FTP프로그램을 이용하지 않고 업로드 하기 [8] 싱하형 2008.10.31
라이트박스(facebox) 적용하기 [7] file 퍼플F 2008.11.02
일반 페이지에 로그인(세션) 정보 활용하기 [13] noirzo 2008.11.07
1.1.0 업데이트 로그인문제관련 [6] 그냥뛰어 2008.11.24
XE 로그인이 안될때 확인해 보세요. [7] 똑디 2008.12.11
XE와 별도 프로그램 연동시 세션공유 [15] 똑디 2008.12.12
로그인한 회원만 최근 게시글, 검색등 볼수 있도록 하기 [3] [_)s 2008.12.31
제로보드XE 쉽게 업데이트 하는 방법.. [13] 청개구리00 2009.01.12