暂无 |

登陆密码检测

该段代码用于从 user 表中检测管理员账户/密码正确与否:

<?php
session_start();

require("./conn.php");
if($_POST){
    $password = MD5(trim($_POST['password']));
    $username = $_POST['username'];
    $check_result = mysql_query("SELECT uid FROM user WHERE username = '$username' AND
    password = '$password'");
    if(mysql_fetch_array($check_result)){
        session_register("username");
	// 重定向至留言管理界面
        header("Location: http://".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\'
)."/admin.php");
        exit;
    } else {
        echo '密码错误!';
    }
}
?>

0

java教程
php教程
php+mysql教程
ThinkPHP教程
MySQL
C语言
css
javascript
Django教程

发表评论

    评价:
    验证码: 点击我更换图片
    最新评论