在管理员批准之前阻止写入 SQL
一定要问一下在我的网站上,我有一个注册表单,提交后,会将数据写入数据库。用户提供的地址用于在谷歌地图上显示他们的信息(城市、州、国家……不是具体位置)。一切都会立即显示在谷歌地图上,但我担心一些不应该出现的东西会出现在那里。
假设有人在表单上提交了一些内容...例如名字“Seymour”姓氏“Butts”。显然,我不想添加显示 Seymour Butts 位置的标记。
无论如何,是否可以提交表单,将其发送给指定的管理员进行批准,并且一旦批准,然后将其写入sql数据库?我认为这是最好的方法...我愿意接受建议!!!!
Gotta question. On my website I have a registration form that, once submitted, writes the data to a database. The address that the user provides is used to display their information on a google maps (city, state, country... not SPECIFIC location). Everything shows up on google maps instantaneously, but I'm worried that something will show up on there that shouldn't.
Say someone submits something on the form... like first_name "Seymour" last_name "Butts". Obviously, I don't want a marker added that shows Seymour Butts' location.
Is there anyway to submit a form, have it sent to a designated admin for approval, and, once approved, THEN have it write to the sql database? I think that'd be the best way to do it... I'm open to suggestions!!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将一个字段添加到您写入的任何表中,以指定该项目是否已被批准。然后,您可以查询表中的空白以查看哪些项目需要批准,并查询已批准的项目以仅显示非 Butts 项目。
Add a field to whatever table you write to that designates whether the item has been approved or not. You can then query the table for blanks to see which items need to be approved, and query for approved items to only show non-Butts items.
您可以将其添加到中间表,例如“WaitingForApproval”表。
然后,您可以编写一个管理工具,列出该表的内容,每个项目旁边都有一个“批准”按钮,这将触发插入到真实表中。
You could add it to an intermediate table, say a "WaitingForApproval" table.
Then you could write an admin tool listing the contents of this table with each item having an "Approve" button next to it, which would trigger the insert into the real table.