I have a little script that works with session id values. When i want to insert the session_id()
data to to my db, I see a value of something like 567
in the table. But, when i want to echo the same data using session_id()
function, I see a hashed value consisting of 32 chars like d6fc8fe0c82307cc97dd2a0e94c9bb56
.
我有一个使用会话id值的小脚本。当我想将session_id()数据插入到我的db时,我看到表中有567的值。但是,当我想使用session_id()函数来响应相同的数据时,我看到一个散列值,包含32个字符,比如d6fc8fe0c82307cc97dd2a0e94c9bb56。
What is the reason of this? Is this some kinda security issue with the PHP ? How can i get the same value?
这是为什么呢?这是PHP的安全问题吗?如何得到相同的值?
Here is the code:
这是代码:
$mysessid = session_id();
$sql = "INSERT into `mytable` (session_id) values('$mysessid')";
// when i use this sql to add the value into the db, i see a value like "7" or "251" etc in the table.
echo $mysessid;
// it outputs a hashed value like "d6fc8fe0c82307cc97dd2a0e94c9bb56"
// two different outputs...
1 个解决方案
#1
0
Sounds like your database structure is not formatted for an hex string. What type of field are you using for field session_id?
听起来您的数据库结构没有为十六进制字符串进行格式化。您对字段session_id使用什么类型的字段?
#1
0
Sounds like your database structure is not formatted for an hex string. What type of field are you using for field session_id?
听起来您的数据库结构没有为十六进制字符串进行格式化。您对字段session_id使用什么类型的字段?