php - 向公众展示我的表格安全吗?

标签 php forms paypal

您好,我设置了一个 PayPal 捐赠系统,我使用带有隐藏值的表单来制作我的按钮。我只是想到人们可以查看源代码并查看这些值这一事实。如果他们可以看到类似以下内容,是否存在安全威胁:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">  
    <input type="hidden" name="cmd" value="_xclick">  
    <input type="hidden" name="business" value="myemail@myemail.com">  
    <input type="hidden" name="item_name" value="Coyote Pack">  
    <input type="hidden" name="item_number" value="200">  
    <input type="hidden" name="amount" value="4">  
    <input type="hidden" name="no_shipping" value="0">  
    <input type="hidden" name="no_note" value="1">  
    <input type="hidden" name="currency_code" value="USD">  
    <input type="hidden" name="lc" value="AU">  
    <input type="hidden" name="bn" value="PP-BuyNowBF">  
    <table>
<tr><td>Player Unique ID</td></tr><tr><td><input type="text" name="custom" maxlength="200"></td></tr>
</table>
    <input type="submit" border="0" name="submit" alt="PayPal - The safer, easier way to pay online." value="Coyote Pack - $4">   
</form>

我想我的问题是他们没有看到它,但他们可以用它来以任何方式给 PayPal 虚假值吗?

例如,我正在运行 IPN,我的数据库使用该 item_number 为捐赠者提供某些特权。有人可以复制我的代码,粘贴到他们自己的网站,将“金额”更改为零,然后就可以得到免费的东西吗?

最佳答案

最好的解决方案是这个。 在你的 ipn 中说:

if(preg_match('@^[0-9a-zA-Z\s]+$@', $itemName) == 1){ // connect to database to retrieve price; }

然后说

if($priceShouldBe != $pricePaid){ // request was modified and the user did not pay the right price; exit; }

最后说

if(preg_match("@^[0-9]+$@", $customVariable) == 1){ /* Check database and then proceed to update database; THIS IS ASSUMING YOU'RE PASSING A NUMERICAL USER ID; Update whatever you need to in the database because the price is right, the name isn't an sqli attempt and the UserId is not an sqli attempt */ }

关于php - 向公众展示我的表格安全吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18752151/

相关文章:

paypal - 没有关联付款的CreateRecurringPaymentsProfile

payment-gateway - PayPal Direct Payment API 是否支持设置定期付款?

paypal - 如何从希望在设定日期之前支付较大金额的客户那里接收 PayPal 付款。他们可以支付他们想要的任何金额

php - 如何编辑 Divi 主题的存档页面?

php - 如何使用 ffmpeg 转换高质量的 .wmv 文件

php - ->where() 不工作,知道吗?

javascript - 从 php json 解码中检索 json 数组

c# - 在窗体关闭 c# 上处理所有资源

java - 我想使用 spring 3 获取 Controller 中 pojo 中的表单数据集,就像 struts1.2 方法一样

javascript - 使用下拉列表动态添加输入框