Beispiel #1
0
function set_start($idx)
{
    global $URL, $pn;
    $dbh = dbconnect();
    $query = "select poll_idx,status from poll_data where poll_idx={$idx}";
    $sth = dbquery($dbh, $query);
    list($poll_idx, $edate) = dbselect($sth);
    if (!$poll_idx) {
        print_alert("존재하지 않는 데이터입니다.   ", 'back');
        exit;
    } elseif ($status == 1) {
        print_alert("현재 설문중입니다.   ", 'back');
        exit;
    }
    /* 설문 재개 */
    $query = "update poll_data set status='1' where poll_idx={$idx}";
    $sth = dbquery($dbh, $query);
    if (!$sth) {
        $msg = "에러가 발생하였습니다.<br><br>\n" . mysql_error();
        print_message($msg);
    } else {
        header("Location: {$URL['list']}?pn={$pn}");
        exit;
    }
    dbclose($dbh);
    exit;
}
Beispiel #2
0
function login($id, $passwd, $url)
{
    $dbh = dbconnect();
    $query = "select mem_id,mem_pw from member_data where mem_id='{$id}'";
    $sth = dbquery($dbh, $query);
    if (!$sth) {
        print_msg(mysql_error());
    }
    list($mem_id, $mem_pw) = dbselect($sth);
    dbclose($dbh);
    if (!$mem_id) {
        print_alert("해당 ID가 없습니다.  ", 'back');
    } elseif ($mem_pw != $passwd) {
        print_alert("비밀번호가 틀립니다.  ", 'back');
    } else {
        setcookie("MemberID", $mem_id);
        header("Location: {$url}");
    }
    return;
}
Beispiel #3
0
function check_idnum($idnum)
{
    if (!check_idnum_syntax($idnum)) {
        print_msg("주민등록가 잘못되었습니다.<br>정확히 입력하세요.", 'check_idnum', -1);
    }
    $dbh = dbconnect();
    $idnum2 = substr($idnum, 0, 6) . "-" . substr($idnum, 6, 7);
    $query = "select mem_idnum from member_data where mem_idnum='{$idnum2}'";
    $sth = dbquery($dbh, $query);
    if (!$sth) {
        print_msg(mysql_error());
    }
    list($mem_idnum) = dbselect($sth);
    dbclose($dbh);
    if ($mem_idnum == $idnum2) {
        return false;
    } else {
        return true;
    }
}
Beispiel #4
0
function view_result($idx)
{
    global $URL;
    $dbh = dbconnect();
    /* 설문 내용 뽑기 */
    $query = "select * from poll_data where poll_idx={$idx}";
    $sth = dbquery($dbh, $query);
    list($poll_idx, $question, $sdate, $edate, $status, $answer_no, $answer[1], $answer[2], $answer[3], $answer[4], $answer[5], $answer[6], $answer[7], $answer[8], $answer[9], $answer[10]) = dbselect($sth);
    if (!$poll_idx) {
        print_alert("잘못된 설문번호입니다.   ", 'back');
        exit;
    }
    /* 결과 뽑기 */
    $query = "select answer,count(answer) from poll_result where poll_idx={$idx} group by answer";
    $sth = dbquery($dbh, $query);
    while (list($answer_num, $count) = dbselect($sth)) {
        $RESULT[$answer_num] = $count;
        $sum += $count;
    }
    /* 결과 화면 출력 */
    print_header();
    echo "\n<table border=1 bordercolor=white bordercolorlight=silver cellpadding=3 cellspacing=0 width=350>\n<tr><td colspan=2 bgcolor=f6f6f6 align=center><font size=2><b>설문 결과</b><br><br>{$question}</b></font></td></tr>\n";
    for ($i = 1; $i <= $answer_no; $i++) {
        $result_count = $RESULT[$i];
        if (!$result_count) {
            $result_count = 0;
        }
        if ($sum) {
            $ratio = round($result_count / $sum * 100, 0);
            $width = $ratio * 2;
        } else {
            $sum = 0;
            $ratio = 0;
            $width = 0;
        }
        echo "\n<tr><td width=300><font size=2>{$i}. {$answer[$i]}<br>\n        &nbsp;&nbsp;&nbsp;&nbsp;<img src=\"{$URL['home']}/icon/bar{$i}.gif\" width='{$width}' height=10> ({$result_count})</font></td>\n    <td width=50 align=right><font size=2 color=NAVY>{$ratio}%</font></td>\n</tr>\n";
    }
    echo "\n<tr><td colspan=2 bgcolor=f6f6f6 align=right><font size=2>총 투표 수 : {$sum}</font>\n</td></tr>\n</table>\n<center>\n<input type=button value=\"   닫   기   \" onClick=\"window.close();\">\n<!--a href=\"javascript:this.close();\">[닫기]</a-->\n";
    print_footer();
}
Beispiel #5
0
function check_passwd($db, $idx, $rn, $passwd)
{
    /* 데이타 확인 */
    $dbh = dbconnect();
    $table_name = "bbs_" . $db;
    $query = "select idx,replynum,passwd from {$table_name} where idx={$idx} and replynum={$rn}";
    $sth = dbquery($dbh, $query);
    if (!$sth) {
        print_message(mysql_error());
    }
    list($c_idx, $c_replynum, $c_passwd) = dbselect($sth);
    dbclose($dbh);
    /* 존재하지 않을때 */
    if (!$c_idx) {
        return -1;
    }
    /* 비밀번호 확인 */
    if ($passwd == $admin_passwd || $passwd == $c_passwd) {
        return 1;
    }
    return 0;
}
Beispiel #6
0
<?php

