为交易生成 UUID - 不断给出错误的输入

发布于 2024-09-02 07:20:02 字数 265 浏览 3 评论 0原文

我正在创建在线注册表。当用户前进到第 2 页时,我使用以下 PHP 命令为该用户生成一个“唯一”ID:

$_SESSION['ConfirmationNo'] = rand(100000000, 999999999);

但是,在此过程的后期,当用户可以实际查看其确认号码时,他们只需“刷新”页面一次即可并且会出现一个新的确认号码。

有什么方法可以在第 1 或第 2 页锁定该特定 ID 的情况下执行此操作吗?

谢谢!

I am creating an online enrollment form. When a user advances to page 2, I generate a 'unique' ID for that user with the following PHP command:

$_SESSION['ConfirmationNo'] = rand(100000000, 999999999);

however, later in the process, when a user can actually view their confirm number, they can simply 'refresh' the page once and a new confirmation number will appear.

Any way to do this where that particular ID is locked down from page 1 or 2?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

为人所爱 2024-09-09 07:20:02

您可以在生成确认号之前检查会话中是否存在确认号。然后,如果该号码存在,则仅使用它来显示以前提交/保存的信息或显示一条消息“请不要刷新此页面”。

you could check if the confirmation number exists in session before generating it. Then if the number exists, either just use that to display previously submitted/saved information or display a message saying "please don't refresh this page".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文