결제 게이트웨이 (신용 카드 등)를 결제 게이트웨이에 제출하면 결제가 승인되면 "response_code"1이 전송됩니다. 다음 코드를 사용하여 승인 된 트랜잭션을 반영하도록 데이터베이스의 사용자 정보를 업데이트합니다.데이터베이스를 업데이트하는 중 오류가 발생했습니다. PHP
그러나 약 10 회마다 약 1 회의 트랜잭션이 승인 된 응답을 반환했지만 사용자 정보는 업데이트되지 않습니다. 이 코드가 잘못된 것이 있습니까? 아니면 어떤 이유로 response_code가 1과 같지 않을 수 있습니까?
<?php
session_start();
if ($_GET['response_code'] == 1)
{
require('scripts/global.php'); //connect to database
$email = $_SESSION['email'];
$level = 3;
$transaction_id = "" . htmlentities($_GET['transaction_id']);
mysql_query ("UPDATE `users` SET level = '$level', trans_id = '$transaction_id' WHERE `email` = '$email'"); //update user info
$error = "false";
}
else
{
$noerror = "true";
$message = "Sorry, an error occurred: " . htmlentities($_GET['response_reason_text']);
}
?>
'? response_code = 1'을 설정하지 못하게하려면 어떻게해야합니까? 또한 SQL 주입 공격을받을 수도 있습니다. – Shef