2012-10-03 2 views
1

누군가 포인터를 줄 수 있을지 궁금한가요?Paypal ipn/cart variables

내가 현재 짓고있는 웹 사이트는 '이벤트'티켓을 판매합니다 ... 휴가.

내가하려는 것은 데이터베이스 필드의 티켓 수를 구매 한 수로 줄이지 만 정보를 다시 가져올 paypal 카트 변수를 찾을 수 없습니다. 보이는 사용자 정의 변수는 한 번만 사용할 수 있으며 item_name 및 item_number 변수는 이미 사용 중입니다. 데이터베이스의 'event_id'필드를 식별하는 item_number와 이벤트 이름을 분명히 식별하는 (item_name)입니다.

정확한 금액을 Paypal로 넘길 수 있습니다. 금액을 줄이고 숨겨진 양식 필드에 표시된 내용을 페이팔로 보내기 전에 되돌릴 수는 있지만 다시 결과를 얻을 수는 없습니다. 내 필요에 맞게 적용 할 수있는 Paypal 양식 '이름'필드를 찾고 있는데

다음은 데이터베이스 루프입니다. 'custom'변수는 custom1 일 수 없으므로 작동하지 않습니다. custom2 등

mysql_connect('xxxxxxxx', 'xxxxxx', 'xxxxxxxx') or exit(0); 
    mysql_select_db('xxxxxx') or exit(0); 

$num_cart_items = $_POST['num_cart_items']; 



$i=1; 
while (isset($_POST['item_number'.$i]))//read the item details 
{ 
$item_ID[$i]=$_POST['item_number'.$i]; 
$custom[$i]=$_POST['custom'.$i]; 
$i++; 
} 

$item_count = $i-1; 

for ($j=1;$j<=$item_count;$j++) 

{ 

$struery = "UPDATE events SET event_tickets = '".$custom[$j]."' WHERE event_id = '".$item_ID[$j]."'"; 
$result = mysql_query($struery) or die("Cart - paypal_cart_info, Query failed:<br>" . mysql_error() . "<br>" . mysql_errno()); 
$i++; 

}// end database loop 


Thanks for any info. 

Os 

답변

0

JSON 인코딩 된 문자열로 맞춤 변수를 넣을 수 있습니다. 그런 다음 해독하십시오.

$i=1; 
$custom = json_decode($_POST['custom], TRUE); 
while (isset($_POST['item_number'.$i]))//read the item details 
{ 
    $item_ID[$i] = $_POST['item_number'.$i]; 
    $custom[$i] = $custom[$i]; 
    $i++; 
} 

base64_encode 그것은 전송에 페이팔 또는 당신이 할 수 있고 다시 당신이 페이팔로 사용자를 리디렉션 할 때 읽을 수없는 변수를 원하는 그것을 디코딩 верут.