douchan4674 2011-01-25 20:29
浏览 68
已采纳

使用PHP阻止某些站点区域

I dont want users to access other users profiles. So this is what I'm doing. Is it fine?

<?php

session_start();

if($_SESSION['username']=='ryan'){
header("location:dash.php");
}
else{
location("location:404.php");
}

?>

is this secure?

  • 写回答

2条回答 默认 最新

  • dongmen9517 2011-01-25 20:33
    关注

    This is secure if the user can not modify the value of $_SESSION['username'] to set it to ryan; but you forgot the exit after the header('Location:...').

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?