通过 url 传递会话 ID [英] passing session id via url

查看:27
本文介绍了通过 url 传递会话 ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让我的脚本使用 url 会话 ID 而不是 cookie.下面的页面没有选择 url 中的变量作为会话 id.我一定是遗漏了什么.

I'm trying to get my script to use url session id instead of cookies. The following page is not picking up the variable in the url as the session id. I must be missing something.

首页http://www.website.com/start.php

ini_set("session.use_cookies",0);
ini_set("session.use_trans_sid",1);
session_start();
$session_id = session_id();
header("location: target.php?session_id=". $session_id );

以下页面 - http://www.website.com/target.php?session_id=rj3ids98dhpa0mcf3jc89mq1t0

ini_set("session.use_cookies",0);
ini_set("session.use_trans_sid",1);
print_r($_SESSION);
print(session_id())

结果是不同的会话 ID,会话为空.

Result is a different session id and the session is blank.

数组([调试] => 否)pt1t38347bs6jc9ruv2ecpv7o2

Array ( [debug] => no ) pt1t38347bs6jc9ruv2ecpv7o2

推荐答案

使用 url 传递 session id 时要小心,这可能会导致 session hijacking 通过referer!

be careful when using the url to pass session ids, that could lead to session hijacking via the referer!

这篇关于通过 url 传递会话 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