[英]Only allow call of PHP when user is redirected from a certain page?
Im working on a website where I need to implement Paypal Payment. 我在需要执行Paypal付款的网站上工作。
I currently have let's say payment.php. 我目前说的是payment.php。 I only want this file to be accessed when It's called by Paypal.
我只希望在Paypal调用该文件时才能访问该文件。 In Paypal, you can assign the redirect link once the purchase is successful.
购买成功后,在Paypal中,您可以分配重定向链接。 In this case, I want it to be redirected to ' https://www.mywebsite.com/payment.php ' but I only want this link to be accessed if it's called by Paypal.
在这种情况下,我希望将其重定向到“ https://www.mywebsite.com/payment.php ”,但仅当Paypal调用此链接时才希望访问该链接。 In my other pages, I use session to prevent access.
在其他页面中,我使用会话来阻止访问。 Any idea how I can implement this?
知道如何实施吗? Thanks in advance!
提前致谢!
That should usually do the trick: 通常应该这样做:
$_SERVER['HTTP_REFERER']
But as @DavidChen pointed out, if you are using some payment information, you need to check an endpoint and validate the request. 但是正如@DavidChen指出的那样,如果您使用一些付款信息,则需要检查端点并验证请求。
Use Paypal IPN: 使用贝宝IPN:
Allow only POST, and implement the callback validation described in the IPN documentation. 仅允许POST,并实施IPN文档中描述的回调验证。
https://github.com/dineshghule321/ipn-code-samples https://github.com/dineshghule321/ipn-code-samples
Check The Github Link : 检查Github链接:
https://developer.paypal.com/docs/classic/ipn/ht_ipn/ Paypal IPN Documentation https://developer.paypal.com/docs/classic/ipn/ht_ipn/ Paypal IPN文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.