/*
	설문조사 (현재설문)
	2001.06 by Jungjoon Oh
*/
require "db-lib.php";
require "poll-lib.php";
/* DB 접속 */
$dbh = dbconnect();
$query = "select * from poll_data where status='1' ";
if ($idx) {
    $query .= " and poll_idx={$idx}";
} else {
    $query .= " order by poll_idx desc";
}
$sth = dbquery($dbh, $query);
list($poll_idx, $question, $sdate, $edate, $status, $answer_no, $answer[1], $answer[2], $answer[3], $answer[4], $answer[5], $answer[6], $answer[7], $answer[8], $answer[9], $answer[10]) = dbselect($sth);
print_header();
if (!$poll_idx) {
    echo "<br><br><font size=2>현재 진행중인 설문이 없습니다.</font><br><br>" . "<a href=\"{$URL['list']}\">{$LINK['admin']}</a>";
} else {
    $idx = $poll_idx;
    echo "\n<script language=JavaScript>\n\nfunction check_form(form) \n{ \n\tif (form.m.value=='vote')\n\t{\n\t   check_val=-1;\n\t   for (i=0; i<form.answer.length; i++)\n\t   {\n\t   \tif (form.answer[i].checked)\n\t    \t{\n\t    \t   check_val+=1;\n\t    \t}\n\t   }\n\t\n\t   if (check_val==-1)\n\t   {\n\t\talert('문항중에 하나를 선택하세요   ');\n\t\treturn false;\n\t   }\n\t}\n\tresult_window();\n\treturn true;\n}\n\nfunction result_window()\n{\n\twindow.open('', 'result','width=400,height=400,marginwidth=0,marginheight=0,resizable=1,scrollbars=1');  \n}   \n\n</script>\n\n<form action=\"{$URL['result']}\" name=f target=result onSubmit='return check_form(document.f);'>\n<input type=hidden name=idx value={$idx}>\n<input type=hidden name=m value=''>\n<table width=350>\n<tr><td>\n<!--메인 테이블 시작-->\n<table border=1 bordercolor=white bordercolorlight=silver cellpadding=3 cellspacing=0 width=100%>\n<tr><td bgcolor=f6f6f6><font size=2><b>{$question}</b></font></td></tr>\n";
    for ($i = 1; $i <= $answer_no; $i++) {
        echo "<tr><td><font size=2>{$i}.<input type=radio name=answer value={$i}>{$answer[$i]}</font></td></tr>\n";
    }
    echo "\n</table>\n<!--메인 테이블 끝-->\n</td>\n</tr>\n<tr><td align=center>\n    <input type=submit value='  투표하기  ' onClick=\"document.f.m.value='vote';\">\n    <input type=submit value='  결과보기  ' onClick=\"document.f.m.value='view';\">\n</td></tr>\n<tr><td align=right><a href=\"{$URL['list']}\">{$LINK['admin']}</a>&nbsp;&nbsp;</td></tr>\n</table>\n\n";
}
print_footer();
Beispiel #7
0
if (!$idx) {
    header("Location: {$URL['list']}\n\n");
    exit;
}
if ($from == 'search') {
    $from_string .= "&k={$k}&where={$where}";
}
$back_url = "{$URL['read']}?idx={$idx}&from={$from}&" . $from_string;
// 데이터 가져오기
$dbh = dbconnect();
$query = "select * from namecard where nc_index={$idx} and " . "(nc_id='{$mem_id}' or nc_pub='1')";
$sth = dbquery($dbh, $query);
if (!$sth) {
    print_alert(mysql_error(), 'back');
}
list($nc_index, $nc_group, $nc_id, $nc_date, $nc_name, $nc_company, $nc_depart, $nc_title, $nc_tel, $nc_fax, $nc_hp, $nc_email, $nc_url, $nc_address, $nc_relation, $nc_note, $nc_pub) = dbselect($sth);
// 존재하지 않을때
if (!$nc_index) {
    print_alert("데이터가 존재하지 않습니다.", 'stop');
    exit;
}
print_header("명함조회");
print_location_bar("명함조회");
$button_line = "\n    <table border=0 width=100%>\n    <tr><td>\n\t    <a href=\"{$URL['edit_form']}?idx={$nc_index}&from={$from}&{$from_string}\">{$BUTTON['edit']}</a>\n\t    <a href=\"{$URL['delete']}?idx={$nc_index}&from={$from}&{$from_string}\"\n\t    onClick=\"return confirm('[{$nc_name}]님의 명함을 정말로 삭제하시겠습니까 ?   ');\">\n\t    {$BUTTON['delete']}</a> \n\t</td>\n\t<td align=right>\n\t    <a href=\"{$URL['write_form']}\">{$BUTTON['write']}</a> \n\t    <a href=\"{$URL['list']}?m={$from}&{$from_string}\">{$BUTTON['list']}</a> &nbsp;\n\t</td>\n    </tr>\n    </table>\n";
?>

