포인트 경매 업로드 방식으로 관리자님만 보세요 > 그누4 팁자료실

그누4 팁자료실

그누보드4와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.

포인트 경매 업로드 방식으로 관리자님만 보세요 정보

포인트 경매 업로드 방식으로 관리자님만 보세요

본문

관리자님 소스가 어떻게 되잇는지 몰라서.. 요렇게까지만

tender_all.php 파일하나 생성해서 view.skin.php 에 file 인풋박스 하나 만들어주시궁 파일인풋은 경로를
all로 잡아 주시구 tender_send 함수 $txt 부분말 살짝수정했어요

<?
$g4_path = "../../..";
include_once("$g4_path/common.php");

if (!$bo_table && !$wr_id)
    die("bo_table 혹은 wr_id 가 없습니다.");

include_once("$board_skin_path/auction.lib.php");
include_once("$g4[path]/head.sub.php");

if("csv" == strtolower(array_pop(explode('.', $_FILES[exc][name])))){
 $new_val = 1;

 if(is_uploaded_file($_FILES[exc][tmp_name])){
    move_uploaded_file($_FILES[exc][tmp_name],"$g4[path]/data/exctest.txt");
  
 }else{
  alert("파일 업로드 실패하였습니다.");
 }

 $r_line=file("$g4[path]/data/exctest.txt");
 $tmpNcnt=count($r_line);
 $tmpPonit = "";
 for($i = 0; $i < $tmpNcnt; $i++){
 
  $tempT = explode(",",$r_line[$i]);
  $tempTcnt=count($tempT);

  if($new_val == $tempTcnt){
   
   for($k = 0; $k < $tempTcnt; $k++){

    $point = (int)trim(strip_tags($tempT[$k]));
    $tmp_txt = "$tmpPonit 까지 입찰 되었으며 이후";

    tender_send($wr_id, $point,$tmp_txt);
    if($tmpPonit)
     $tmpPonit .= ", $point";
    else
     $tmpPonit .= "$point";
   }
  }
 }

}else{
 alert_only("csv 형식의 파일만 가능 합니다.");
}
?>

<script language=javascript>
alert("<?=$tmpPonit;?> 포인트로 입찰하였습니다.");
</script>

<?
include_once("$g4[path]/tail.sub.php");
?>

// 페이지 끝

