- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如果发现与这两个值匹配,使用用户电子邮件
和专用哈希
检查我的表是否足以验证并激活帐户?
用户被要求使用用户数据和电子邮件 ID 进行注册。然后,他们会收到一个 URL 到他们的电子邮件地址,要求他们点击该 URL 来确认并激活他们的帐户。
这是我当前的设置:
<?php //The user-account-creation processing page
$email_id = taken from user input;
$randomnessWhateverItsCalled = "lots-of-randomness-here";
UPDATE advert SET advert_hash = SHA1(CONCAT($email_id, $randomnessWhateverItsCalled))
//For simplicity's sake I omitted the PDO stuff
INSERT INTO table_name (..., user_email, hash, account_activated, ...) VALUES (..., usersEmail, advert_hash, NO, ...)
/**
Send an email with some php code with the URL that would look like this
URL to click on attached to email body:
*/
$attachStringToEmailBody = "http://www.domainname.com/activate-user?email_id=" . $usersEmail . "&hash=" . $randomnessWhateverItsCalled;
enter code here
//Send email from this process page with a little email php code
//Redirect user to a page informing the user to activate the account by visiting their email and clicking on the url
?>
然后在activate-user.php
页面中我有以下内容:
<?ph
$user_email = $_GET['email_id'];
$hash = $_GET['hash'];
/**
search database and return a row if there is a match containing both the $user_email and the $hash
if(match){
Update database and set the `account_activated` column to `YES`
}
else{
//Tell if there was no match then activation failed
//Let the user know that we do not recognise the link they used to try and activate their account.
}
*/
?>
最佳答案
只要你让“随机性”部分变得难以猜测,它看起来就足够安全了。您可以将电子邮件、用户名、密码等放在那里,并将它们与另一个 key 混合在一起 - 全部加密 - 这就是我通常所做的。
但我建议您使用 0/1 来表示事件/非事件 - 为什么要使用字符串,当您可以使用smallint (1) 执行相同操作时 - 并节省一些空间,从而使数据库更轻一些?
关于php - 一种使用 URL 在 MySQL PHP 中识别和激活用户的足够安全的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25760152/
对于我的问题,我找不到更好的措辞。 在我的应用程序中的某个时刻,我设置了一些非常密集的动画。问题是,在高端设备上,动画运行流畅且赏心悦目。另一方面,我测试过的一台低端设备在制作动画时表现非常糟糕。 试
我正在修补 OTP 模块 ( yubico_pam ),并尝试访问管理员选择的控制标志(例如必需,足够, ETC)。 有什么想法吗?这是否可行(无需解析文件)? 最佳答案 无法在 API 中查询此信息
我有一些为 Linux 编写的 C 代码,依赖于套接字和 arpa/inet.h 以及 libusb.h,我想在 MinGW 下为 Windows 编译它。 (请注意,当前项目只有一个非常简单的 Ma
我是一名优秀的程序员,十分优秀!