user_auth_fns.php
来自「php源码 php源码参考」· PHP 代码 · 共 33 行
PHP
33 行
<?phpfunction login($username, $password)// check username and password with db// if yes, return true// else return false{ // connect to db $conn = db_connect(); if (!$conn) return false; $result = $conn->query("select * from users where username='$username' and password = sha1('$password')"); if (!$result) return false; if ($result->num_rows>0) return true; else return false;}function check_auth_user()// see if somebody is logged in and notify them if not{ if (isset($_SESSION['auth_user'])) return true; else return false;}?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?