테스트 사이트 - 개발 중인 베타 버전입니다

마인크래프트 연동 채택완료

서켠 5년 전 조회 2,666

마인크래프트 서버와 연동을 해서 페이지 이동시 명령어가 입력되는것 까지 확인했습니다.

근데 문제는 홈페이지 포인트를 마인크래프트 서버 포인트로 변환하는데, 오류가 걸려서요

변수를 어떻게 써야할지 모르겠어요..

 

point_inco_update (출금 완료시 페이지)

</p>

<p><?php

include_once('./_common.php');

include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');

require_once("WebsenderAPI.php"); // Load Library</p>

<p>if ($is_guest)

    alert("로그인 후 이용해 주세요.", "/bbs/login.php");</p>

<p>if (!chk_captcha()) {

    alert('자동등록방지 숫자가 틀렸습니다.');

}</p>

<p>$mb = get_member($me_recv_mb_id);</p>

<p>$max_point = 999999999;</p>

<p>$wsr = new WebsenderAPI("서버아이피","비밀번호","포트"); // HOST , PASSWORD , PORT</p>

<p>if ($point > $max_point)

    alert('최대 출금 한도는 '.number_format($max_point).'P 입니다.');</p>

<p>if ($member['mb_point'] < $point)

    alert('포인트가 부족합니다.');</p>

<p>insert_point($member['mb_id'], "-".$point, "서버내 포인트로 ".number_format($point)."P 를 출금했습니다.", '@passive', $member['mb_id'], $member['mb_id'].'-'.uniqid(''));

$wsr->sendCommand("eco give" $member['mb_id'] $point);

$wsr->sendCommand("say" $member['mb_id'] "으로" $point "포인트");

    

alert('정상적으로 출금이 완료되었습니다.', "<a href="https://sybank.pw");" target="_blank" rel="noopener noreferrer">https://sybank.pw");</a>

?></p>

<p>

 

여기서 API는

</p>

<p><?php</p>

<p>class WebsenderAPI{

    

    public $timeout = 30;</p>

<p>    var $host;

    var $password;

    var $port;

    var $socket;

    

    public function __construct($host, $password, $port){

        $this->host = gethostbyname($host);

        $this->password = $password;

        $this->port = $port;

    }</p>

<p>    public function __destruct(){

        if($this->socket)

            $this->disconnect();

    }</p>

<p>    public function connect(){

        @$this->socket = fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout);

        if(!$this->socket) return false;

        @$this->writeRawByte(1);

        @$this->writeString(hash("SHA512", $this->readRawInt().$this->password));

        return $this->readRawInt() == 1 ? true: false;

    }

    

    /*

    *   -> event is cancelled or command not entered this method msut be return false.

    */

    public function sendCommand($command){

        $this->writeRawByte(2);

        $this->writeString(base64_encode($command));

        return $this->readRawInt() == 1 ? true: false;

    }

    

    /*

    *   -> event is cancelled this method must be return false.

    */

    public function sendMessage($message){

        $this->writeRawByte(4);

        $this->writeString(base64_encode($message));

        return $this->readRawInt() == 1 ? true: false;

    }

    

    public function disconnect(){

        if(!$this->socket) return false;

        return $this->writeRawByte(3) ? true: false;

    }

    

    private function writeRawInt($i){

        @fwrite($this->socket, pack("N", $i), 4);

    }</p>

<p>    private function writeRawByte($b){

        @fwrite($this->socket, strrev(pack("C", $b)));

    }</p>

<p>    private function writeString($string){

        $array = str_split($string);

        $this->writeRawInt(count($array));

        foreach($array as &$cur){

            $v = ord($cur);

            $this->writeRawByte((0xff & ($v >> 8)));

            $this->writeRawByte((0xff & $v));

        }

    }</p>

<p>    private function readRawInt(){

        $a = $this->readRawByte();

        $b = $this->readRawByte();

        $c = $this->readRawByte();

        $d = $this->readRawByte();

        $i = ((($a & 0xff) << 24) | (($b & 0xff) << 16) | (($c & 0xff) << 8) | ($d & 0xff));

        if($i > 2147483648)

             $i -= 4294967296;

        return $i;

    }

        

    private function readRawByte(){

        $up = unpack("Ci", fread($this->socket, 1));

        $b = $up["i"];

        if($b > 127)

            $b -= 256;

        return $b;

    }

    

}</p>

<p>?></p>

<p>

입니다. 이걸 어떻게 써야지 함께 작동할까요..?

 

포인트 출금 페이지는

https://sybank.pw/bbs/point_inco.php">https://sybank.pw/bbs/point_inco.php

입니다.

 

로그인 하라고 뜨면

ttest

test1234

하시면 돼요!

$wsr->sendCommand("eco give" $member['mb_id'] $point);
$wsr->sendCommand("say" $member['mb_id'] "으로" $point "포인트");

이부분을 수정하면 될듯한데.. 이부분을 빼고 하면 작동이 돼요.. (포인트 빠져나가는것 까진)

댓글을 작성하려면 로그인이 필요합니다.

답변 1개

헉 가입했네요 테스트 아이디 있었군요

 

bbs/memo.php 파일 쪽지보낼시 포인트차감 확인해서 그대로 쿼리 날려도 될듯한데요 

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

서켠
5년 전
포인트 차감까지는 확인했는데..
$wsr->sendCommand("eco give" $member['mb_id'] $point);
$wsr->sendCommand("say" $member['mb_id'] "으로" $point "포인트");
이 부분이 안돼요.. 마인크래프트 라는 서버와 연동해서 포인트 차감되면서 함께 명령어도 입력되게끔 하는건데.. 이거를 다른식으로 작성해야 할것 같아서요..

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인