내 로그인 양식입니다. 일명 index.php웹 사이트 로그인하지 않을 경우 리디렉션
<form class="form-3" action="login.php?log=ok" method="post" >
<input type="text" name="username" id="login" placeholder="Username">
<input type="password" name="password" id="password" placeholder="Password">
<input type="submit" name="submit" value="Submit">
</form>
다음은 내 로그인 검사기입니다. 나는 쉽게도 i'am 로그인이되지는 index page
다른 페이지를 열 수 있습니다 그들로부터 모든 계정에 액세스 할 때 일명 지금
<?php
require_once 'classes/Personel.php';
$personel = new Personel();
$personel->setUsername($_POST['username']);
$personel->setPassword($_POST['password']);
$personel->login();
header("Location: index.php");
// REDIRECT
session_start();
if (strcasecmp($personel->getRole(), "LTO") == 0 ) {
$_SESSION['role'] = "LTO";
$_SESSION['personel'] = $personel;
header("Location: LTO");
}else if(strcasecmp($personel->getRole(), "LTFRB") == 0){
$_SESSION['role'] = "LTFRB";
$_SESSION['personel'] = $personel;
header("Location: LTFRB");
}else if(strcasecmp($personel->getRole(), "LGU") == 0){
$_SESSION['role'] = "LGU";
$_SESSION['personel'] = $personel;
header("Location: LGU");
}else if(strcasecmp($personel->getRole(), "ADMIN") == 0){
$_SESSION['role'] = "ADMIN";
$_SESSION['personel'] = $personel;
header("Location: admin");
}
?>
을 login.php. 나는 그것을 어떻게 금지 할 수 있는가? 어떻게 URL 재 작성을 피할 수 있습니까?
예 : 관리자
시도의 인덱스 페이지를 열려면 내 link 올바른 계정 관리자 - 관리자는 또한 잘못된 .. 사전에
큰 감사를 시도합니다.
조건없이 헤더 ("Location : index.php")를 호출하는 이유는 무엇입니까? 즉, 항상 index.php로 리디렉션 중임을 의미합니다. – Yani
당신은 어떤 조건의 외부에서도 index.php로 리디렉션했습니다. 세션 코드가 어떻게 작동하는지 보지 못했습니다! 또한,'$ personel-> login()'은 무엇을합니까? 그것은 어딘지로 방향이 바뀌 었습니까? – Tzar
@ Tzar 올바른 계정을 입력하려고합니다. 나는 예상 한 페이지에 간다. 잘못된 계정을 시도해도 index.php가 그대로 유지되는 이유는 무엇이라고 생각합니까? – AndroidNewbie