FANDOM


mds_store_sessdata

mds_store_sessdata - Stores temporary data for the player.

Description

null mds_store_sessdata(string $value [, int $index])

Stores temporary data for the player.

Each player can have up to 10 "boxes" of temporary data. This data is unique per player and not shared across script authors.

Parameters

value
A string value that will be stored, to store other data types serialize it first.
index
Index indicates which "box" to store it in, there are 10 boxes numbered 0 to 9. The default is 0.

Return Values

Returns NULL.

Notes

  • stored data can be at most 250 chars long
  • it is valid only until the user logs out
  • its much faster and less intensive on the server because it is not using database
  • can be read/set only be the same user that opens the item (it is not shared among users)
  • it is shared across all items edited by the same script author
  • Examples

    example #1

    mds_store_sessdata('bakery', 2);
    mds_retrieve_sessdata(@vd, 2);
    echo 'sessdata slot 2 contains:'.@vd;

     

    example #2

    @vd = array(
      've' => uv('ve'),
      'vp' => uv('vp'),
      't' => time()
    );

    mds_store_sessdata(serialize(@vd));
    mds_retrieve_sessdata(@va);
    @va = unserialize(@va);

    See Also


    Community content is available under CC-BY-SA unless otherwise noted.