웹마스터 팁

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'>";
?>
제목 글쓴이 날짜
새로운 뉴스티커 [1] 아렌티 2006.04.25
[이 컨트롤을 활성화하고..] 해결하기 [2] 모그422 2006.04.29
플래시 영역에 박스가 생기는것 [4] 로그인 2006.05.03
웹FTP 적용하기 - 꽁수 [4] whenji 2006.05.02
홈페이지 하단 링크주소 없에는 소스 2 [4] 인터니즈 2006.04.27
홈페이지 하단 링크주소 없에는 소스 [6] 인테리어뱅크 2006.04.10
내 홈페이지에 유명사이트 검색엔진을 달자...(네이버,다음,야후 등등) [3] 트래비스 2006.05.10
익스플러로 플래시 영역 박스 생김과 이 컨트롤을 활성화.. [14] 도토리맘 2006.05.15
[소스] 개발자,디자이너 전용 통합검색 스크립트 [1] 김성대 2006.05.19
부모창과 함께 닫히는 팝업창(IE, FF) 행복한고니 2006.07.06
깔끔한 이미지 펼침박스 [2] ▩윤미 2006.07.11
환상적인 이미지 갤러리 (4차원세계에 빠져보세요) [5] ▩윤미 2006.07.11
상단 타이틀바 흐르는 텍스트 왜,그러지 2006.07.14
위에서 아래로 좌에서 우로... [1] 왜,그러지 2006.07.14
날라서 붙는 텍스트 [1] 왜,그러지 2006.07.17
자바스크립트로 만든 테트리스 일명 자트리스 ^^;; [12] beMax 2006.07.27
배경색을 마우스로 크릭하여 지정하여 준다. 왜,그러지 2006.07.27
로또 번호 추출기 [3] 왜,그러지 2006.07.27
텍스트 선택하기 행복한고니 2006.09.06
로또 번호 생성기 허접..ㅋㅋ [5] 삐따기 2006.10.04