我有2个文件夹:“GET”,其他是“admin”获取包含用户访问权限,admin只有管理员访问权限。我试图将条件放在verfy.php文件中,如果(用户=='管理员名称),然后转到管理文件夹并打开index.html,否则保持在GET文件夹并打开用户文件。我不知道我在做什么错误或错误,因为if-part中的所有三条评论都不起作用:(。这是我的代码部分:
<?php
//skiped seesion portion this portion is doing well work after debug
if($username=="amirlatif")
{
// echo "hello";
//include('C:\xampp\htdocs\new project\admin');
ini_set("include_path", "/C:\xampp\htdocs\new project\admin" . ":" .ini_get("include_path"));
// dirname('C:\xampp\htdocs\new project\admin\index.html');
}
else
{
//iss main user profile ka ok!!!
}
?>
答案 0 :(得分:0)
如果您想将管理员重定向到管理员页面,只需进行重定向:
<?php
if($username=="amirlatif") {
header("location: path-to-admin-folder/index.php");
} else {
header("location: path-to-user-folder/index.php");
}
?>
答案 1 :(得分:0)
<?php
if($username=="amirlatif") {
header("location: ../admin/index.php");
} else {
.....
}
?>