[請益] 關於php5 & Mysql5聖經
想請問一下 裡面的有個地方 我不知道為什麼作者要用這個函式說 不知道動機為何@@
ps 這是出現在電子書的874頁
<?php
//A file with the datebase host,user,password,and selected database
include_once('db_vars.inc');
//A string used for md5 encryption.You could move it to a file
//outside the web tree for more security
$supersecret_hash_padding = 'A string that is used to pad
out short strings for md5 encyption.';
$LOGIN_IN=false;
unset($LOGIN_IN); <-有人知道為什麼這裡要用unset func嗎?
func user_isloggedin(){
//This func will only work with superglobla arrays
//because $supersecret_hash_padding. $LOGGED_IN:
//Have we already run the hash checks ?
//IF so $ return the pre-set var
if (isSet($LOGGED_IN)) {
return $LOGGED_IN;
}
if ($_COOKIE['user_name'] && COOKIE['id_hash']) {
$hash = md5($_COOKIE['user_name'].$supersecrect_hash_padding);
if ($hash == $_COOKIE['id_hash']) {
return trun;
} else {
return false;
}
} else {
return false;
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.170.140.79
※ 編輯: previa 來自: 218.170.140.79 (05/02 23:30)
※ 編輯: previa 來自: 218.170.140.79 (05/02 23:43)
推
05/03 00:10, , 1F
05/03 00:10, 1F
推
05/03 02:35, , 2F
05/03 02:35, 2F
推
05/03 04:27, , 3F
05/03 04:27, 3F
推
05/03 13:09, , 4F
05/03 13:09, 4F
→
05/03 13:11, , 5F
05/03 13:11, 5F
→
05/03 13:12, , 6F
05/03 13:12, 6F
推
05/04 00:58, , 7F
05/04 00:58, 7F
PHP 近期熱門文章
PTT數位生活區 即時熱門文章