2012-11-28 2 views
1

나는 공사중이라고합니다. 페이팔 NOTIFY_URL는이 자격 증명 저장하지 않는 URL을 쳤을 때 나는 문제를 직면하고 그리고 난 생성자에서 제거 할 경우 작동페이팔 신고서 통보

function __construct() 
{ 
    parent::__construct(); 

    if(!$this->authentication->authenticate($this->router->class)) { 
     redirect('clients/'); 
    } 

    $this->load->model('client_model', 'client'); 
    $this->layout = 'layout/web/client'; 
} 

.

function payment_notification() 
{ 
    if($this->input->post(NULL, TRUE)) 
    { 
     $this->saveintodb($this->input->post());   
    } else { 
     show_error('Post data not found in request', 500); 
    } 
} 

답변

0

여기에 제공된 정보가 충분하지 않습니다 ...!

  • 적절한 notify_url이 CSRF이 활성화 된 경우
  • 는 CodeIgniter의 실 거예요 작업을 할 수 페이팔 보냈습니다 확인!
  • 당신은보다는 $ this-> 입력 -> 게시물을()하여 $ _POST 배열을 확인해야

Config.php에

$config['uri_protocol'] = 'REQUEST_URI'; 
/* 
|-------------------------------------------------------------------------- 
| Check to see if the request uri contains paypal 
|-------------------------------------------------------------------------- 
*/ 
if(stripos($_SERVER["REQUEST_URI"],'/paypal')) 
{ 
    $config['csrf_protection'] = FALSE; 
} 

- Routes.php

$route['paypal/notify'] = 'paypal/recieve_notification'; // www.mysite.com/paypal/notify 

- 컨트롤러 s/Paypal.php

class Paypal extends CI_Controller{ 

    public function __construct(){ parent::__construct(); } 

    public function recieve_notification() //simplified function 
    { 
     try(
      if(!$_POST) 
       throw new Exception('No POST data recieved from Paypal'); 

      if($_POST['verified'] !== 'VERIFIED') //im guessing here 
       throw new Exception('User not verified by paypal'); 


     )catch(Exception $e){ 
      //debugging: show_error($e->getMessage()); 
      log_message('error', $e->getMessage()); 
      redirect('/'); 
      exit; 
     } 

      //Save to DB 
      $this->saveintodb($_POST); //expecting Exception thrown from DB ? 

     $this->session->flashdata('success', 'Data Saved!'); 
     redirect('/'); 
    } 


} 
+0

Paypal 문제가 아니라 해당 건설 문제 ... 해당 URL로도 액세스 할 수 없습니다. 내가 HTTP 의미 : // localhost를/사이트/클라이언트/기능/ 이 때문에 '클래스 클라이언트는 MY_Controller 확장 생성자의 클라이언트 페이지에 저를 리디렉션 { \t 기능 __construct() \t { \t \t 부모 :: __construct(); \t \t \t \t 경우 { \t \t \t 리디렉션 ('클라이언트 /') (! $ this-> 인증에 비해> ($ this-> 라우터 기반> 클래스) 인증); \t \t \t \t $ this-> load-> model ('client_model', 'client'); \t \t $ this-> layout = 'layout/web/client'; \t} } –