<?php
include_once("usercheck.php");
if(isset($_GET["opmode"])){
include_once("sharemem.inc");
$ParaList=shRead(); //read the share memory
parse_str($ParaList);
...
?>clear share memory:
<?php
include_once("sharemem.inc"); for ($i=0; $i<MAXUSERS ;$i++){
$shKey=BASEADDR+$i*KEYSTEPS;
      @shClose($shKey);
}
?>

解决方案 »

  1.   

    只在unix、 linux下有效。真正使用这个环境的人很少。
      

  2.   

    客户要求不能用cookies,不能在地址栏里传递参数,不能...... and so on.
    你该怎么办啊?
      

  3.   

    你的客户真牛啊,为何自己不写个呢?共享内存导致溢出是全球web的最有名漏洞了.你也想.../?shmop_open()函数介绍:(PHP 4 >= 4.0.4)shmop_open -- Create or open shared memory block
    Description
    int shmop_open ( int key, string flags, int mode, int size)
    shmop_open() can create or open a shared memory block. shmop_open() takes 4 parameters: key, which is the system's id for the shared memory block, this parameter can be passed as a decimal or hex. The second parameter are the flags that you can use: 
    "a" for access (sets SHM_RDONLY for shmat) use this flag when you need to open an existing shared memory segment for read only "c" for create (sets IPC_CREATE) use this flag when you need to create a new shared memory segment or if a segment with the same key exists, try to open it for read and write "w" for read & write access use this flag when you need to read and write to a shared memory segment, use this flag in most cases. "n" create a new memory segment (sets IPC_CREATE|IPC_EXCL) use this flag when you want to create a new shared memory segment but if one already exists with the same flag, fail. This is useful for security purposes, using this you can prevent race condition exploits. The third parameter is the mode, which are the permissions that you wish to assign to your memory segment, those are the same as permission for a file. Permissions need to be passed in octal form ex. 0644. The last parameter is size of the shared memory block you wish to create in bytes. 
    注: Note: the 3rd and 4th should be entered as 0 if you are opening an existing memory segment. On success shmop_open() will return an id that you can use to access the shared memory segment you've created. 
    例子 1. Create a new shared memory block<?php
    $shm_id = shmop_open(0x0fff, "c", 0644, 100);
    ?>
     
    This example opened a shared memory block with a system id of 0x0fff. 
      

  4.   

    客户要求不能用cookies,不能在地址栏里传递参数,不能...... and so on.
    你该怎么办啊?//--你叫他去shi!
      

  5.   

    关于shmop的用法
    http://www.php.net/manual/zh/ref.shmop.php
      

  6.   

    有些功能连php都不推荐,干吗用php做一些php不善长的东西。
    如果你很牛,我前天昨晚一个网站模版系统,总感觉功能不够完善,
    希望你修改修改。这个模版带逻辑处理。比如简单的if,else,for语句。
      

  7.   

    用文件枷锁或者post方法部都可以实现吗?