<br>
<table width="700" border="0" cellspacing="1" cellpadding="4" bgcolor="#FFFFFF" align="center">
    <tr bgcolor="#FFFFFF">
       <td colspan=4>
	<? echo $button_line ?>
Beispiel #8
0
	2001.06 by Jungjoon Oh
*/
require "db-lib.php";
require "mem-lib.php";
if (!$MemberID) {
    header("Location: login.php?url=mem_edit_form.php");
    exit;
}
// 데이타 가져오기
$dbh = dbconnect();
$query = "select * from member_data where mem_id='{$MemberID}'";
$sth = dbquery($dbh, $query);
if (!$sth) {
    print_alert(mysql_error(), 'back');
}
$data = dbselect($sth);
for ($i = 0; $i <= 11; $i++) {
    $data[$i] = ereg_replace("\"", "'", $data[$i]);
}
list($mem_id, $mem_pw, $mem_date, $mem_name, $mem_idnum, $mem_email, $mem_url, $mem_tel, $mem_hp, $mem_addr1, $mem_addr2, $mem_zip) = $data;
// 존재하지 않을때
if (!$mem_id) {
    print_alert("존재하지 않는 ID 입니다.", 'back');
    exit;
}
list($mem_zip1, $mem_zip2) = split("-", $mem_zip);
?>


