인 MySQL PHP 사용자를 식별하고 활성화하는 데 충분한 보안 방법 user's email
및 hash
전용 테이블에서이 두 값과 일치하는 항목이 발견되면 계정을 확인하고 활성화 할 수 있습니까?URL이
사용자에게 사용자 데이터와 이메일 ID를 등록하라는 메시지가 표시됩니다. 그런 다음 이메일에 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.
}
*/
?>
[PHPass] (http://www.openwall.com/phpass/)에서 보안 표준에 대한 아이디어를 얻으십시오. 기성품 라이브러리를 사용해보십시오. –
@MihaiStancu, 안녕하세요, 귀하의 의견이 내 질문에 어떻게 대답하는지 설명해 주시겠습니까? – Pavan
Pavan 제 대답은 대답이 아닙니다. 질문에 대답하지 않는 이유를 완벽하게 설명하는 설명입니다. –