ThaiSEOBoard.com

พัฒนาเว็บไซต์ => Programming => ข้อความที่เริ่มโดย: xindy ที่ 06 มิถุนายน 2017, 22:48:34



หัวข้อ: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียว ( TrueMoney Wallet )
เริ่มหัวข้อโดย: xindy ที่ 06 มิถุนายน 2017, 22:48:34
ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียว ( TrueMoney Wallet ) ไม่ผ่านตัวกลางของใครทั้งนั้นเข้าตรงกระเป๋าเลยครับ
( PHP )
Update Code 9/6/2560
โค๊ด:
class TrueWallet{
public  $username;
public  $password;
private $passhash;
//Config TrueWallet ห้ามแก้ไขหากไม่รู้ค่าที่แท้จริง
private $login_type = "email";
private $api_signin = "https://api-ewm.truemoney.com/api/v1/signin?&";
private $api_profile = "https://api-ewm.truemoney.com/api/v1/profile/";
private $api_topup = "https://api-ewm.truemoney.com/api/api/v1/topup/mobile/";
private $device_os = "android";
private $device_id = "d520d0d12d0d48cb89394905168c6ed5";
private $device_type = "CPH1611";
private $device_version = "6.0.1";
private $app_name = "wallet";
private $app_version = "2.9.14";
private $deviceToken = "fUUbZJ9nwBk:APA91bHHgBBHhP9rqBEon_BtUNz3rLHQ-sYXnezA10PRSWQTwFpMvC9QiFzh-CqPsbWEd6x409ATC5RVsHAfk_-14cSqVdGzhn8iX2K_DiNHvpYfMMIzvFx_YWpYj5OaEzMyIPh3mgtx";
private $mobileTracking = "dJyFzn\/GIq7lrjv2RCsZbphpp0L\/W2+PsOTtOpg352mgWrt4XAEAAA==";
//End Config

public function __construct($user,$pass) {
$this->username = $user;
$this->password = $pass;
$this->passhash = sha1($user.$pass);
}

public function GetToken(){
$url = $this->api_signin.'device_os='.$this->device_os.'&device_id='.$this->device_id.'&device_type='.$this->device_type.'&device_version='.$this->device_version.'&app_name='.$this->app_name.'&app_version='.$this->app_version;
$header = array(
"Host: api-ewm.truemoney.com",
"Content-Type: application/json"
);
$postfield = array(
"username"=>$this->username,
"password"=>$this->passhash,
"type"=>$this->login_type,
"deviceToken"=>$this->deviceToken,
"mobileTracking"=>$this->mobileTracking,
);
$data_string = json_encode($postfield);

return $this->wallet_curl($url,$data_string,$header);
}

public function Profile($token){
$url = $this->api_profile.$token.'?&device_os=android&device_id='.$this->device_id.'&device_type='.$this->device_type.'&device_version='.$this->device_version.'&app_name='.$this->app_name.'&app_version='.$this->app_version;
$header = array("Host: api-ewm.truemoney.com");
return $this->wallet_curl($url,false,$header);

}

public function Topup($cashcard,$token){
$url = $this->api_topup.time()."/".$token."/cashcard/".$cashcard;
$header = array("Host: api-ewm.truemoney.com");
return $this->wallet_curl($url,true,$header);
}

private function wallet_curl($url,$data,$header){
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);  
if($data){
curl_setopt($ch,CURLOPT_CUSTOMREQUEST, "POST");                                                                    
curl_setopt($ch,CURLOPT_POSTFIELDS, $data);        
}                                  
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);  
curl_setopt($ch,CURLOPT_USERAGENT,'');
$result = curl_exec($ch);
return $result;
}
}
โค๊ด:
$wallet = new TrueWallet('YOUR EMAIL','YOUR PASSWORD');
$token = json_decode($wallet->GetToken(),true)['data']['accessToken'];
$profile = $wallet->Profile($token);
$topup = $wallet->Topup('เลขบบัตรทรูมั่นนี่',$token);
Download https://github.com/exzajung/class.truewallet.php
ทดสอบได้ที่ https://www.xindy.in/truewallet
เข้าตรวจสอบผ่านเว็บ https://wallet.truemoney.com/ หรือจะเช็คที่แอพก็ได้นะครับ

เพิ่มเติม https://github.com/xeleniumz/TrueWallet
TrueWallet

TrueWallet library For Node.js
PHP Version & Credit

visit this repository for php version https://github.com/exzajung/class.truewallet.php
System requirement

    babel transpiler
    node.js version 7.10 or higher
    request-promise-native Simplified HTTP request client for node.js package
    moment time management time management for node.js package

How to use

    install require package
    import this library to your controller
    send request data with post to endpoint and Enjoy !!

Debugging

There are at least three ways to debug the operation of request: Launch the node process like NODE_DEBUG=request node script.js (lib,request,otherlib works too). Set require('request').debug = true at any time Use the request-debug module to view request and response headers and bodies.


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: wasantec ที่ 06 มิถุนายน 2017, 23:52:35
ใช้ดีไหมครับ มาเนียนขายหรือว่ายังไง  :wanwan019:


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: okaki777 ที่ 07 มิถุนายน 2017, 00:18:36
 :P น่าสน


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: superjak ที่ 07 มิถุนายน 2017, 03:41:18
ติดตามครับ น่าสนใจมาก


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: jackiepkw ที่ 07 มิถุนายน 2017, 03:53:50
อันนี้คือรับบัตรแล้วเข้าวอทเลทเราโดยตรงใช่ไหม ?

แทนที่จะใช้ tm พวกนั้น


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: nutlove ที่ 07 มิถุนายน 2017, 04:44:40
มีประโยชน์มากครับ เอาไปประยุกใช้ได้เยอะเลยทีเดียว ขอบพระคุณมากครับ +1  :wanwan020:


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู&#
เริ่มหัวข้อโดย: xindy ที่ 07 มิถุนายน 2017, 08:37:35
ใช้ดีไหมครับ มาเนียนขายหรือว่ายังไง  :wanwan019:


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: maneemeena ที่ 07 มิถุนายน 2017, 08:53:33
เข้าไปดูที่ github ไม่มีอะไรเลยครับ ลบแล้วหรือครับ???


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: xindy ที่ 07 มิถุนายน 2017, 09:16:24
กำลังแก้ไข code ใหม่ครับ


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: ANALOGY ที่ 07 มิถุนายน 2017, 09:33:03
เติม TrueMoney => เก็บค่าลงDB => แสดงผล (True,False) => ที่เหลือจะเอาไปประยุกต์เป็น VIP หรืออะไรก็ได้เนอะง่ายดี  :wanwan007:


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: maneemeena ที่ 07 มิถุนายน 2017, 09:38:35
กำลังแก้ไข code ใหม่ครับ
ผมก็ว่าโค้ดมันแปลกๆ เลยเอามาปรับปรุงหน่อย ใช้ได้เลยครับ เหลือแค่ลองเติมเงิน  :wanwan020: :wanwan020: :wanwan020:
(https://www.uppic.org/image-2F78_59376648.jpg)


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: tanutsun ที่ 07 มิถุนายน 2017, 09:49:24
ปัก รอครับ :wanwan017:


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: AbuseMan ที่ 07 มิถุนายน 2017, 10:04:04
รอจัดด้วยคน


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: xindy ที่ 07 มิถุนายน 2017, 10:38:00
ปรับปรุงเสร็จส่งกลับมาให้ชมบ้างนะครับ  :-[
กำลังแก้ไข code ใหม่ครับ
ผมก็ว่าโค้ดมันแปลกๆ เลยเอามาปรับปรุงหน่อย ใช้ได้เลยครับ เหลือแค่ลองเติมเงิน  :wanwan020: :wanwan020: :wanwan020:
(https://www.uppic.org/image-2F78_59376648.jpg)


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: G1 ที่ 07 มิถุนายน 2017, 12:37:38
รอติดตามครับ :wanwan017:


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: thaigopher ที่ 07 มิถุนายน 2017, 12:50:49
ตามครับ


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: maneemeena ที่ 07 มิถุนายน 2017, 15:02:57
ปรับปรุงเสร็จส่งกลับมาให้ชมบ้างนะครับ  :-[
กำลังแก้ไข code ใหม่ครับ
ผมก็ว่าโค้ดมันแปลกๆ เลยเอามาปรับปรุงหน่อย ใช้ได้เลยครับ เหลือแค่ลองเติมเงิน  :wanwan020: :wanwan020: :wanwan020:
(https://www.uppic.org/image-2F78_59376648.jpg)

PM ไปให้แล้วครับ


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: xindy ที่ 07 มิถุนายน 2017, 18:35:51
จัดไปครับ https://github.com/exzajung/class.truewallet.php


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: affsom ที่ 07 มิถุนายน 2017, 18:41:33
 :wanwan020: :wanwan020: :wanwan020:

แหล่มเลย +++

ขอบคุณมากครับ


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: Magic00 ที่ 07 มิถุนายน 2017, 18:52:39
น่าสนใจมากครับ แต่ผมไม่เก่งเรื่องโค้ดเอาสะเลย  :'(


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: GothicRaccoon ที่ 07 มิถุนายน 2017, 19:41:03
น่าสนใจมากครับ PM หน่อยครับส่งไม่ไป


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: lnwnuyhod ที่ 07 มิถุนายน 2017, 23:08:06
ไม่ได้เข้ามาซะนาน
มาเจอของดีเลยวันนี้
ลดค่าใช้จ่ายได้อีกหน่อยนึง
เอาไปลองใช้แล้ว ตัดบัตรก็ไว
ขอบคุณมากครับ


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: seeza ที่ 07 มิถุนายน 2017, 23:45:43
ดีเลยครับ แต่ถ้าเอาไปใส่เว็บ จะติดตรงที่มีคนมาแกล้งใส่รหัสผิดบ่อยๆ เนี้ยแหละ


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู&#
เริ่มหัวข้อโดย: xindy ที่ 08 มิถุนายน 2017, 05:24:39
เท่าที่ทดสอบใส่ผิด ผิดได้หลายครั้งยังไม่โดนบล๊อคเลยนะครับ
ดีเลยครับ แต่ถ้าเอาไปใส่เว็บ จะติดตรงที่มีคนมาแกล้งใส่รหัสผิดบ่อยๆ เนี้ยแหละ



หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: wich2009 ที่ 08 มิถุนายน 2017, 06:03:06
ขอบคุณ ครับ


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู&#
เริ่มหัวข้อโดย: lnwnuyhod ที่ 08 มิถุนายน 2017, 10:08:26
เท่าที่ทดสอบใส่ผิด ผิดได้หลายครั้งยังไม่โดนบล๊อคเลยนะครับ
ดีเลยครับ แต่ถ้าเอาไปใส่เว็บ จะติดตรงที่มีคนมาแกล้งใส่รหัสผิดบ่อยๆ เนี้ยแหละ

ผมว่าไม่น่าจะบล็อคน่ะ
เราก็เอาเลขบัตรผิดที่คิดว่าจะมีคนผิดใส่ในฐาน แล้วก็ให้เช็คจากฐานก่อนว่ามีบัตรนี้แล้วหรือยัง ถ้ามีแล้วก็ไม่ต้องให้มันส่งไป แค่นี้มันก็ไม่ส่งไปทุกครั่งที่ผิดหรือเติมซ้ำละครับ


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: SSpeed ที่ 09 มิถุนายน 2017, 06:43:42
โพสน้อย แต่ต่อยหนัก มากครับ


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: xindy ที่ 09 มิถุนายน 2017, 10:00:23
อัพเดทใหม่ล่าสุดน่าจะดีขึ้นเยอะแล้วครับ

ระบบตัดบัตร TrueMoney เข้า TrueWallet เลยไม่ผ่านตัวกลางของใครทั้งนั้นเข้าตรงกระเป๋าเลยครับ

Update Code 9/6/2560
โค๊ด:
class TrueWallet{
public  $username;
public  $password;
private $passhash;
//Config TrueWallet ห้ามแก้ไขหากไม่รู้ค่าที่แท้จริง
private $login_type = "email";
private $api_signin = "https://api-ewm.truemoney.com/api/v1/signin?&";
private $api_profile = "https://api-ewm.truemoney.com/api/v1/profile/";
private $api_topup = "https://api-ewm.truemoney.com/api/api/v1/topup/mobile/";
private $device_os = "android";
private $device_id = "d520d0d12d0d48cb89394905168c6ed5";
private $device_type = "CPH1611";
private $device_version = "6.0.1";
private $app_name = "wallet";
private $app_version = "2.9.14";
private $deviceToken = "fUUbZJ9nwBk:APA91bHHgBBHhP9rqBEon_BtUNz3rLHQ-sYXnezA10PRSWQTwFpMvC9QiFzh-CqPsbWEd6x409ATC5RVsHAfk_-14cSqVdGzhn8iX2K_DiNHvpYfMMIzvFx_YWpYj5OaEzMyIPh3mgtx";
private $mobileTracking = "dJyFzn\/GIq7lrjv2RCsZbphpp0L\/W2+PsOTtOpg352mgWrt4XAEAAA==";
//End Config

public function __construct($user,$pass) {
$this->username = $user;
$this->password = $pass;
$this->passhash = sha1($user.$pass);
}

public function GetToken(){
$url = $this->api_signin.'device_os='.$this->device_os.'&device_id='.$this->device_id.'&device_type='.$this->device_type.'&device_version='.$this->device_version.'&app_name='.$this->app_name.'&app_version='.$this->app_version;
$header = array(
"Host: api-ewm.truemoney.com",
"Content-Type: application/json"
);
$postfield = array(
"username"=>$this->username,
"password"=>$this->passhash,
"type"=>$this->login_type,
"deviceToken"=>$this->deviceToken,
"mobileTracking"=>$this->mobileTracking,
);
$data_string = json_encode($postfield);

return $this->wallet_curl($url,$data_string,$header);
}

public function Profile($token){
$url = $this->api_profile.$token.'?&device_os=android&device_id='.$this->device_id.'&device_type='.$this->device_type.'&device_version='.$this->device_version.'&app_name='.$this->app_name.'&app_version='.$this->app_version;
$header = array("Host: api-ewm.truemoney.com");
return $this->wallet_curl($url,false,$header);

}

public function Topup($cashcard,$token){
$url = $this->api_topup.time()."/".$token."/cashcard/".$cashcard;
$header = array("Host: api-ewm.truemoney.com");
return $this->wallet_curl($url,true,$header);
}

private function wallet_curl($url,$data,$header){
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false); 
if($data){
curl_setopt($ch,CURLOPT_CUSTOMREQUEST, "POST");                                                                     
curl_setopt($ch,CURLOPT_POSTFIELDS, $data);         
}                                 
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);   
curl_setopt($ch,CURLOPT_USERAGENT,'');
$result = curl_exec($ch);
return $result;
}
}
โค๊ด:
$wallet = new TrueWallet('YOUR EMAIL','YOUR PASSWORD');
$token = json_decode($wallet->GetToken(),true)['data']['accessToken'];
$profile = $wallet->Profile($token);
$topup = $wallet->Topup('เลขบบัตรทรูมั่นนี่',$token);
Download https://github.com/exzajung/class.truewallet.php
ทดสอบได้ที่ https://www.xindy.in/truewallet
เข้าตรวจสอบผ่านเว็บ https://wallet.truemoney.com/ หรือจะเช็คที่แอพก็ได้นะครับ


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: AbuseMan ที่ 09 มิถุนายน 2017, 10:08:39
deviceToken / mobileTracking ใช้ sniff ค่าเอาหรอครับ?


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: xindy ที่ 09 มิถุนายน 2017, 10:10:45
ครับ
deviceToken / mobileTracking ใช้ sniff ค่าเอาหรอครับ?


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: gemble40 ที่ 09 มิถุนายน 2017, 11:35:56
เยี่ยมจริงๆ เยี่ยมจริงๆ


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: neverdiexxl ที่ 09 มิถุนายน 2017, 14:56:06
Config TrueWallet โค๊ดส่วนตรงนี้ไปเอามาจากไหนเหรอครับ
แล้วมันใช้ได้ตลอดหรือเปล่าครับ


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: thaisew ที่ 09 มิถุนายน 2017, 21:19:10
แจ่มครับ   :-*


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: lnwnuyhod ที่ 09 มิถุนายน 2017, 22:24:31
ขออนุญาตคุณ xindy ยืมหน้าเว็บนะครับ
อันนี้เป็นระบบให้ยูเซอร์เติมเงิน สำหรับ mysql เผื่อใครเขียนไม่ค่อยเก่ง ผมก็ยังเขียนไม่เก่ง เอามาแบ่งๆกัน
แก้จากของคุณ xindy นิดหน่อย
แก้ไข config ที่ class.truewallet.php

index.php
โค๊ด:
<?php
@session_start();
if(!isset(
$_SESSION['uid']))
$_SESSION['uid'] = '';
?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>Test API TrueWallet</title>

    <!-- Bootstrap -->
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Kanit" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
<script type="text/javascript">
function isNumberKey(evt){
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
}
</script>
  </head>
  <style>
html,body {
 padding: 0px;
 margin-top:25px;
 width: 100%;
 height: 100%;
}
body {
 font-family: 'Kanit', sans-serif;
 font-size: 14px;
 background: #1c1e21;
 color:  #878383 ;
 position: relative;
}
.form-signin {
  max-width: 330px;
  padding: 15px;
  margin: 0 auto;
}
.form-signin .form-signin-heading,
.form-signin .checkbox {
  margin-bottom: 10px;
}
.form-signin .checkbox {
  font-weight: normal;
}
.form-signin .form-control {
  position: relative;
  height: auto;
  -webkit-box-sizing: border-box;
     -moz-box-sizing: border-box;
          box-sizing: border-box;
  padding: 10px;
  font-size: 16px;
}
.form-signin .form-control:focus {
  z-index: 2;
}
.form-signin input[type="email"] {
  margin-bottom: -1px;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}
.form-signin input[type="password"] {
  margin-bottom: 10px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.error_code {
    color: #F00;
    font-size: 15px;
    font-width: bold;
    margin-left: 15px;
    line-height: 16px;
    margin-bottom: 4px;
    height: 16px;
    text-align: center;
}
  </style>
  <body style="background: url(bg.png);">
<div class="container free_tck">
<div class="row">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-heading">TrueWallet ( Test API )</div>
<div class="panel-body">
<?php
if($_SESSION['uid'] == '')
{
?>

  <form role="form" method="post" class="col-md-12">
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">User</div>
<input type="text" id="user" name="user" class="form-control" placeholder="UserName" required autocomplete="off">
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">Pass</div>
<input type="password" id="pass" name="pass" class="form-control" placeholder="Password" required autocomplete="off">
</div>
</div>
<button class="btn btn-lg btn-primary btn-block free_btn" name="login" type="submit">เข้าสู่ระบบ</button>
</form>
<?php
if(!isset($_POST['login']))
$_POST['login'] = '';
else
{
include("class.truewallet.php");
$wallet = new TrueWallet();
$wallet->Connect();
if(!$wallet->Login($_POST['user'],$_POST['pass'],false))
echo "cant login";
else
{
$_SESSION['uid'] = $_POST['user'];
header("Location: ./");
}
}
}
else if($_SESSION['uid'] <> '')
{
?>

<form role="form" method="post" class="col-md-12">
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">True Money</div>
<input type="text" id="number" name="number" class="form-control" placeholder="รหัสบัตรทรูมันนี่" onkeypress="return isNumberKey(event)" maxlength=14 required autocomplete="off">
</div>
</div>
<button class="btn btn-lg btn-primary btn-block free_btn" name="topup" type="submit">เติมเงิน</button>
</form>

<form role="form" method="post" class="col-md-12">
<p></p>
<button class="btn btn-lg btn-primary btn-block free_btn" name="logout" type="submit">ออกจากระบบ</button>
</form>
<?php
if(!isset($_POST['topup']))
$_POST['topup'] = '';
else
{
include("class.truewallet.php");
$wallet = new TrueWallet();
$wallet->Connect();
$a $wallet->Topup($_SESSION['uid'],$_POST['number']);
print_r($a);
}
if(!isset($_POST['logout']))
$_POST['logout'] = '';
else
{
@session_destroy();
header("Location: ./");
}
}
?>

</div>
</div>
</div>
</div>
    </div> <!-- /container -->
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  </body>
</html>

class.truewallet.php
โค๊ด:
<?php
class TrueWallet{
//mysql
private $DbHost  ''; //ไอพี sql
private $DbUser  ''; //ไอดี sql
private $DbPass  ''; //รหัส sql
private $DbName  ''; //ชื่อฐานข้อมูล
private $DbPort  ''; //พอร์ต sql
private $tbName  ''; //ชื่อตารางที่เก็บข้อมูลยูเซอร์
private $fdID  ''; //ฟิลด์ไอดี
private $fdPS  ''; //ฟิลด์พาสเวิร์ด
private $fdCS ''; //ฟิลด์พ้อย
private $DbQuery;

//True Money
private $trueID  ''; //อีเมลสำหรับล็อคอินทรูวอเล็ต
private $truePS ''; //พาสเวิร์ดสำหรับล็อคอินทรูวอเล็ต
private $passhash;

//Config TrueWallet ห้ามแก้ไขหากไม่รู้ค่าที่แท้จริง
private $login_type "email"
private $api_signin "https://api-ewm.truemoney.com/api/v1/signin?&"
private $api_profile "https://api-ewm.truemoney.com/api/v1/profile/"
private $api_topup "https://api-ewm.truemoney.com/api/api/v1/topup/mobile/"
private $device_os "android"
private $device_id "d520d0d12d0d48cb89394905168c6ed5"
private $device_type "CPH1611"
private $device_version "6.0.1"
private $app_name "wallet"
private $app_version "2.9.14"
private $deviceToken "fUUbZJ9nwBk:APA91bHHgBBHhP9rqBEon_BtUNz3rLHQ-sYXnezA10PRSWQTwFpMvC9QiFzh-CqPsbWEd6x409ATC5RVsHAfk_-14cSqVdGzhn8iX2K_DiNHvpYfMMIzvFx_YWpYj5OaEzMyIPh3mgtx"
private $mobileTracking "dJyFzn/GIq7lrjv2RCsZbphpp0L/W2 PsOTtOpg352mgWrt4XAEAAA=="
private $walletToken '';
//End Config

//พ้อยที่จะได้รับ ตามราคาบัตร
private $point1  = 50;
private $point2  = 90;
private $point3  = 150;
private $point4  = 300;
private $point5  = 500;
private $point6  = 1000;
//

public function __construct() {
$this->passhash sha1($this->trueID.$this->truePS);
}

private function GetToken(){
$url $this->api_signin.'device_os='.$this->device_os.'&device_id='.$this->device_id.'&device_type='.$this->device_type.'&device_version='.$this->device_version.'&app_name='.$this->app_name.'&app_version='.$this->app_version;
$header = array(
"Host: api-ewm.truemoney.com",
"Content-Type: application/json"
);
$postfield = array(
"username"=>$this->trueID,
"password"=>$this->passhash,
"type"=>$this->login_type,
"deviceToken"=>$this->deviceToken,
"mobileTracking"=>$this->mobileTracking,
);
return $this->wallet_curl($url,json_encode($postfield),$header);
}

public function Profile(){
$url $this->api_profile.$this->walletToken.'?&device_os=android&device_id='.$this->device_id.'&device_type='.$this->device_type.'&device_version='.$this->device_version.'&app_name='.$this->app_name.'&app_version='.$this->app_version;
$header = array("Host: api-ewm.truemoney.com");
return $this->wallet_curl($url,false,$header);
}

/*
*/
private function wallet_curl($url,$data,$header){
$ch curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);  
if($data){
curl_setopt($ch,CURLOPT_CUSTOMREQUEST"POST");                                                                     
curl_setopt($ch,CURLOPT_POSTFIELDS$data);         
}                                  
curl_setopt($ch,CURLOPT_RETURNTRANSFERtrue);   
curl_setopt($ch,CURLOPT_USERAGENT,'');
$result curl_exec($ch);
return json_decode($result,true);
}

/*
@param1 $user = ไอดีที่จะเติม
@param2 $card = เลขบัตรทรูมันนี่

return code -9999 = ยูเซอร์ที่จะเติมว่างเปล่า หรือ เลขบัตรว่างเปล่า หรือ เลขบัตรไม่ใช่ตัวเลข หรือ เลขบัตรน้อยกว่า 14 หลัก
return code -1001 = บัตรใช้ไปแล้ว หรือ มีในฐานข้อมูลแล้ว
return code -1002 = เติมผิด หรือ บัตรมั่ว
return code 20000 = เติมสำเร็จ
*/

public function Topup($user,$card){
//เช็คไอดีและบัตร
if($user == '' || $card == '' || !is_numeric($card) || strlen($card) < 14)
{
return -9999;
}
//เช็คเลขบัตรซ้ำ
if(!$this->CheckCard($card))
{
return -1001;
}
//
$token $this->GetToken();
$url $this->api_topup.time()."/".$token['data']['accessToken']."/cashcard/".$card;
$header = array("Host: api-ewm.truemoney.com");
$topup $this->wallet_curl($url,true,$header);

if($topup['code'] < 0){ //-1001 = บัตรใช้ไปแล้ว  // -1002 = บัตรผิด หรือ บัตรมั่ว
$amount 0;
$status $topup['code'];
}else if($topup['transactionId'] <> ''){ //เติมเงินสำเร็จ
$amount $topup['amount'];
$status 20000;
}
if(!$this->InsertCard($user$card$amount$status)){
//หาก insert ไม่ได้ให้สร้าง error log
$update "INSERT INTO truemoney (card, uid, uip, amount, status, time) VALUES ('$card', '$user', '".$this->GetUserIP()."', $amount$status, '".$this->GetTime()."')";
$this->LogError("Error : " .$update);
$this->LogError("Card : " $card);
$this->LogError("User : " $user);
$this->LogError("IP : " $this->GetUserIP());
$this->LogError("Amount : " $amount);
$this->LogError("Status : " $status);
$this->LogError("Time : " $this->GetTime());
$this->LogError("=============================================================");
}
if($amount && !$this->Update($this->tbName$this->fdCS$this->GetPoint($amount), $user)){
//หาก update ไม่ได้ให้สร้าง error log
$update "UPDATE $this->tbName SET $this->fdCS = $this->fdCS   $this->GetPoint($amount) WHERE $this->fdID = '$user'";
$this->LogError("Error : " $update);
$this->LogError("User : " $user);
$this->LogError("Amount : " $this->GetPoint($amount));
$this->LogError("Time : " $this->GetTime());
$this->LogError("=============================================================");
}
return $status;
}

/**/
public function Connect(){
$this->DbQuery = new mysqli($this->DbHost$this->DbUser$this->DbPass$this->DbName$this->DbPort);
if ($this->DbQuery->connect_errno
{
printf("Connect failed: %s
"
$this->DbQuery->connect_error);
exit();
}
$this->DbQuery->query("SET NAMES UTF8");
}

/**/
public function Close(){
$this->DbQuery->close();
}

/*
@param1 $user = ไอดี 
@param2 $card = หมายเลขบัตรทรูมันนี่
@param3 $amount = ราคาบัตร
@param4 $status = สถานะ
*/
private function InsertCard($user$card$amount$status){
$query "INSERT INTO truemoney (card, uid, uip, amount, status, time) VALUES ('$card', '$user', '".$this->GetUserIP()."', $amount$status, '".$this->GetTime()."')";
if(!mysqli_query($this->DbQuery$query))
{
return false;
}
return true;
}

/*
@param1 $table = ชื่อตารางของฐานข้อมูล
@param2 $column = ชื่อคอลั่มน์ของฐานข้อมูล 
@param3 $value = ค่าที่จะอัพเดท ตัวอย่าง หากต้องการลบให้ใส่ -5 / หากต้องการบวกให้ใส่ 5
@param4 $where = จะให้อัพเดทที่ไอดีไหน/ตรงไหน
*/
private function Update($table$field$value$where){
$query = ("UPDATE $table SET $field = $field   $value WHERE $this->fdID = '$where'");
if(!mysqli_query($this->DbQuery$query))
{
return false;
}
return true;
}

/*
@param1 $user = ไอดี
@param2 $pass = พาส
@param3 $md5  = 0 ไม่ใช้ md5 / 1 ใช้ md5
ตัวอย่าง ไม่ใช้ MD5 = LogIn('testID', 'testPS', 0);
ตัวอย่าง ใช้ MD5 = LogIn('testID', 'testPS', 1);
*/
public function Login($user$pass$md5){
$pass $md5 md5($pass) : $pass;
$query "SELECT * FROM $this->tbName where $this->fdID = '$user' and $this->fdPS = '$pass'";
if(!mysqli_query($this->DbQuery$query))
return false;

$result $this->DbQuery->query($query);
if ($result->num_rows <= 0)
return false;

return true;
}

/*
@param1 $card = เลขบัตรทรูมันนี่
*/
private function CheckCard($card){
$result $this->DbQuery->query("SELECT card FROM truemoney WHERE card = '$card'");
if ($result->num_rows 0)
return false;
return true;
}

private function GetPoint($amount){
if($amount == 50)
return $this->point1;
else if($amount == 90)
return $this->point2;
else if($amount == 150)
return $this->point3;
else if($amount == 300)
return $this->point4;
else if($amount == 500)
return $this->point5;
else if($amount == 1000)
return $this->point6;
return 0;
}

private function GetUserIP()
{
$client  = @$_SERVER['HTTP_CLIENT_IP'];
$forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
$remote  = @$_SERVER['REMOTE_ADDR'];
if(filter_var($clientFILTER_VALIDATE_IP))
$ip $client;
elseif(filter_var($forwardFILTER_VALIDATE_IP))
$ip $forward;
else
$ip $remote;
return $ip;
}

private function GetTime()
{
return date("Y-m-d H:i:s");
}

/*
@param1 $str = log text
*/
private function LogError($str){
if (!file_exists('log')) {
@mkdir('log'0777true);
@file_put_contents('log/index.html''');
}
$now1 date("Y-m-d");
$now2 date("Y-m-d H:i:s");
$file 'log/log_'.$now1.'.txt';
$current = @file_get_contents($file);
$current .= '['.$now2.'] '.$str."
"
;
@file_put_contents($file$current);
}
}
?>


truemoney.sql
โค๊ด:
DROP TABLE IF EXISTS `truemoney`;
CREATE TABLE `truemoney` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `card` varchar(14) COLLATE utf8_unicode_ci NOT NULL,
  `uid` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `uip` varchar(16) COLLATE utf8_unicode_ci NOT NULL,
  `amount` int(4) NOT NULL DEFAULT '0',
  `status` int(11) NOT NULL,
  `time` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: darkonwrite ที่ 11 มิถุนายน 2017, 00:48:26
จัดไปครับ


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: SSpeed ที่ 11 มิถุนายน 2017, 15:32:55
เวบรับตัดบัตร หลายค่ายลดราคา เหลือ 14%-14.4% กันหมด
ต้อนรับ api ที่ท่านๆ เอามาแจก


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: SaveYourLife ที่ 14 มิถุนายน 2017, 16:48:42

แหล่มเลย true money มี API ด้วยหรอเนี้ย


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: ANALOGY ที่ 14 มิถุนายน 2017, 17:21:59
ขออนุญาตคุณ xindy ยืมหน้าเว็บนะครับ
อันนี้เป็นระบบให้ยูเซอร์เติมเงิน สำหรับ mysql เผื่อใครเขียนไม่ค่อยเก่ง ผมก็ยังเขียนไม่เก่ง เอามาแบ่งๆกัน
แก้จากของคุณ xindy นิดหน่อย
แก้ไข config ที่ class.truewallet.php

index.php
โค๊ด:
<?php
@session_start();
if(!isset(
$_SESSION['uid']))
$_SESSION['uid'] = '';
?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>Test API TrueWallet</title>

    <!-- Bootstrap -->
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Kanit" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
<script type="text/javascript">
function isNumberKey(evt){
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
}
</script>
  </head>
  <style>
html,body {
 padding: 0px;
 margin-top:25px;
 width: 100%;
 height: 100%;
}
body {
 font-family: 'Kanit', sans-serif;
 font-size: 14px;
 background: #1c1e21;
 color:  #878383 ;
 position: relative;
}
.form-signin {
  max-width: 330px;
  padding: 15px;
  margin: 0 auto;
}
.form-signin .form-signin-heading,
.form-signin .checkbox {
  margin-bottom: 10px;
}
.form-signin .checkbox {
  font-weight: normal;
}
.form-signin .form-control {
  position: relative;
  height: auto;
  -webkit-box-sizing: border-box;
     -moz-box-sizing: border-box;
          box-sizing: border-box;
  padding: 10px;
  font-size: 16px;
}
.form-signin .form-control:focus {
  z-index: 2;
}
.form-signin input[type="email"] {
  margin-bottom: -1px;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}
.form-signin input[type="password"] {
  margin-bottom: 10px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.error_code {
    color: #F00;
    font-size: 15px;
    font-width: bold;
    margin-left: 15px;
    line-height: 16px;
    margin-bottom: 4px;
    height: 16px;
    text-align: center;
}
  </style>
  <body style="background: url(bg.png);">
<div class="container free_tck">
<div class="row">
<div class="col-md-12">
<div class="panel panel-primary">
<div class="panel-heading">TrueWallet ( Test API )</div>
<div class="panel-body">
<?php
if($_SESSION['uid'] == '')
{
?>

  <form role="form" method="post" class="col-md-12">
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">User</div>
<input type="text" id="user" name="user" class="form-control" placeholder="UserName" required autocomplete="off">
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">Pass</div>
<input type="password" id="pass" name="pass" class="form-control" placeholder="Password" required autocomplete="off">
</div>
</div>
<button class="btn btn-lg btn-primary btn-block free_btn" name="login" type="submit">เข้าสู่ระบบ</button>
</form>
<?php
if(!isset($_POST['login']))
$_POST['login'] = '';
else
{
include("class.truewallet.php");
$wallet = new TrueWallet();
$wallet->Connect();
if(!$wallet->Login($_POST['user'],$_POST['pass'],false))
echo "cant login";
else
{
$_SESSION['uid'] = $_POST['user'];
header("Location: ./");
}
}
}
else if($_SESSION['uid'] <> '')
{
?>

<form role="form" method="post" class="col-md-12">
<div class="form-group">
<div class="input-group">
<div class="input-group-addon">True Money</div>
<input type="text" id="number" name="number" class="form-control" placeholder="รหัสบัตรทรูมันนี่" onkeypress="return isNumberKey(event)" maxlength=14 required autocomplete="off">
</div>
</div>
<button class="btn btn-lg btn-primary btn-block free_btn" name="topup" type="submit">เติมเงิน</button>
</form>

<form role="form" method="post" class="col-md-12">
<p></p>
<button class="btn btn-lg btn-primary btn-block free_btn" name="logout" type="submit">ออกจากระบบ</button>
</form>
<?php
if(!isset($_POST['topup']))
$_POST['topup'] = '';
else
{
include("class.truewallet.php");
$wallet = new TrueWallet();
$wallet->Connect();
$a $wallet->Topup($_SESSION['uid'],$_POST['number']);
print_r($a);
}
if(!isset($_POST['logout']))
$_POST['logout'] = '';
else
{
@session_destroy();
header("Location: ./");
}
}
?>

</div>
</div>
</div>
</div>
    </div> <!-- /container -->
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  </body>
</html>

class.truewallet.php
โค๊ด:
<?php
class TrueWallet{
//mysql
private $DbHost  ''; //ไอพี sql
private $DbUser  ''; //ไอดี sql
private $DbPass  ''; //รหัส sql
private $DbName  ''; //ชื่อฐานข้อมูล
private $DbPort  ''; //พอร์ต sql
private $tbName  ''; //ชื่อตารางที่เก็บข้อมูลยูเซอร์
private $fdID  ''; //ฟิลด์ไอดี
private $fdPS  ''; //ฟิลด์พาสเวิร์ด
private $fdCS ''; //ฟิลด์พ้อย
private $DbQuery;

//True Money
private $trueID  ''; //อีเมลสำหรับล็อคอินทรูวอเล็ต
private $truePS ''; //พาสเวิร์ดสำหรับล็อคอินทรูวอเล็ต
private $passhash;

//Config TrueWallet ห้ามแก้ไขหากไม่รู้ค่าที่แท้จริง
private $login_type "email"
private $api_signin "https://api-ewm.truemoney.com/api/v1/signin?&"
private $api_profile "https://api-ewm.truemoney.com/api/v1/profile/"
private $api_topup "https://api-ewm.truemoney.com/api/api/v1/topup/mobile/"
private $device_os "android"
private $device_id "d520d0d12d0d48cb89394905168c6ed5"
private $device_type "CPH1611"
private $device_version "6.0.1"
private $app_name "wallet"
private $app_version "2.9.14"
private $deviceToken "fUUbZJ9nwBk:APA91bHHgBBHhP9rqBEon_BtUNz3rLHQ-sYXnezA10PRSWQTwFpMvC9QiFzh-CqPsbWEd6x409ATC5RVsHAfk_-14cSqVdGzhn8iX2K_DiNHvpYfMMIzvFx_YWpYj5OaEzMyIPh3mgtx"
private $mobileTracking "dJyFzn/GIq7lrjv2RCsZbphpp0L/W2 PsOTtOpg352mgWrt4XAEAAA=="
private $walletToken '';
//End Config

//พ้อยที่จะได้รับ ตามราคาบัตร
private $point1  = 50;
private $point2  = 90;
private $point3  = 150;
private $point4  = 300;
private $point5  = 500;
private $point6  = 1000;
//

public function __construct() {
$this->passhash sha1($this->trueID.$this->truePS);
}

private function GetToken(){
$url $this->api_signin.'device_os='.$this->device_os.'&device_id='.$this->device_id.'&device_type='.$this->device_type.'&device_version='.$this->device_version.'&app_name='.$this->app_name.'&app_version='.$this->app_version;
$header = array(
"Host: api-ewm.truemoney.com",
"Content-Type: application/json"
);
$postfield = array(
"username"=>$this->trueID,
"password"=>$this->passhash,
"type"=>$this->login_type,
"deviceToken"=>$this->deviceToken,
"mobileTracking"=>$this->mobileTracking,
);
return $this->wallet_curl($url,json_encode($postfield),$header);
}

public function Profile(){
$url $this->api_profile.$this->walletToken.'?&device_os=android&device_id='.$this->device_id.'&device_type='.$this->device_type.'&device_version='.$this->device_version.'&app_name='.$this->app_name.'&app_version='.$this->app_version;
$header = array("Host: api-ewm.truemoney.com");
return $this->wallet_curl($url,false,$header);
}

/*
*/
private function wallet_curl($url,$data,$header){
$ch curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);  
if($data){
curl_setopt($ch,CURLOPT_CUSTOMREQUEST"POST");                                                                     
curl_setopt($ch,CURLOPT_POSTFIELDS$data);         
}                                  
curl_setopt($ch,CURLOPT_RETURNTRANSFERtrue);   
curl_setopt($ch,CURLOPT_USERAGENT,'');
$result curl_exec($ch);
return json_decode($result,true);
}

/*
@param1 $user = ไอดีที่จะเติม
@param2 $card = เลขบัตรทรูมันนี่

return code -9999 = ยูเซอร์ที่จะเติมว่างเปล่า หรือ เลขบัตรว่างเปล่า หรือ เลขบัตรไม่ใช่ตัวเลข หรือ เลขบัตรน้อยกว่า 14 หลัก
return code -1001 = บัตรใช้ไปแล้ว หรือ มีในฐานข้อมูลแล้ว
return code -1002 = เติมผิด หรือ บัตรมั่ว
return code 20000 = เติมสำเร็จ
*/

public function Topup($user,$card){
//เช็คไอดีและบัตร
if($user == '' || $card == '' || !is_numeric($card) || strlen($card) < 14)
{
return -9999;
}
//เช็คเลขบัตรซ้ำ
if(!$this->CheckCard($card))
{
return -1001;
}
//
$token $this->GetToken();
$url $this->api_topup.time()."/".$token['data']['accessToken']."/cashcard/".$card;
$header = array("Host: api-ewm.truemoney.com");
$topup $this->wallet_curl($url,true,$header);

if($topup['code'] < 0){ //-1001 = บัตรใช้ไปแล้ว  // -1002 = บัตรผิด หรือ บัตรมั่ว
$amount 0;
$status $topup['code'];
}else if($topup['transactionId'] <> ''){ //เติมเงินสำเร็จ
$amount $topup['amount'];
$status 20000;
}
if(!$this->InsertCard($user$card$amount$status)){
//หาก insert ไม่ได้ให้สร้าง error log
$update "INSERT INTO truemoney (card, uid, uip, amount, status, time) VALUES ('$card', '$user', '".$this->GetUserIP()."', $amount$status, '".$this->GetTime()."')";
$this->LogError("Error : " .$update);
$this->LogError("Card : " $card);
$this->LogError("User : " $user);
$this->LogError("IP : " $this->GetUserIP());
$this->LogError("Amount : " $amount);
$this->LogError("Status : " $status);
$this->LogError("Time : " $this->GetTime());
$this->LogError("=============================================================");
}
if($amount && !$this->Update($this->tbName$this->fdCS$this->GetPoint($amount), $user)){
//หาก update ไม่ได้ให้สร้าง error log
$update "UPDATE $this->tbName SET $this->fdCS = $this->fdCS   $this->GetPoint($amount) WHERE $this->fdID = '$user'";
$this->LogError("Error : " $update);
$this->LogError("User : " $user);
$this->LogError("Amount : " $this->GetPoint($amount));
$this->LogError("Time : " $this->GetTime());
$this->LogError("=============================================================");
}
return $status;
}

/**/
public function Connect(){
$this->DbQuery = new mysqli($this->DbHost$this->DbUser$this->DbPass$this->DbName$this->DbPort);
if ($this->DbQuery->connect_errno
{
printf("Connect failed: %s
"
$this->DbQuery->connect_error);
exit();
}
$this->DbQuery->query("SET NAMES UTF8");
}

/**/
public function Close(){
$this->DbQuery->close();
}

/*
@param1 $user = ไอดี 
@param2 $card = หมายเลขบัตรทรูมันนี่
@param3 $amount = ราคาบัตร
@param4 $status = สถานะ
*/
private function InsertCard($user$card$amount$status){
$query "INSERT INTO truemoney (card, uid, uip, amount, status, time) VALUES ('$card', '$user', '".$this->GetUserIP()."', $amount$status, '".$this->GetTime()."')";
if(!mysqli_query($this->DbQuery$query))
{
return false;
}
return true;
}

/*
@param1 $table = ชื่อตารางของฐานข้อมูล
@param2 $column = ชื่อคอลั่มน์ของฐานข้อมูล 
@param3 $value = ค่าที่จะอัพเดท ตัวอย่าง หากต้องการลบให้ใส่ -5 / หากต้องการบวกให้ใส่ 5
@param4 $where = จะให้อัพเดทที่ไอดีไหน/ตรงไหน
*/
private function Update($table$field$value$where){
$query = ("UPDATE $table SET $field = $field   $value WHERE $this->fdID = '$where'");
if(!mysqli_query($this->DbQuery$query))
{
return false;
}
return true;
}

/*
@param1 $user = ไอดี
@param2 $pass = พาส
@param3 $md5  = 0 ไม่ใช้ md5 / 1 ใช้ md5
ตัวอย่าง ไม่ใช้ MD5 = LogIn('testID', 'testPS', 0);
ตัวอย่าง ใช้ MD5 = LogIn('testID', 'testPS', 1);
*/
public function Login($user$pass$md5){
$pass $md5 md5($pass) : $pass;
$query "SELECT * FROM $this->tbName where $this->fdID = '$user' and $this->fdPS = '$pass'";
if(!mysqli_query($this->DbQuery$query))
return false;

$result $this->DbQuery->query($query);
if ($result->num_rows <= 0)
return false;

return true;
}

/*
@param1 $card = เลขบัตรทรูมันนี่
*/
private function CheckCard($card){
$result $this->DbQuery->query("SELECT card FROM truemoney WHERE card = '$card'");
if ($result->num_rows 0)
return false;
return true;
}

private function GetPoint($amount){
if($amount == 50)
return $this->point1;
else if($amount == 90)
return $this->point2;
else if($amount == 150)
return $this->point3;
else if($amount == 300)
return $this->point4;
else if($amount == 500)
return $this->point5;
else if($amount == 1000)
return $this->point6;
return 0;
}

private function GetUserIP()
{
$client  = @$_SERVER['HTTP_CLIENT_IP'];
$forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
$remote  = @$_SERVER['REMOTE_ADDR'];
if(filter_var($clientFILTER_VALIDATE_IP))
$ip $client;
elseif(filter_var($forwardFILTER_VALIDATE_IP))
$ip $forward;
else
$ip $remote;
return $ip;
}

private function GetTime()
{
return date("Y-m-d H:i:s");
}

/*
@param1 $str = log text
*/
private function LogError($str){
if (!file_exists('log')) {
@mkdir('log'0777true);
@file_put_contents('log/index.html''');
}
$now1 date("Y-m-d");
$now2 date("Y-m-d H:i:s");
$file 'log/log_'.$now1.'.txt';
$current = @file_get_contents($file);
$current .= '['.$now2.'] '.$str."
"
;
@file_put_contents($file$current);
}
}
?>


truemoney.sql
โค๊ด:
DROP TABLE IF EXISTS `truemoney`;
CREATE TABLE `truemoney` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `card` varchar(14) COLLATE utf8_unicode_ci NOT NULL,
  `uid` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `uip` varchar(16) COLLATE utf8_unicode_ci NOT NULL,
  `amount` int(4) NOT NULL DEFAULT '0',
  `status` int(11) NOT NULL,
  `time` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

:wanwan017: ขอบคุณอีกครั้งคับ


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: kanesz12 ที่ 14 มิถุนายน 2017, 17:26:44
แจ่มแมวแวววับ!! :wanwan017:


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: buakaew ที่ 14 มิถุนายน 2017, 17:32:19
เยี่ยมเลย  :wanwan017:


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: mikedeathnote ที่ 14 มิถุนายน 2017, 18:06:13
ลองแล้วครับ คือเหมือนล็อครหัสตัวเองจาก ในหน้า แล้วให้ลูกค้ากดใส่บัตร จะโดนแฮ็คใหมเนี้ย ประเด็น


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: mikedeathnote ที่ 14 มิถุนายน 2017, 18:12:14
แจกหน่อยนะครับ รอลุ้นตัว เต็ม


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: SSpeed ที่ 15 มิถุนายน 2017, 03:58:46
ลองแล้วครับ คือเหมือนล็อครหัสตัวเองจาก ในหน้า แล้วให้ลูกค้ากดใส่บัตร จะโดนแฮ็คใหมเนี้ย ประเด็น

เบิก ถอน โอน ยังต้องใช้ otp อยู่นะครับ


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: nukerman ที่ 15 มิถุนายน 2017, 13:54:13
ลองแล้วครับ คือเหมือนล็อครหัสตัวเองจาก ในหน้า แล้วให้ลูกค้ากดใส่บัตร จะโดนแฮ็คใหมเนี้ย ประเด็น

Post แค่รหัสบัตรไปจะโดนแฮ็คได้ไง อ่ะครับ


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: sevenr ที่ 15 มิถุนายน 2017, 14:04:06
ขอบคุณครับ


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู&#
เริ่มหัวข้อโดย: xindy ที่ 15 มิถุนายน 2017, 14:38:32
เพิ่มเติมหากต้องการล๊อคอินด้วย PIN

Username ใส่ เบอร์โทร
Password ใส่ รหัส 4 หลักที่เราตั้งไว้
type ใส่เป็น mobile
อ้างถึง
$wallet = new TrueWallet('YOUR EMAIL','YOUR PASSWORD','email');
OR
$wallet = new TrueWallet('YOUR PHONNUMBER','YOUR PIN','mobile');
อ้างถึง
<?php
class TrueWallet{
   public  $username;
   public  $password;
   public  $login_type;
   private $passhash;
   //Config TrueWallet ห้ามแก้ไขหากไม่รู้ค่าที่แท้จริง
   private $api_signin = "https://api-ewm.truemoney.com/api/v1/signin?&";
   private $api_profile = "https://api-ewm.truemoney.com/api/v1/profile/";
   private $api_topup = "https://api-ewm.truemoney.com/api/api/v1/topup/mobile/";
   private $device_os = "android";
   private $device_id = "d520d0d12d0d48cb89394905168c6ed5";
   private $device_type = "CPH1611";
   private $device_version = "6.0.1";
   private $app_name = "wallet";
   private $app_version = "2.9.14";
   private $deviceToken = "fUUbZJ9nwBk:APA91bHHgBBHhP9rqBEon_BtUNz3rLHQ-sYXnezA10PRSWQTwFpMvC9QiFzh-CqPsbWEd6x409ATC5RVsHAfk_-14cSqVdGzhn8iX2K_DiNHvpYfMMIzvFx_YWpYj5OaEzMyIPh3mgtx";
   private $mobileTracking = "dJyFzn\/GIq7lrjv2RCsZbphpp0L\/W2+PsOTtOpg352mgWrt4XAEAAA==";
   //End Config
   
   public function __construct($user,$pass,$type) {
      $this->username = $user;
      $this->password = $pass;
      $this->login_type = $type;
      $this->passhash = sha1($user.$pass);
   }
   public function GetToken(){
      $url = $this->api_signin.'device_os='.$this->device_os.'&device_id='.$this->device_id.'&device_type='.$this->device_type.'&device_version='.$this->device_version.'&app_name='.$this->app_name.'&app_version='.$this->app_version;
      $header = array(
         "Host: api-ewm.truemoney.com",
         "Content-Type: application/json"
      );
      $postfield = array(
         "username"=>$this->username,
         "password"=>$this->passhash,
         "type"=>$this->login_type,
         "deviceToken"=>$this->deviceToken,
         "mobileTracking"=>$this->mobileTracking,
      );
      $data_string = json_encode($postfield);
      
      return $this->wallet_curl($url,$data_string,$header);
   }
   public function Profile($token){
      $url = $this->api_profile.$token.'?&device_os=android&device_id='.$this->device_id.'&device_type='.$this->device_type.'&device_version='.$this->device_version.'&app_name='.$this->app_name.'&app_version='.$this->app_version;
      $header = array("Host: api-ewm.truemoney.com");
      return $this->wallet_curl($url,false,$header);
   
   }
   public function Topup($cashcard,$token){
      $url = $this->api_topup.time()."/".$token."/cashcard/".$cashcard;
      $header = array("Host: api-ewm.truemoney.com");
      return $this->wallet_curl($url,true,$header);
   }
   
   private function wallet_curl($url,$data,$header){   
      $ch = curl_init();
      curl_setopt($ch,CURLOPT_URL,$url);
      curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
      curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
      curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);  
      if($data){
         curl_setopt($ch,CURLOPT_CUSTOMREQUEST, "POST");                                                                    
         curl_setopt($ch,CURLOPT_POSTFIELDS, $data);        
      }                                  
      curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);  
      curl_setopt($ch,CURLOPT_USERAGENT,'');
      $result = curl_exec($ch);
      return $result;
   }
}
?>


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: xindy ที่ 17 มิถุนายน 2017, 19:52:23
เพิ่มเติม https://github.com/xeleniumz/TrueWallet
TrueWallet

TrueWallet library For Node.js
PHP Version & Credit

visit this repository for php version https://github.com/exzajung/class.truewallet.php
System requirement

    babel transpiler
    node.js version 7.10 or higher
    request-promise-native Simplified HTTP request client for node.js package
    moment time management time management for node.js package

How to use

    install require package
    import this library to your controller
    send request data with post to endpoint and Enjoy !!

Debugging

There are at least three ways to debug the operation of request: Launch the node process like NODE_DEBUG=request node script.js (lib,request,otherlib works too). Set require('request').debug = true at any time Use the request-debug module to view request and response headers and bodies.


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียวเอาอยู่
เริ่มหัวข้อโดย: jakky ที่ 17 มิถุนายน 2017, 20:00:20
ใครเป็นโค้ด เขียนเป็นปลั๊กอินขาย รวยเลยน่ะเนี้ย


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียว ( TrueMoney Wallet )
เริ่มหัวข้อโดย: kasamsen ที่ 07 มกราคม 2018, 03:27:43
 :-* :-* :-*   อือหือ   เจอของดีเข้าให้ กำลังหัดเขียนโค๊ด และก็ ลองทำระบบ อันนี้เล่นพอดีเลยครับพอดีจะเอาไว้ให้ลูกค้าใช้
ขอบคุณ ท่านๆมากครับ  เด่วขอลอง test แปบครับ  เยี่ยมไปเลย 

ขอบพระคุณอีกครั้งครับ


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียว ( TrueMoney Wallet )
เริ่มหัวข้อโดย: mundee55 ที่ 08 ธันวาคม 2018, 11:04:57
ตอนนี้ API ชุดนี้ใช้ไม่ได้ละ

แนะนำครับ

https://www.tmweasy.com/

ไม่ต้องทำสคิปเองเขามีบริการทำให้ API อัพเดทพร้อมใช้งานตลอดเวลา
ยอมจ่ายนิดหน่อยไม่แพงครับแต่คุ้มไม่ต้องมานั่งปวดหัว


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียว ( TrueMoney Wallet )
เริ่มหัวข้อโดย: AbuseMan ที่ 08 ธันวาคม 2018, 13:27:33
โค้ดชุดนี้ยังใช้ได้ปกติ ไม่ต้องไปเสียค่าต๋งให้คนกลางอีก


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียว ( TrueMoney Wallet )
เริ่มหัวข้อโดย: steelseries ที่ 09 ธันวาคม 2018, 14:04:55
ว้าวเลยเจอโพสนี้

เมือก่อนเห็นใน github นานแล้วล่ะ แต่ไม่รู้ TrueWallet คืออะไร แต่ทุกวันนี้ใช้ง่ายจ่ายคล่องเงินออกเอาออกเอาเลย  :wanwan001:


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียว ( TrueMoney Wallet )
เริ่มหัวข้อโดย: NaiTan ที่ 09 ธันวาคม 2018, 17:43:18
น่าสนใจครับ เดี๋ยวลองไปใช้ดู


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียว ( TrueMoney Wallet )
เริ่มหัวข้อโดย: noynic ที่ 09 พฤษภาคม 2019, 11:08:29
07/05/2562
ปัจจุบันสคิปนี้ไม่มีบน GitHub แล้วครับ
น่าจะใช้งานไม่ได้แล้วนะครับ :wanwan031: :wanwan031:


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียว ( TrueMoney Wallet )
เริ่มหัวข้อโดย: boom51120 ที่ 27 พฤษภาคม 2019, 12:34:29
ทาง true wallet

บล็อค ลิงค์ api เเล้วครับ


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียว ( TrueMoney Wallet )
เริ่มหัวข้อโดย: tarllovemint ที่ 27 พฤษภาคม 2019, 13:09:54
ยังใช้งานได้ปกติ

เช็คยอด , เติมนยอด , เช็ครายการ

https://freeani.me/_truewallet


หัวข้อ: Re: ระบบตัดบัตร TrueMoney ใช้ไฟล์ class ไฟล์เดียว ( TrueMoney Wallet )
เริ่มหัวข้อโดย: try2hack ที่ 08 กรกฎาคม 2019, 18:50:02
hxxps://mobile-api-gateway.truemoney.com

เหมือนเดิม แต่ใช้ไม่ได้ ใครมันอันที่แก้แล้วมั่งครับ ขอหน่อย