0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

本日の学習内容part2

Last updated at Posted at 2020-03-21

##参考記事
https://phpjp.com/sha1.php

##パスワードの暗号化(sha1)
あるパスワードをDBに登録時に暗号化した(ハッシュ計算)後、ログイン画面で入力したパスワードがDBのパスワード(暗号化済み)と合っているかどうかをチェックする時は暗号化を行う。

login.php
if ($_POST['password'] !== '') {
    $login = $db->prepare('SELECT * FROM members WHERE password=?');
    $login->execute(array(
      sha1($_POST['password'])
    )); 
    $member = $login->fetch();

##感想
学習した内容を上手く文章に出来なくててもどかしい(笑) これからそのスキルも磨いていきたい。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?