在会话中存储大量数据以进行重定向是多么安全可靠


How secure and reliable is it to store huge data in session for redirect purpose?

我一直在研究php项目,我需要在重定向到结果期间传递数据.php .这种方法有多安全,或者有些人可以为我提供更好的选择

if($_POST['mygender'] && $_POST['sgender'] && $_POST['country'] && $_POST['town']){
  $sgender= $_POST['sgender'];
  $country= $_POST['country'];
  $town= $_POST['town'];
  $startage=$_POST['startage'];
  $endage=$_POST['endage'];
    $x=$functions->getX($country,$sgender,$town,$startage,$endage,$session_uid);
if($x){
   /*How secure and perfomance effect is this line*/
  $_SESSION['found']=$x;
  header("Location:result.php");
}
else{
  $reg_error="<span class='error' style='color:red;'>No match found</span>";
}

}

考虑到DB结果$x?

我想使用存储在会话中的数据来显示结果

<div class="search-list">
      <?php $profile=$_SESSION['found'];
      foreach ($profile as $key => $value) : ?>
      <div class="four columns">
        <div class="search-item">
          <div class="avatar">
            <img src="<?php echo $base_url."uploads/".$value['profile_bg'];?>" alt="Avatar">
          </div>
          <div class="search-meta">
            <h5 class="author"><a href="#"><?php echo $value['first_name']." ".$value['last_name'];?></a></h5>
            <p class="date"><?php echo $value['birthday']."  |".$value['relationship']."  |".$value['hometown']."  |".$value['location'];?></p>
          </div>
          <div class="search-body">
            <p><?php echo $value['bio'];?></p>
          </div>
          <p><a href="profile.html" class="small button radius secondary"><i class="icon-angle-right"></i> View profile</a></p>
        </div>
      </div>
       <?php endforeach;?>

假设您将会话数据存储在服务器上而不是 cookie 中(这是默认行为(,这种方法是完全可以的。我会说您应该在每次使用后重新生成一个新会话。

问题是您存储了多少数据?(因为数据存储在您的服务器上(如果很多,你可以通过cookie将其推送回客户端,然后只需将cookie数据读回即可...但是,您的服务器将占用每个请求的更多带宽,这对可扩展性不利(如果您关心,我对此表示怀疑,因为您实际上使用的是php(。