Jump to content
Sign in to follow this  
Rendril

Function: Mds_Store_Sessdata

Recommended Posts

[b]void[/b] mds_store_sessdata(string $value, [i]optional[/i] int $index);

Stores temporary data for the player.
There are 10 "boxes" for each player which you can work with to store data.
Each player's session storage is unique to them, but each editor works on them independently.
That means 2 different editors can store to index 1 but will not affect eachother.

[b]Parameters[/b]
The value is a string value that will be stored, to store other data types serialize it first.
Index indicates which box to store it in, there are 10 boxes numbered 0 to 9. The default is 0.

[quote]- stored data can be at most 200 chars long
- it is valid only until the user logs out
- its much faster and less intenstive 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 editor[/quote]

Update: The maximum character length is 250.

See the related function [url="http://magicduel.invisionzone.com/topic/7584-function-mds-retrieve-sessdata/"]mds_retrieve_sessdata()[/url].

Example 1:
[code]
mds_store_sessdata('bakery', 2);
mds_retrieve_sessdata(@vd, 2);
//@vd now has 'bakery'
[/code]

Example 2:
Serializing
[code]
@vd = array(
've' => uv('ve'),
'vp' => uv('vp'),
't' => time()
);

mds_store_sessdata(serialize(@vd));
mds_retrieve_sessdata(@va);
@va = unserialize(@va);
[/code] Edited by Rendril

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Forum Statistics

    15,831
    Total Topics
    173,480
    Total Posts
  • Recently Browsing

    No registered users viewing this page.

  • Upcoming Events

    No upcoming events found
  • Recent Event Reviews

×
×
  • Create New...