<html>
<head>
Beispiel #9
0
}
/* 글번호 지정 여부 */
if (!$idx || !$rn) {
    header("Location: {$URL['list']}\n\n");
    exit;
}
/* Table 이름 지정 */
$table_name = "bbs_" . $db;
/* 데이타 가져오기 */
$dbh = dbconnect();
$query = "select idx,passwd,filename from {$table_name} where idx={$idx} and replynum={$rn}";
$sth = dbquery($dbh, $query);
if (!$sth) {
    print_alert(mysql_error(), 'back');
}
list($e_idx, $e_passwd, $e_filename) = dbselect($sth);
/* 존재하지 않을때 */
if (!$idx) {
    print_alert("데이터가 존재하지 않습니다.", 'stop');
} elseif ($passwd != $e_passwd) {
    print_alert("비밀번호가 일치하지 않습니다.   ", 'back');
}
if ($userfile_name) {
    if (!$userfile_size) {
        print_alert("파일 업로드 실패", 'back');
        exit;
    }
    /* 확장자 검색 */
    $file_ext = strrchr($userfile_name, ".");
    $file_ext = ereg_replace("\\.", "", $file_ext);
    $file_ext = strtolower($file_ext);
Beispiel #10
0
<?php

include "db.php";
// 현재 날짜 저장
$today_date = date("Y-m-d", time());
// ID를 지정하지 않았을 때
if (!$id) {
    ShowCounter(0, 0, $align, $border, $width);
    exit;
}
// DB 오픈
$dbh = dbconnect();
$query = "select * from counter where uid='{$id}'";
$sth = dbquery($dbh, $query);
list($uid, $total, $today, $date) = dbselect($sth);
// ID가 존재하지 않을 경우
if (!$uid) {
    // Counter를 초기화 하고 데이터 저장
    $total = 1;
    $today = 1;
    $query = "insert into counter (uid,total,today,date) " . "values ('{$id}',{$total},{$today},'{$today_date}')";
    dbquery($dbh, $query);
} else {
    // Counter 증가 후 저장
    $total++;
    if ($date == $today_date) {
        $today++;
    } else {
        $today = 1;
    }
    // Counter 저장
Beispiel #11
0
require "gb-lib.php";
$isAdmin = is_admin($PHP_AUTH_USER, $PHP_AUTH_PW);
if (!$isAdmin) {
    print_alert("관리자만 삭제할 수 있습니다.  ", 'back');
}
if (!$idx) {
    header("Location: {$URL['list']}\n\n");
    exit;
}
// 데이타 확인
$dbh = dbconnect();
$query = "select gb_index from guestbook where gb_index={$idx}";
$sth = dbquery($dbh, $query);
if (!$sth) {
    print_alert(mysql_error(), 'back');
}
list($gb_index) = dbselect($sth);
// 존재하지 않을때
if (!$gb_index) {
    print_alert("데이터가 존재하지 않습니다.", 'stop');
    exit;
}
$query = "delete from guestbook where gb_index={$idx}";
// Delete
$sth = dbquery($dbh, $query);
if (!$sth) {
    print_alert(mysql_error(), 'back');
} else {
    print_alert("삭제가 완료되었습니다.   ", "url|{$URL['list']}");
}
exit;
function get_product_id($upc, $sid)
{
    global $link;
    $where = "upc_code LIKE '{$upc}' AND store_id = {$sid}";
    return dbselect($link, 'products', 'id', $where, false);
}
Beispiel #13
0
    print_alert($errmsg, 'back');
}
/* Table 이름 지정 */
$table_name = "bbs_" . $db;
$dbh = dbconnect();
if ($m == 'reply') {
    $idx_next = $idx;
    /* replynum 계산 */
    $query = "select max(replynum) from {$table_name} where idx={$idx}";
    $sth = dbquery($dbh, $query);
    list($replynum_next) = dbselect($sth);
    $replynum_next++;
} else {
    $query = "select max(idx) from {$table_name}";
    $sth = dbquery($dbh, $query);
    list($idx_next) = dbselect($sth);
    $idx_next++;
    $replynum_next = 1;
}
if ($userfile_name) {
    if (!$userfile_size) {
        print_alert("파일 업로드 실패", 'back');
        exit;
    }
    /* 확장자 검색 */
    $file_ext = strrchr($userfile_name, ".");
    $file_ext = ereg_replace("\\.", "", $file_ext);
    $file_ext = strtolower($file_ext);
    if ($file_ext == 'php' || $file_ext == 'php3' || $file_ext == 'phtml' || $file_ext == 'inc') {
        print_alert("PHP 프로그램 소스는 올릴수 없습니다.  ", 'back');
    }
Beispiel #14
0
*/
require "db-lib.php";
require "nc-lib.php";
$mem_id = $REMOTE_USER;
if (!$idx) {
    header("Location: {$URL['list']}\n\n");
    exit;
}
// 데이타 확인
$dbh = dbconnect();
$query = "select nc_index,nc_id from namecard where nc_index={$idx}";
$sth = dbquery($dbh, $query);
if (!$sth) {
    print_alert(mysql_error(), 'back');
}
list($nc_index, $nc_id) = dbselect($sth);
// 존재하지 않을때
if (!$nc_index) {
    print_alert("데이터가 존재하지 않습니다.", 'stop');
    exit;
}
// 등록한 사람이 아닐때
if ($mem_id != $nc_id) {
    print_alert("명함을 등록한 사람만 수정할수있습니다.   ", 'back');
    exit;
}
$query = "update namecard set " . "nc_group='{$nc_group}'," . "nc_name='{$nc_name}'," . "nc_company='{$nc_company}'," . "nc_depart='{$nc_depart}'," . "nc_title='{$nc_title}'," . "nc_tel='{$nc_tel}'," . "nc_fax='{$nc_fax}'," . "nc_hp='{$nc_hp}'," . "nc_email='{$nc_email}'," . "nc_url='{$nc_url}'," . "nc_address='{$nc_address}'," . "nc_relation='{$nc_relation}'," . "nc_note='{$nc_note}'," . "nc_pub='{$nc_pub}' " . "where nc_index={$nc_index}";
// Update
$sth = dbquery($dbh, $query);
if (!$sth) {
    print_alert(mysql_error(), 'back');
Beispiel #15
0
if ($i == 1) {
    $reply_list = "";
} else {
    $reply_list = "\n<tr><td colspan=2 height=30 bgcolor=#BBDDFF><font size=2><b>답변목록</b></font></td>\n</tr>\n<tr><td colspan=2 height=70 bgcolor=#D0F0FF><table width=100%>{$reply_list}</table></td>\n</tr>\n";
}
/* 다음글 목록 */
$query = "select {$column} from {$table_name} where replynum=1 and idx>{$idx}" . " order by idx";
$sth = dbquery($dbh, $query);
list($n_idx, $n_replynum, $n_name, $n_email, $n_hit, $n_date, $n_subject) = dbselect($sth);
if ($n_idx) {
    $next_list .= "<tr><td><font size=2>△ " . "<a href=\"{$URL['read']}?db={$db}&idx={$n_idx}&rn={$n_replynum}" . "&{$from_string}\">{$n_subject}</a></font></td></tr>";
}
/* 이전글 목록 */
$query = "select {$column} from {$table_name} where replynum=1 and idx<{$idx}" . " order by idx desc";
$sth = dbquery($dbh, $query);
list($n_idx, $n_replynum, $n_name, $n_email, $n_hit, $n_date, $n_subject) = dbselect($sth);
if ($n_idx) {
    $next_list .= "<tr><td><font size=2>▽ " . "<a href=\"{$URL['read']}?db={$db}&idx={$n_idx}&rn={$n_replynum}" . "&{$from_string}\">{$n_subject}</a></font></td></tr>";
}
if ($next_list) {
    $next_list = "<table width=100%>{$next_list}</table>";
}
/* 결과 출력 */
require $header;
/* Text 형식일때 본문의 new-line을 <br>로 변환 */
if ($type == 1) {
    $note = htmlspecialchars($note);
    $note = nl2br($note);
}
/* 검색일때 일치하는 키워드는 빨간색으로 */
if ($from == 'search') {
Beispiel #16
0
	회원관리 (회원정보 수정)
	2001.06 by Jungjoon Oh
*/
require "db-lib.php";
require "mem-lib.php";
if (!$MemberID) {
    header("Location: member_edit_form.php");
    exit;
}
// 데이타 확인
$dbh = dbconnect();
$query = "select mem_id from member_data where mem_id='{$MemberID}'";
$sth = dbquery($dbh, $query);
if (!$sth) {
    print_alert(mysql_error(), 'back');
}
list($mem_id) = dbselect($sth);
// 존재하지 않을때
if (!$mem_id) {
    print_alert("존재하지 않는 ID 입니다.", 'back');
    exit;
}
$query = "update member_data set " . "mem_pw='{$passwd}'," . "mem_name='{$name}'," . "mem_email='{$email}'," . "mem_url='{$url}'," . "mem_tel='{$tel}'," . "mem_hp='{$hp}'," . "mem_addr1='{$addr1}'," . "mem_addr2='{$addr2}'," . "mem_zip='{$zip1}-{$zip2}' " . "where mem_id='{$MemberID}'";
// Update
$sth = dbquery($dbh, $query);
if (!$sth) {
    print_alert(mysql_error(), 'back');
} else {
    print_alert("수정이 완료되었습니다.   ", "url|mem_edit_form.php");
}
exit;
Beispiel #17
0
    print_alert("DB를 지정하셔야 합니다.", 'back');
    exit;
}
if (!$m) {
    $m = 'list';
}
/* Table 이름 지정 */
$table_name = "bbs_" . $db;
if (!$pn) {
    $pn = 1;
}
/* DB접속 */
$dbh = dbconnect();
$from_string = "from=list";
$start_num = ($pn - 1) * $max_list;
$end_num = $pn * $max_list;
/* 전체 글수 */
$query = "select count(idx) from {$table_name}";
$sth = dbquery($dbh, $query);
list($total_count) = dbselect($sth);
/* 데이터 $max_list 만큼 뽑아서 @LIST_DATA 에 저장. */
$query = "select {$column} from {$table_name} order by idx desc,replynum limit {$start_num},{$max_list}";
$sth = dbquery($dbh, $query);
$i = 0;
$LIST_DATA = array();
while ($field = dbselect($sth)) {
    array_push($LIST_DATA, "{$field['0']}|{$field['1']}|{$field['2']}|\n\t\t{$field['3']}|{$field['4']}|{$field['5']}|{$field['6']}|{$field['7']}");
    $i++;
}
dbclose($dbh);
include "show_list.php";
Beispiel #18
0
        $from_string .= "&k={$k}&w={$w}";
    }
    $back_url = "{$URL[$from]}?db={$db}&from={$from}&" . $from_string;
    passwd_form($db, $idx, $rn, $back_url);
    exit;
}
/* Table 이름 지정 */
$table_name = "bbs_" . $db;
/* 데이타 가져오기 */
$dbh = dbconnect();
$query = "select idx,passwd,filename from {$table_name} where idx={$idx} and replynum={$rn}";
$sth = dbquery($dbh, $query);
if (!$sth) {
    print_alert(mysql_error(), 'back');
}
list($d_idx, $d_passwd, $d_filename) = dbselect($sth);
/* 존재하지 않을때 */
if (!$idx) {
    print_alert("데이터가 존재하지 않습니다.", 'stop');
} elseif ($passwd != $d_passwd && $passwd != $admin_passwd) {
    print_alert("비밀번호가 일치하지 않습니다.   ", 'back');
}
/* 파일 등록 여부 확인 */
if ($d_filename) {
    unlink("{$upload_path}/{$db}/{$d_filename}");
}
/* 글 삭제 */
$query = "delete from {$table_name} where idx={$idx}";
/* 첫번째 글이 아닌경우 */
if ($rn != 1) {
    $query .= " and replynum={$rn}";