douyingp82418
2013-03-07 17:38
浏览 44
已采纳

PHP更改会话cookie文件的内容

I´m not sure If I am making a mountains out of molehills ...

I´ve two Servers A + B. I know on Server A exists a PHP Session with a session cookie. I know further in one of the session files (stored in var/lib/php5) exists a unique value like:

$_SESSION['name'] = "1_colourXY"

I can identify this cookie file with php by searching the dir/ files for this value (f.e.: file sess_489b9515146e7390ac03b5dabf36b70e).

I now want Server B to be able to tell A to store a new value to this explicit cookie file. My solution is:

Server B (which is not the client who has started the session!) calls a PHP file on Server A. After B has passed some security checks A should write a new value to this cookie file with file_puts_content. Note, as written Server B has not started the session so I think I cannot simple do

session_start();
$_SESSION['myval'] = "new val";

Therefore I have following questions:

  1. Is there an easier (native session handling) way instead of file_puts… to write the value to the cookie file something like:

    write $_SESSION['myval'] = "new val" to
    sess_489b9515146e7390ac03b5dabf36b70e
    
  2. The session Dir var/lib/php5 has chmod 773, to write and search within it I have to change rights to 777 (urrgh). How can I keep 773 but make it useable for php

  3. If I open a cookie file a value looks like this: place|s:6:"Muster"; What does |s:6: mean?

Kind regards,

tony

图片转代码服务由CSDN问答提供 功能建议

我不确定如果我是用小山丘制造一座山... \ n

我有两台服务器A + B.我知道服务器A上存在一个带有会话cookie的PHP会话。 我知道其中一个会话文件(存储在var / lib / php5中)存在一个唯一的值,如:

  $ _ SESSION ['name'] =“1_colourXY”\  n   
 
 

我可以通过在dir / files中搜索此值来识别这个cookie文件(fe:file sess_489b9515146e7390ac03b5dabf36b70e)。

我现在希望服务器B能够告诉A将新值存储到此显式cookie文件中。 我的解决方案是:

服务器B(不是启动会话的客户端!)调用服务器A上的PHP文件.B通过一些安全检查后A应该写一个新的 使用file_puts_content对此cookie文件的值。 注意,因为编写的服务器B还没有启动会话所以我认为我不能简单地做

  session_start(); 
 $ _SESSION ['myval'] =“new val”  ; 
   
 
 

因此我有以下问题:

  1. 是否有更简单的(原生会话) 处理)方式而不是file_puts ...将值写入cookie文件,如:

     将$ _SESSION ['myval'] =“new val”写入
    sess_489b9515146e7390ac03b5dabf36b70e 
         
     
  2. 会话Dir var / lib / php5有chmod 773,要在其中编写和搜索我必须将权限更改为777(urrgh)。 如何保留773但是可以​​用于php

  3. 如果我打开一个cookie文件,则值如下所示:place | s:6:“Muster”; 什么| s:6:是什么意思?

    亲切的问候,

    tony

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题