//auction.lib.php 펑션 시작
// 경매 입찰 진행
function tender_send($wr_id, $point,$txt="")
{
    global $g4, $board, $member, $tender_table, $write_table, $write, $bo_table;

    if (!$member[mb_id])
        alert_only("로그인 해주세요.");

    if ($board[bo_5] > 0 && (($g4[server_time] - strtotime($member[mb_datetime])) < ($board[bo_5]*86400)))
        alert_only("회원가입 후 $board[bo_5] 일이 지나야 참여 가능합니다.");

    $auction = get_info_auction($wr_id);

    if ($g4[time_ymdhis] < $auction[start_datetime])
        alert_only("경매 시작 전입니다.");

    if ($g4[time_ymdhis] > $auction[end_datetime])
        alert_only("경매가 종료되었습니다.");

    $row2 = sql_fetch(" select count(mb_id) as cnt from $tender_table where td_datetime like '$g4[time_ymd]%' and mb_id = '$member[mb_id]' and wr_id = '$wr_id' ");
    $tender_count = $row2[cnt];

    if ($tender_count >= $auction[day_limit])
        alert_only("$txt 하루에 $auction[day_limit] 번 참여 가능합니다.");

    if ($point < $auction[tender_lower] || $point > $auction[tender_higher])
        alert_only("$txt 입찰 포인트는 ".number_format($auction[tender_lower])."~".number_format($auction[tender_higher])." 사이로 설정해주세요.");

    $total_point = (int)$auction[inter_point] + (int)$point;

    if ($member[mb_point] - $total_point < 0)
        alert_only("$txt 가지고 계신 포인트(".number_format($member[mb_point]).") 가 참여 포인트+입찰 포인트(".number_format($total_point).") 보다 부족합니다.");

    $row = sql_fetch(" select * from $tender_table where wr_id = '$wr_id' and mb_id = '$member[mb_id]' and td_tender_point = '$point' ");
    if ($row)
        alert_only("$txt 이미 같은 포인트로 입찰 하셨습니다.");

    //////////////////////////////////////////////////////////////////////
    // 연속번호 불가
    //////////////////////////////////////////////////////////////////////
    /*
    $series = 4;
    $half = floor($series/2);
    $msg = "연속된 번호로 ".($series-1)."번 이상 입찰하실 수 없습니다.";

    // 아래로
    $row = sql_fetch(" select count(*) as cnt from {$tender_table} where wr_id = '$wr_id' and mb_id = '$member[mb_id]' and td_tender_point < {$point} and td_tender_point > {$point}-{$series} ");
    if ($row[cnt] >= $series-1)
        alert_only($msg);

    // 위로
    $row = sql_fetch(" select count(*) as cnt from {$tender_table} where wr_id = '$wr_id' and mb_id = '$member[mb_id]' and td_tender_point > {$point} and td_tender_point < {$point}+{$series} ");
    if ($row[cnt] >= $series-1)
        alert_only($msg);

    // 사이에
    $row = sql_fetch(" select count(*) as cnt from {$tender_table} where wr_id = '$wr_id' and mb_id = '$member[mb_id]' and td_tender_point >= {$point}-{$half} and td_tender_point <= {$point}+{$half} ");
    if ($row[cnt] >= $series+1)
        alert_only($msg);
    */

    //////////////////////////////////////////////////////////////////////
    // 범위 입찰 제한
    //////////////////////////////////////////////////////////////////////
    $sec = 10; // 범위 10개
    $cnt = 5; // 허용갯수 5개

    if ($point % $sec)
        $tmp = $point;
    else
        $tmp = $point - 1;

    $min = floor($tmp/$sec) * $sec + 1;
    $max = ceil(($tmp/$sec)) * $sec;

    $row = sql_fetch(" select count(*) as cnt from {$tender_table} where wr_id = '$wr_id' and mb_id = '$member[mb_id]' and td_tender_point >= {$min} and td_tender_point <= {$max} ");
    if ($row[cnt] >= $cnt)
        alert_only("$txt 이미 $min 과 $max 사이에 $cnt 번 입찰하셨습니다.");
    //////////////////////////////////////////////////////////////////////

    $sql = "insert into {$tender_table} set ";
    $sql.= " wr_id = '$wr_id' ";
    $sql.= ",mb_id = '$member[mb_id]' ";
    $sql.= ",mb_name = '$member[mb_name]' ";
    $sql.= ",mb_nick = '$member[mb_nick]' ";
    $sql.= ",mb_email = '$member[mb_email]' ";
    $sql.= ",mb_homepage = '$member[mb_homepage]' ";
    $sql.= ",td_inter_point = '$auction[inter_point]' ";
    $sql.= ",td_tender_point = '$point' ";
    $sql.= ",td_status = '1' ";
    $sql.= ",td_last = '$g4[time_ymdhis]' ";
    $sql.= ",td_datetime = '$g4[time_ymdhis]' ";
    sql_query($sql);

    sql_query(" update $write_table set wr_7 = wr_7 + 1 where wr_id = '$wr_id' ");

    if ($auction[inter_point])
        insert_point($member[mb_id], $auction[inter_point]*-1, "$wr_id 경매 참여", $bo_table, $wr_id, "참여 : $g4[time_ymdhis]");

    if ($point)
        insert_point($member[mb_id], $point*-1, "$wr_id 경매 입찰", $bo_table, $wr_id, "입찰 : $g4[time_ymdhis]");
}

추천
2

댓글 1개

전체 3,313 |RSS
그누4 팁자료실 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT