จนปัณญา มีคนเเก้ได้ไหม ระบบ tmpay.net.......Warning: file_get_contents(https://www.tmpay.net/TPG/backend.php?
เเก้ยังไงครับ
Warning: file_get_contents(https://www.tmpay.net/TPG/backend.php?merchant_id=TEST&password=12282392380121&resp_url=127.0.0.1/shop/tmpaytmpay_callback.php) [function.file-get-contents]: failed to open stream: No error in C:\AppServ\www\shop\tmpay\tmpay.php on line 17
Code (PHP)
<?php
class gamerxp_tmpay {
public function dotopup($user_id,$password,$config)
{
$getcard = mysql_num_rows(mysql_query("SELECT * FROM `tmpay` WHERE `user_id` = '".$user_id."' and `status` = 'pending' and `time` > '".(time()-3600)."'"));
if($getcard > 0)
{
return 'topup_order_in_process';
}else{
$curl = 'http://www.tmpay.net/TPG/backend.php?merchant_id='.$config['merchant_id'].'&password='.$password.'&resp_url='.$config['resp_url'];
$result = file_get_contents($curl);
/*
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, '5');
$result = trim(curl_exec($ch));
*/
$resultexplode = explode("|",$result);
if($resultexplode[0] == "SUCCEED")
{
mysql_query("INSERT INTO `tmpay` (`user_id`,`transaction_id` ,`password`,`amount`,`status`,`time`,`ip`) VALUES ('".$user_id."','".$resultexplode[1]."','".$password."','0' ,'pending','".time()."','".$_SERVER['REMOTE_ADDR']."');");
return 'success';
}elseif($resultexplode[1] == "THIS_CARD_IS_BEING_PROCESSED"){
return 'topup_card_in_process';
}else{
return 'topup_failed';
}
}
}
public function dogetinfo($transaction_id,$password,$amount,$status)
{
$transaction_id = trim($transaction_id);
$password = trim($password);
$amount = trim($amount);
$status = trim($status);
if($_SERVER['REMOTE_ADDR'] == "203.146.127.112")
{
$amountarray = array( 0 => 0,
1 => 50,
2 => 90,
3 => 150,
4 => 300,
5 => 500,
6 => 1000);
$statusarray = array( 1 => 'success',
3 => 'used',
4 => 'invaild',
5 => 'truemove');
$sqlinfo = mysql_fetch_array(mysql_query("SELECT * FROM `tmpay` WHERE `transaction_id` = '".$transaction_id."' and `password` = '".$password."' and `status` = 'pending' ORDER BY `id` DESC LIMIT 1;"));
if($sqlinfo)
{
mysql_query("UPDATE `tmpay` SET `status` = '".$statusarray[$status]."', `amount` = '".$amountarray[$amount]."' WHERE `id` = '".$sqlinfo['id']."' LIMIT 1;");
$userinfomation = mysql_fetch_array(mysql_query("SELECT * FROM `authme` WHERE `id` = '".$sqlinfo['user_id']."' LIMIT 1;"));
if($userinfomation)
{
//mysql_query("UPDATE `iConomy` SET `balance` = `balance`+'".($amountarray[$amount]*$config['tmpay']['rate'])."' WHERE `username` = '".$userinfomation['username']."' LIMIT 1;",$mc_connect);
mysql_query("UPDATE `authme` SET `Point` = `Point`+'".($amountarray[$amount])."' WHERE `id` = '".$userinfomation['id']."' LIMIT 1;");
echo "SUCCEED|UPDATE_USER=".$userinfomation['id'];
return true;
}else{
echo "ERROR|USER_NOT_FOUND";
return false;
}
}else{
echo "ERROR|CARD_INFOMATION_NOTFOUND";
return false;
}
}else{
echo "ERROR|ACCESS_DENIED";
return false;
}
}
}
Tag : PHP
Date :
2015-03-04 18:55:08
By :
armremix
View :
2127
Reply :
6
ใน code เป็น $curl = http://
แต่ทำไม warnning เป็น https:// ล่ะครับ
ใน php.ini ได้เปิด extension=php_openssl.dll หรือยังครับ
Date :
2015-03-04 20:33:49
By :
ผ่านมา
ยังครับ
Date :
2015-03-05 09:43:43
By :
armremix
อันนี้Codeเก่าครับ
Code (PHP)
<?php
class gamerxp_tmpay {
public function dotopup($user_id,$password,$config)
{
$getcard = mysql_num_rows(mysql_query("SELECT * FROM `tmpay` WHERE `user_id` = '".$user_id."' and `status` = 'pending' and `time` > '".(time()-3600)."'"));
if($getcard > 0)
{
return 'topup_order_in_process';
}else{
$url = 'http://www.tmpay.net/TPG/backend.php?merchant_id='.$config['merchant_id'].'&password='.$password.'&resp_url='.$config['resp_url'];
$result = file_get_contents($url);
$resultexplode = explode("|",$result);
if($resultexplode[0] == "SUCCEED")
{
mysql_query("INSERT INTO `tmpay` (`user_id`,`transaction_id`,`password`,`amount`,`status`,`time`,`ip`) VALUES ('".$user_id."','".$resultexplode[1]."','".$password."','0','pending','".time()."','".$_SERVER['REMOTE_ADDR']."');");
return 'success';
}elseif($resultexplode[1] == "THIS_CARD_IS_BEING_PROCESSED"){
return 'topup_card_in_process';
}else{
return 'topup_failed';
}
}
}
public function dogetinfo($transaction_id,$password,$amount,$status)
{
$transaction_id = trim($transaction_id);
$password = trim($password);
$amount = trim($amount);
$status = trim($status);
if($_SERVER['REMOTE_ADDR'] == "203.146.127.112")
{
$amountarray = array( 0 => 0,
1 => 50,
2 => 90,
3 => 150,
4 => 300,
5 => 500,
6 => 1000);
$statusarray = array( 1 => 'success',
3 => 'used',
4 => 'invaild',
5 => 'truemove');
$sqlinfo = mysql_fetch_array(mysql_query("SELECT * FROM `tmpay` WHERE `transaction_id` = '".$transaction_id."' and `password` = '".$password."' and `status` = 'pending' ORDER BY `id` DESC LIMIT 1;"));
if($sqlinfo)
{
mysql_query("UPDATE `tmpay` SET `status` = '".$statusarray[$status]."', `amount` = '".$amountarray[$amount]."' WHERE `id` = '".$sqlinfo['id']."' LIMIT 1;");
$userinfomation = mysql_fetch_array(mysql_query("SELECT * FROM `members` WHERE `id` = '".$sqlinfo['user_id']."' LIMIT 1;"));
if($userinfomation)
{
//mysql_query("UPDATE `iConomy` SET `balance` = `balance`+'".($amountarray[$amount]*$config['tmpay']['rate'])."' WHERE `username` = '".$userinfomation['username']."' LIMIT 1;",$mc_connect);
mysql_query("UPDATE `members` SET `money` = `money`+'".($amountarray[$amount])."' WHERE `id` = '".$userinfomation['id']."' LIMIT 1;");
echo "SUCCEED|UPDATE_USER=".$userinfomation['id'];
return true;
}else{
echo "ERROR|USER_NOT_FOUND";
return false;
}
}else{
echo "ERROR|CARD_INFOMATION_NOTFOUND";
return false;
}
}else{
echo "ERROR|ACCESS_DENIED";
return false;
}
}
}
Date :
2015-03-05 09:58:05
By :
armremix
ผมว่าใช้ https และไปเปิด
extension=php_openssl.dll
ก็น่าจะได้แล้วครับ
Date :
2015-03-05 14:45:26
By :
ผ่านมา
ไม่ได้อะครับ
Warning: file_get_contents(http://www.tmpay.net/TPG/backend.php?merchant_id=FC14022811&password=12983239218291&resp_url=http://127.0.0.1/shop/tmpay/tmpay_callback.php) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in C:\AppServ\www\shop\tmpay\tmpay.php on line 12
Date :
2015-03-05 19:43:16
By :
armremix
curl_close($ch);
ต่อจาก
$result = trim(curl_exec($ch));
Date :
2016-09-30 14:23:36
By :
T
Load balance : Server 01