完成 Flash Facebook 游戏后生成独特的优惠券
好的,所以我先说我对 PHP/MySQL 很陌生。我尝试寻找一个合适的答案,但除了找到一个切中要害的答案之外,我什至不知道我应该寻找什么。提前感谢您的帮助。
我想做的是开发一个 Facebook 应用程序选项卡,其中包含我构建的 Flash 游戏。需要注意的是,一旦用户“赢得”游戏,我想向他们展示 Flash 游戏内的一个链接,将他们带到一个 html 页面,在该页面上显示他们的优惠券。
我认为这意味着我需要三个阶段: 1. 用户认证 2. 游戏 3.基于身份验证的 _POST 数据,根据用户输入提供具有随机 URL 或内容的优惠券(生成插入人名的 jpeg 模板),
因为这是在 facebook 上,所以我可能会尝试设置应用程序以提示用户允许我的应用程序访问他们的信息,并使用他们的 Facebook 用户 ID 来生成优惠券。或者,我想我可以让他们输入他们的名字,然后使用 cookie 将该信息传递到创建优惠券时。
我面临的主要问题是如何创建独特的优惠券,以便他们无法与其他人分享?
Ok, so I will preface this by saying that I am very new to PHP/MySQL. I tried searching for an appropriate answer, but beyond finding an answer that hits the nail on the head I don't even know what I should search for. Thanks for help in advance.
What I am trying to do is develop a facebook app tab that houses a Flash game that I built. The caveat is that once a user 'wins' the game, I want to present them with a link inside the flash game that takes them to an html page where their coupon is presented.
I figure this means I will need three stages:
1. Authentication of User
2. The Game
3. Coupon with random URL OR content based on user input (generates a template jpeg with the persons name inserted) based on _POST data from authentication
Since this is on facebook I may try to set up the app to prompt the user to allow my app to access their info, and user their facebook user ID to generate their coupon. Alternatively, I thought I could have them input their name, and then use a cookie to carry that info over to when the coupon is created.
The main issue I am facing is how do I create the unique coupon so they can't share it with anyone else?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我理解正确的话,最后一部分实际上是最简单的。您只需要某种特定于单个用户的唯一代码,对吗?它实际上可能只是一个随机代码,只要它与用户的 ID 一起存储在数据库中,以便您可以检查正确的用户是否正在兑换它。另一种方法是使用基于用户 ID(或名称,如果您愿意)的加密,例如:
$code = md5($userid . 'somethingsecret');
当然,正确验证用户身份是首先是必要的,但如果是 Facebook 应用程序,如果他们授予应用程序许可,那就非常简单。
最大的问题可能是您没有想到的一个问题——确保用户真正玩并赢得游戏。根据您所需的安全级别,这可能会变得非常复杂。请记住,游戏结束时 Flash 重定向到的 url 也可以手动访问。
If I understand things correctly, the last part is actually the simplest. You just need some kind of unique code that is specific to a single user, correct? It could actually just be a random code as long as it is stored in the db along with the user's id so that you can check whether the proper user is redeeming it. Another way is to use an encryption based on the user's id (or name if you prefer), something like:
$code = md5($userid . 'somethingsecret');
Of course properly authenticating the user is necessary first, but if it's a Facebook app that's pretty simple if they give the app permission.
The biggest issue may be one you haven't thought of -- ensuring that the user actually plays and wins the game. That can get very complicated depending on the level of security you need. Just remember that the url the flash redirects to when the game ends, can be manually visited as well.