- <?php
- unset($username);
- if ($_COOKIE[\'login\']) {
- list($c_username,$cookie_hash) = split(\',\',$_COOKIE[\'login\']);
- if (md5($c_username.$secret_word) == $cookie_hash) {
- $username = $c_username;
- } else {
- print \"You have sent a bad cookie.\";
- }
- }
- if ($username) {
- print \"欢迎, $username.\";
- } else {
- print \"欢迎, 游客.\";
- }
- ?>
- //该片段来自于http://www.codesnippet.cn/detail/10112012237.html
来源: http://www.codesnippet.cn/detail/10112012237.html