| Line 133... |
Line 133... |
| 133 |
redirect(base_url().'recharge');
|
133 |
redirect(base_url().'recharge');
|
| 134 |
}
|
134 |
}
|
| 135 |
$data['response']=$this->recharge_model->getList($this->input->get(),$this->input->post(),$this->config->item('rechargeAmount'));
|
135 |
$data['response']=$this->recharge_model->getList($this->input->get(),$this->input->post(),$this->config->item('rechargeAmount'));
|
| 136 |
$data['response']['response']['recharge_confirmation'] = $this->session->userdata('recharge_confirmation');
|
136 |
$data['response']['response']['recharge_confirmation'] = $this->session->userdata('recharge_confirmation');
|
| 137 |
if(isset($data['response']['response']['recharge_amount'][0]->payAmount) && $data['response']['response']['recharge_amount'][0]->payAmount == 0){
|
137 |
if(isset($data['response']['response']['recharge_amount'][0]->payAmount) && $data['response']['response']['recharge_amount'][0]->payAmount == 0){
|
| - |
|
138 |
$captcha = $this->captcha_model->generateCaptcha();
|
| - |
|
139 |
$this->session->set_userdata('captcha',$captcha['word']);
|
| 138 |
$data['captcha'] = true;
|
140 |
$data['captcha'] = $captcha;
|
| 139 |
}
|
141 |
}
|
| 140 |
$this->layout->view('recharge/recharge_view',$data);
|
142 |
$this->layout->view('recharge/recharge_view',$data);
|
| 141 |
}
|
143 |
}
|
| 142 |
elseif(isset($_POST['submit']) && (($_POST['submit'] == 'Confirm') || ($_POST['submit'] == 'Recharge Now')) && (isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response']))) {
|
144 |
elseif(isset($_POST['submit']) && (($_POST['submit'] == 'Confirm') || ($_POST['submit'] == 'Recharge Now')) && (isset($_POST['captcha_response_field']) && !empty($_POST['captcha_response_field']))) {
|
| 143 |
$userId = $this->session->userdata('userId');
|
145 |
$userId = $this->session->userdata('userId');
|
| 144 |
//set POST variables
|
- |
|
| 145 |
$url = 'https://www.google.com/recaptcha/api/siteverify';
|
- |
|
| 146 |
$fields = array(
|
- |
|
| 147 |
'secret' => $this->config->item('captcha_secret_key'),
|
146 |
$captcha = $this->session->userdata('captcha');
|
| 148 |
'response' => $_POST['g-recaptcha-response']
|
147 |
if(strcmp($captcha,$_POST['captcha_response_field']) != 0){
|
| 149 |
);
|
- |
|
| 150 |
// use key 'http' even if you send the request to https://...
|
- |
|
| 151 |
$options = array(
|
- |
|
| 152 |
'http' => array(
|
- |
|
| 153 |
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
|
- |
|
| 154 |
'method' => 'POST',
|
- |
|
| 155 |
'content' => http_build_query($fields),
|
- |
|
| 156 |
),
|
- |
|
| 157 |
);
|
- |
|
| 158 |
$context = stream_context_create($options);
|
- |
|
| 159 |
$result = file_get_contents($url, false, $context);
|
- |
|
| 160 |
$result = json_decode($result, 1);
|
- |
|
| 161 |
$verified = isset($result) && isset($result["success"]) && $result['success'];
|
- |
|
| 162 |
if(!$verified){
|
- |
|
| 163 |
$rechargeconfig = $this->config->item('recharge');
|
148 |
$rechargeconfig = $this->config->item('recharge');
|
| 164 |
unset($rechargeconfig['response'][0]);
|
149 |
unset($rechargeconfig['response'][0]);
|
| 165 |
unset($rechargeconfig['response'][1]);
|
150 |
unset($rechargeconfig['response'][1]);
|
| 166 |
unset($rechargeconfig['response'][2]);
|
151 |
unset($rechargeconfig['response'][2]);
|
| 167 |
unset($rechargeconfig['response'][3]);
|
152 |
unset($rechargeconfig['response'][3]);
|
| Line 204... |
Line 189... |
| 204 |
}
|
189 |
}
|
| 205 |
$data['stylesheet'] = 'recharge.css';
|
190 |
$data['stylesheet'] = 'recharge.css';
|
| 206 |
|
191 |
|
| 207 |
$data['response']=$this->recharge_model->getList($this->input->get(),$this->input->post(),$rechargeconfig);
|
192 |
$data['response']=$this->recharge_model->getList($this->input->get(),$this->input->post(),$rechargeconfig);
|
| 208 |
if(isset($data['response']['response']['recharge_amount'][0]->payAmount) && $data['response']['response']['recharge_amount'][0]->payAmount == 0){
|
193 |
if(isset($data['response']['response']['recharge_amount'][0]->payAmount) && $data['response']['response']['recharge_amount'][0]->payAmount == 0){
|
| - |
|
194 |
$captcha = $this->captcha_model->generateCaptcha();
|
| - |
|
195 |
$this->session->set_userdata('captcha',$captcha['word']);
|
| 209 |
$data['captcha'] = true;
|
196 |
$data['captcha'] = $captcha;
|
| 210 |
}
|
197 |
}
|
| 211 |
if(isset($data['response']['response']['recharge_confirmation'][0]->userId) && !empty($data['response']['response']['recharge_confirmation'][0]->userId)){
|
198 |
if(isset($data['response']['response']['recharge_confirmation'][0]->userId) && !empty($data['response']['response']['recharge_confirmation'][0]->userId)){
|
| 212 |
$this->session->set_userdata('userId',$data['response']['response']['recharge_confirmation'][0]->userId);
|
199 |
$this->session->set_userdata('userId',$data['response']['response']['recharge_confirmation'][0]->userId);
|
| 213 |
$this->layout->view('recharge/recharge_view',$data);
|
200 |
$this->layout->view('recharge/recharge_view',$data);
|
| 214 |
}else{
|
201 |
}else{
|
| 215 |
redirect(base_url().'recharge');
|
202 |
redirect(base_url().'recharge');
|
| 216 |
}
|
203 |
}
|
| 217 |
} else {
|
204 |
}elseif(strcmp($captcha,$_POST['captcha_response_field']) == 0){
|
| 218 |
if(isset($userId) && !empty($userId)){
|
205 |
if(isset($userId) && !empty($userId)){
|
| 219 |
if(isset($authorized) && !empty($authorized)){
|
206 |
if(isset($authorized) && !empty($authorized)){
|
| 220 |
if($authorized['isLoggedIn'] == 1){
|
207 |
if($authorized['isLoggedIn'] == 1){
|
| 221 |
$_POST['userId'] = $authorized['Id'];
|
208 |
$_POST['userId'] = $authorized['Id'];
|
| 222 |
$_POST['rechargeUserId'] = $userId;
|
209 |
$_POST['rechargeUserId'] = $userId;
|
| 223 |
$_POST['isLoggedIn'] = 'true';
|
210 |
$_POST['isLoggedIn'] = 'true';
|
| 224 |
}
|
211 |
}
|
| 225 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
212 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
| 226 |
$_POST['userId'] = $authorized['Id'];
|
213 |
$_POST['userId'] = $authorized['Id'];
|
| 227 |
$_POST['rechargeUserId'] = $userId;
|
- |
|
| 228 |
$_POST['isLoggedIn'] = 'false';
|
- |
|
| 229 |
}
|
- |
|
| 230 |
}else{
|
- |
|
| 231 |
$_POST['userId'] = -1;
|
- |
|
| 232 |
$_POST['rechargeUserId'] = $userId;
|
214 |
$_POST['rechargeUserId'] = $userId;
|
| 233 |
$_POST['isLoggedIn'] = 'false';
|
215 |
$_POST['isLoggedIn'] = 'false';
|
| 234 |
}
|
216 |
}
|
| - |
|
217 |
}else{
|
| - |
|
218 |
$_POST['userId'] = -1;
|
| - |
|
219 |
$_POST['rechargeUserId'] = $userId;
|
| - |
|
220 |
$_POST['isLoggedIn'] = 'false';
|
| - |
|
221 |
}
|
| 235 |
foreach (getallheaders() as $name => $value) {
|
222 |
foreach (getallheaders() as $name => $value) {
|
| 236 |
if($name == "X-FORWARDED-FOR" || $name == 'X-Forwarded-For'){
|
223 |
if($name == "X-FORWARDED-FOR" || $name == 'X-Forwarded-For'){
|
| 237 |
$ips = explode(',',$value);
|
224 |
$ips = explode(',',$value);
|
| 238 |
if(sizeof($ips)>1){
|
225 |
if(sizeof($ips)>1){
|
| 239 |
$ipAddress = trim($ips[sizeof($ips)-1]);
|
226 |
$ipAddress = trim($ips[sizeof($ips)-1]);
|
| 240 |
}else{
|
227 |
}else{
|
| 241 |
$ipAddress = $value;
|
228 |
$ipAddress = $value;
|
| 242 |
}
|
- |
|
| 243 |
}
|
229 |
}
|
| - |
|
230 |
}
|
| 244 |
}
|
231 |
}
|
| 245 |
$_POST['ipAddress'] = isset($ipAddress)?$ipAddress:$_SERVER['REMOTE_ADDR'];
|
232 |
$_POST['ipAddress'] = isset($ipAddress)?$ipAddress:$_SERVER['REMOTE_ADDR'];
|
| 246 |
error_log("[ipAddress] ".$_POST['ipAddress']);
|
233 |
error_log("[ipAddress] ".$_POST['ipAddress']);
|
| 247 |
if($_POST['ipAddress']=='192.168.255.1'){
|
234 |
if($_POST['ipAddress']=='192.168.255.1'){
|
| 248 |
error_log("[headers] ".print_r(getallheaders(),1));
|
235 |
error_log("[headers] ".print_r(getallheaders(),1));
|
| 249 |
}
|
236 |
}
|
| 250 |
$data = array();
|
237 |
$data = array();
|
| 251 |
$data['response']=$this->recharge_model->getList($this->input->get(),$this->input->post(),$this->config->item('rechargeConfirm'));
|
238 |
$data['response']=$this->recharge_model->getList($this->input->get(),$this->input->post(),$this->config->item('rechargeConfirm'));
|
| 252 |
if(isset($data['response']['response']['recharge_confirm'][0]->response) && !empty($data['response']['response']['recharge_confirm'][0]->response)){
|
239 |
if(isset($data['response']['response']['recharge_confirm'][0]->response) && !empty($data['response']['response']['recharge_confirm'][0]->response)){
|
| 253 |
$redirectUrl = $data['response']['response']['recharge_confirm'][0]->response->redirectUrl;
|
240 |
$redirectUrl = $data['response']['response']['recharge_confirm'][0]->response->redirectUrl;
|
| 254 |
if(strpos($redirectUrl, 'zero-pay-recharge') !== false){
|
241 |
if(strpos($redirectUrl, 'zero-pay-recharge') !== false){
|
| 255 |
$url = $this->config->item('curl_base_url').$redirectUrl;
|
242 |
$url = $this->config->item('curl_base_url').$redirectUrl;
|
| 256 |
$params = array();
|
243 |
$params = array();
|
| 257 |
$this->mcurl->add_call('zero_pay','get',$url,$params);
|
244 |
$this->mcurl->add_call('zero_pay','get',$url,$params);
|
| 258 |
$response = $this->mcurl->execute($url);
|
245 |
$response = $this->mcurl->execute($url);
|
| 259 |
$data['response'] = $response['zero_pay']['response'];
|
246 |
$data['response'] = $response['zero_pay']['response'];
|
| 260 |
$response = $this->magento_model->payment_submit($data);
|
247 |
$response = $this->magento_model->payment_submit($data);
|
| 261 |
$redirectUrl = $response[0]->response->redirectUrl;
|
248 |
$redirectUrl = $response[0]->response->redirectUrl;
|
| 262 |
$redirectUrl = explode('?', $redirectUrl);
|
249 |
$redirectUrl = explode('?', $redirectUrl);
|
| 263 |
redirect(base_url().'recharge-result?'.$redirectUrl[1]);
|
250 |
redirect(base_url().'recharge-result?'.$redirectUrl[1]);
|
| 264 |
}else{
|
251 |
}else{
|
| 265 |
redirect(base_url().$redirectUrl);
|
252 |
redirect(base_url().$redirectUrl);
|
| 266 |
}
|
- |
|
| 267 |
} else{
|
- |
|
| 268 |
redirect(base_url().'confirm');
|
- |
|
| 269 |
}
|
253 |
}
|
| 270 |
}
|
254 |
}
|
| 271 |
else {
|
255 |
else{
|
| 272 |
redirect(base_url().'recharge');
|
256 |
redirect(base_url().'confirm');
|
| 273 |
}
|
257 |
}
|
| - |
|
258 |
}
|
| - |
|
259 |
else{
|
| - |
|
260 |
|
| - |
|
261 |
redirect(base_url().'recharge');
|
| - |
|
262 |
}
|
| - |
|
263 |
}else{
|
| - |
|
264 |
redirect(base_url().'recharge');
|
| 274 |
}
|
265 |
}
|
| 275 |
}
|
266 |
}
|
| 276 |
elseif(isset($_POST['submit']) && (($_POST['submit'] == 'Confirm') || ($_POST['submit'] == 'Recharge Now')) && (!isset($_POST['g-recaptcha-response']) || empty($_POST['g-recaptcha-response']))){
|
267 |
elseif(isset($_POST['submit']) && (($_POST['submit'] == 'Confirm') || ($_POST['submit'] == 'Recharge Now')) && (!isset($_POST['captcha_response_field']) || empty($_POST['captcha_response_field']))){
|
| 277 |
$userId = $this->session->userdata('userId');
|
268 |
$userId = $this->session->userdata('userId');
|
| 278 |
if(isset($userId) && !empty($userId)){
|
269 |
if(isset($userId) && !empty($userId)){
|
| 279 |
if(isset($authorized) && !empty($authorized)){
|
270 |
if(isset($authorized) && !empty($authorized)){
|
| 280 |
if($authorized['isLoggedIn'] == 1){
|
271 |
if($authorized['isLoggedIn'] == 1){
|
| 281 |
$_POST['userId'] = $authorized['Id'];
|
272 |
$_POST['userId'] = $authorized['Id'];
|
| Line 744... |
Line 735... |
| 744 |
|
735 |
|
| 745 |
public function getstatus() {
|
736 |
public function getstatus() {
|
| 746 |
if(isset($_GET['rechargeOrderId']) && !empty($_GET['rechargeOrderId'])){
|
737 |
if(isset($_GET['rechargeOrderId']) && !empty($_GET['rechargeOrderId'])){
|
| 747 |
//$_GET['rechargeOrderId'] = $_GET['rechargeOrderId'];
|
738 |
//$_GET['rechargeOrderId'] = $_GET['rechargeOrderId'];
|
| 748 |
// $this->lessphp->object()->ccompile('assets/css/recharge.less','assets/css/recharge.css');
|
739 |
// $this->lessphp->object()->ccompile('assets/css/recharge.less','assets/css/recharge.css');
|
| 749 |
#$rechargeId = $_GET['id'];
|
740 |
$rechargeId = $_GET['id'];
|
| 750 |
$isFinal = isset($_GET['isFinal'])?$_GET['isFinal']:false;
|
741 |
$isFinal = isset($_GET['isFinal'])?$_GET['isFinal']:false;
|
| 751 |
// $data['stylesheet'] = 'recharge.css';
|
742 |
// $data['stylesheet'] = 'recharge.css';
|
| 752 |
$data['response']=$this->recharge_model->getList($this->input->get(),$this->input->post(),$this->config->item('rechargeStatus'));
|
743 |
$data['response']=$this->recharge_model->getList($this->input->get(),$this->input->post(),$this->config->item('rechargeStatus'));
|
| 753 |
if(!empty($data['response']['response'])){
|
744 |
if(!empty($data['response']['response'])){
|
| 754 |
print_r($data['response']['response']['recharge_status'][0]->response->rechargeStatus);die;
|
745 |
print_r($data['response']['response']['recharge_status'][0]->response->rechargeStatus);die;
|