我正在使用一个简单的管理面板,但是当我登录时,我的功能似乎只能在其他方面工作,我不是专业程序员,但我认为这里没有错误:s
<?php
session_start();
function loggedin(){
if(isset($_SESSION['user_id']) && !empty($_SESSION['user_id'])){
return true;
} else {
return false;
}
}
if(loggedin()){
$my_id = $_SESSION['user_id'];
$user_query = mysql_query("SELECT username, user_level FROM users WHERE id='$my_id'");
$run_user = mysql_fetch_array($user_query);
$username = $run_user['username'];
$user_level = $run_user['user_level'];
$query_level = mysql_query("SELECT name from user_level WHERE id='$user_level'");
$run_level= mysql_fetch_array($query_level);
$level_name = $run_level['name'];
}
?>