不单击输入而运行的表单操作
我希望表单操作中的代码在单击输入按钮时运行,但是每次刷新页面时,它都可以正常运行。
<form name="musluk" method="POST" action="<?php $res=mysqli_query($link,"UPDATE kullanicilar SET kredi= kredi +$musluk WHERE id=".$_SESSION['id']);?>">
<input name="musluk" type="submit" class="btn btn-primary" value="Kazancı Al">
</form>
I want the code in the form action to run when I click the input button, but it works every time I refresh the page.
<form name="musluk" method="POST" action="<?php $res=mysqli_query($link,"UPDATE kullanicilar SET kredi= kredi +$musluk WHERE id=".$_SESSION['id']);?>">
<input name="musluk" type="submit" class="btn btn-primary" value="Kazancı Al">
</form>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(1)
添加一个随机的nonce(仅使用过一次或类似的数字),例如在隐藏的输入字段中具有5位数字的数字,然后将其存储在$ _Session中。在操作中调用脚本时,请在运行脚本之前检查正确的NONCE号码。
在Aciton-Script跑中:
Add a random nonce (number only used once or something like this), like a number with 5 digits, in a hidden input field, and store it in the $_Session. When calling the script in action, check if the correct nonce number was send before running the script.
And in the aciton-script run: