- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
所以我在注册后发送了一个链接来验证帐户,该链接包含用户的电子邮件地址和 32 个字符的代码,例如:
$to = $email;
$subject = 'Signup | Verification';
$message = '
Thanks for signing up!
Your account has been created, you can login with the following credentials after you have activated your account by pressing the url below.
------------------------
Username: '.$username.'
Password: '.$password.'
------------------------
Please click this link to activate your account:
localhost:8888/website/verify.php?email='.$email.'&hash='.$hash.'
';
$headers = 'From:myemail@email.com' . "\r\n";
mail($to, $subject, $message, $headers);
一切似乎都很好,我收到了带有如下链接的电子邮件:
http://localhost:8888/website/verify.php?email=myemail@email.com&hash=fe646d38bc2145ca6c3cf77d52820cd0
当我点击链接并尝试激活帐户时,问题就来了。我可以正常访问 Verify.php,但我一直收到 Invalid Approach,我无法将 Validation 设置为 1。
<?php include "includes/base.php"; ?>
<?php
if(isset($_GET['Email']) && !empty($_GET['Email']) AND isset($_GET['Hash']) && !empty($_GET['Hash'])){
$email = mysql_escape_string($_GET['Email']);
$hash = mysql_escape_string($_GET['Hash']);
$search = mysql_query("SELECT Email, Hash, Validation FROM users WHERE Email = '".$email."' AND Hash = '".$hash."' AND Validation = 0") or die(mysql_error());
$match = mysql_num_rows($search);
if($match > 0){
mysql_query("UPDATE users SET Validation = 1 WHERE Email = '".$email."' AND Hash = '".$hash."' AND Validation = 0") or die(mysql_error());
echo "Your account has been activated, you can now login";
}else{
echo "The url is either invalid or you already have activated your account.";
}
}else{
echo "Invalid approach, please use the link that has been sent to your email.";
}
?>
最佳答案
1) 此代码不安全,因为它存在 SQL 注入(inject)问题。使用 prepared statements请记住,不再支持 mysql_* 函数,它们是 depriated
2) 关于您的代码,我发现您的 GET 请求的“email”和“hash”都是小写的,但在 PHP 代码中您使用 $_GET['Email'] 和 $_GET['Hash']。你需要改变这个:
if(isset($_GET['Email']) && !empty($_GET['Email']) AND isset($_GET['Hash']) && !empty($_GET['Hash'])){
$email = mysql_escape_string($_GET['Email']);
$hash = mysql_escape_string($_GET['Hash']);
为此
if(isset($_GET['email']) && !empty($_GET['email']) AND isset($_GET['eash']) && !empty($_GET['eash'])){
$email = mysql_escape_string($_GET['email']);
$hash = mysql_escape_string($_GET['eash']);
或将您的 GET 请求更改为下一个:
http://localhost:8888/website/verify.php?Email=myemail@email.com&Hash=fe646d38bc2145ca6c3cf77d52820cd0
关于php - 验证链接未激活账户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14623923/
我有一个英国 PayPal 企业帐户。我目前正在开发一个网站支付系统,使用 Express Checkout 向这个账户付款。 到目前为止,我的 PHP 代码正在运行,我能够连接到沙箱并设置和快速结帐
如何使用自定义消息和自定义 from 参数而不是默认参数向用户发送电子邮件验证。 Meteor.methods({ sendveryficationmail: function (theuse
考虑一个场景,其中他们是 PartyA,并且 account1 是在 PartyA 中创建的。现在我们要在account1和PartyA之间发起一笔交易。是否可以有一个由账户发起、接收方为主机节点的交
我有多个 AWS 账户,根据我所在的项目目录,我想在 AWS CLI 中键入命令时使用不同的账户。 我知道 AWS 凭据可以通过环境变量传递,所以我认为一种解决方案是根据它所在的目录设置 AWS_CO
我希望能够使用 PayPal Mass Payment 向我网站的用户付款。如果他们有 PayPal 帐户,我认为这非常简单。 但是,如果他们没有 PayPal 帐户,有没有办法让他们通过我的网站注册
是否可以使用 paypal API 向任何 paypal 帐户(不仅仅是 API 凭据所有者)汇款。我知道使用 IPN 可以做到这一点,但我需要使用 SOAP。 最佳答案 您有两个主要选择:使用 Ma
这个问题在这里已经有了答案: Confirm PayPal sandbox account email (3 个答案) 关闭 2 年前。
是否可以使用 paypal API 向任何 paypal 帐户(不仅仅是 API 凭据所有者)汇款。我知道使用 IPN 可以做到这一点,但我需要使用 SOAP。 最佳答案 您有两个主要选择:使用 Ma
关闭。这个问题是off-topic .它目前不接受答案。 想改善这个问题吗? Update the question所以它是 on-topic对于堆栈溢出。 8 年前关闭。 Improve this
我一直在尝试 Meteor。我想使用 OAuth 对我网站上的用户进行身份验证,因为我不想自己实现登录功能。 目前我的网站非常简单。计数器,单击按钮计数器就会加一。当用户转到另一台机器并登录其计数时,
在我看来,您可以输入任何随机的用户名/密码组合,并且嵌入式 UI 小部件和后端都会接受它作为有效的 PayPal 帐户。付款和一切都会完成。 有没有办法可以将 Braintree 沙箱设置为仅接受真实
我已经设置并一直在使用 PayPal 使用 IPN/Express Checkout 在我的主网站上接受订单。但是我还有另外 4 个完全独立的网站,我也需要在它们上使用 PayPal 处理订单。购买我
我来这里是为了尝试解决 paypal 中没有人可以帮助我们解决的看似黑洞的问题。 我们有一个企业帐户。 Paypal Express(数码商品)。已验证,解除限制等...我们有 paypal expr
我正在编写一个 Web 应用程序,过去他们使用自己的 PayPal 帐户为外部自雇人员开设的类(class)付款。然而,税收制度已经改变,慈善机构希望他们的客户通过他们的网站预订(就像以前一样),但直
让我解释一下我的网站(ruby on Rails)的当前场景: 1) 我们可以从我的网站创建多个管理员帐户。 2) 每个管理员都有自己的客户,这些客户也有他们的网站访问部分。 3) 每个客户都可以向他
我正在两个 AWS 账户之间迁移。我想从我的 Mac 临时访问两个帐户上的代码提交存储库。 我已经为两个帐户的用户生成了 HTTPS Git 凭据。当我最初访问旧帐户时,它要求我提供存储在 OSX 钥
是否可以将一笔金额从一个关联账户转移到另一个关联账户?两者都在一个 Stripe 帐户下连接。 我知道我可以在两个帐户之间拆分转账,例如 $transfer = \Stripe\Transfer::c
如果一个人有两个 AWS 账户,一个用于开发,一个用于实时(例如)我知道可以使用 terraform 工作区来管理每个环境的状态。 但是,如果我将工作区从“开发”切换到“实时”,有没有办法告诉 ter
在 Meteor 中,我想将数据(和其他 CRUD 函数)插入到 users 表中,该表是在 Meteor 中下载 account-ui 和 account-password 包时生成的。我尝试在 c
有没有办法将 ETH 添加到 Ganache 账户?我知道我通常可以通过重新启动 ganache cli 来刷新帐户,但我使用的是 --db 选项,这意味着帐户是持久的。因此,它们很快就会枯竭。 最佳
我是一名优秀的程序员,十分优秀!