向用户发出邀请?

发布于 2024-10-08 21:17:07 字数 118 浏览 0 评论 0原文

我希望人们请求邀请使用我的应用程序,他们填写他们的电子邮件地址,但如何生成一个网址供他们去注册?估计只能用一次!我正在考虑使用 php 的某种 md6 代码!

PS 如果有这方面的教程,请提供链接。谢谢。

I want people to request invites to use my app, they fill in their email address, but how can generate an url for them to go to register? Presumably only to be used once! I was thinking some sort of md6 code using php!

P.S. If there is a tutorial for this, please give a the link. Thanks.

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

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

发布评论

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

评论(1

空城缀染半城烟沙 2024-10-15 21:17:08

在电子邮件中,您使用随机代码,例如

<?php
$code = session_id();

您保存的 用户的session-id(的一部分)当用户点击您的注册页面时(例如, http:// /mydomain.tld/register?code=here-register-code),你这样做:

<?php
$code = $_GET['code'];
if (my_code_is_valid($code) {
    echo 'Hey, you are able to register now!';
} else {
    echo 'Sorry friend, you need an invite first!';
}

你需要定义你的 my_code_is_valid() 函数,但这取决于你自己的代码(框架、数据库系统等) 。

In the email you use a random code, for example (a part of) the session-id of the user

<?php
$code = session_id();

You save this code somewhere in your database and when the user hits your register page (for example, http://mydomain.tld/register?code=here-register-code), you do something like this:

<?php
$code = $_GET['code'];
if (my_code_is_valid($code) {
    echo 'Hey, you are able to register now!';
} else {
    echo 'Sorry friend, you need an invite first!';
}

You need to define your my_code_is_valid() function, but that's depending on your own code (framework, database system etc).

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