File: session.php

package info (click to toggle)
codelite 17.0.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 136,244 kB
  • sloc: cpp: 491,547; ansic: 280,393; php: 10,259; sh: 8,930; lisp: 7,664; vhdl: 6,518; python: 6,020; lex: 4,920; yacc: 3,123; perl: 2,385; javascript: 1,715; cs: 1,193; xml: 1,110; makefile: 804; cobol: 741; sql: 709; ruby: 620; f90: 566; ada: 534; asm: 464; fortran: 350; objc: 289; tcl: 258; java: 157; erlang: 61; pascal: 51; ml: 49; awk: 44; haskell: 36
file content (499 lines) | stat: -rw-r--r-- 15,292 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
<?php

// Start of session v.

interface SessionHandlerInterface  {

	/**
	 * Initialize session
	 * @link http://www.php.net/manual/en/sessionhandlerinterface.open.php
	 * @param save_path string <p>
	 *      The path where to store/retrieve the session.
	 *     </p>
	 * @param name string <p>
	 *      The session name.
	 *     </p>
	 * @return bool &returns.session.storage.retval;
	 */
	abstract public function open ($save_path, $name) ;

	/**
	 * Close the session
	 * @link http://www.php.net/manual/en/sessionhandlerinterface.close.php
	 * @return bool &returns.session.storage.retval;
	 */
	abstract public function close () ;

	/**
	 * Read session data
	 * @link http://www.php.net/manual/en/sessionhandlerinterface.read.php
	 * @param session_id string <p>
	 *      The session id.
	 *     </p>
	 * @return string an encoded string of the read data. If nothing was read, it must return an empty string. Note this value is returned internally to PHP for processing.
	 */
	abstract public function read ($session_id) ;

	/**
	 * Write session data
	 * @link http://www.php.net/manual/en/sessionhandlerinterface.write.php
	 * @param session_id string <p>
	 *      The session id.
	 *     </p>
	 * @param session_data string <p>
	 *      The encoded session data.  This data is the result of the PHP internally encoding the $_SESSION superglobal to a serialized
	 *      string and passing it as this parameter.  Please note sessions use an alternative serialization method.
	 *     </p>
	 * @return bool &returns.session.storage.retval;
	 */
	abstract public function write ($session_id, $session_data) ;

	/**
	 * Destroy a session
	 * @link http://www.php.net/manual/en/sessionhandlerinterface.destroy.php
	 * @param session_id string <p>
	 *       The session ID being destroyed.
	 *      </p>
	 * @return bool &returns.session.storage.retval;
	 */
	abstract public function destroy ($session_id) ;

	/**
	 * Cleanup old sessions
	 * @link http://www.php.net/manual/en/sessionhandlerinterface.gc.php
	 * @param maxlifetime string <p>
	 *      Sessions that have not updated for the last maxlifetime seconds will be removed.
	 *     </p>
	 * @return bool &returns.session.storage.retval;
	 */
	abstract public function gc ($maxlifetime) ;

}

interface SessionIdInterface  {

	abstract public function create_sid () ;

}

class SessionHandler implements SessionHandlerInterface, SessionIdInterface {

	/**
	 * Initialize session
	 * @link http://www.php.net/manual/en/sessionhandler.open.php
	 * @param save_path string <p>
	 *      The path where to store/retrieve the session.
	 *     </p>
	 * @param session_id string <p>
	 *      The session id.
	 *     </p>
	 * @return bool &returns.session.storage.retval;
	 */
	public function open ($save_path, $session_id) {}

	/**
	 * Close the session
	 * @link http://www.php.net/manual/en/sessionhandler.close.php
	 * @return bool &returns.session.storage.retval;
	 */
	public function close () {}

	/**
	 * Read session data
	 * @link http://www.php.net/manual/en/sessionhandler.read.php
	 * @param session_id string <p>
	 *      The session id to read data for.
	 *     </p>
	 * @return string an encoded string of the read data. If nothing was read, it must return an empty string. Note this value is returned internally to PHP for processing.
	 */
	public function read ($session_id) {}

	/**
	 * Write session data
	 * @link http://www.php.net/manual/en/sessionhandler.write.php
	 * @param session_id string <p>
	 *      The session id.
	 *     </p>
	 * @param session_data string <p>
	 *      The encoded session data.  This data is the result of the PHP internally encoding the $_SESSION superglobal to a serialized
	 *      string and passing it as this parameter.  Please note sessions use an alternative serialization method.
	 *     </p>
	 * @return bool &returns.session.storage.retval;
	 */
	public function write ($session_id, $session_data) {}

	/**
	 * Destroy a session
	 * @link http://www.php.net/manual/en/sessionhandler.destroy.php
	 * @param session_id string <p>
	 *       The session ID being destroyed.
	 *      </p>
	 * @return bool &returns.session.storage.retval;
	 */
	public function destroy ($session_id) {}

	/**
	 * Cleanup old sessions
	 * @link http://www.php.net/manual/en/sessionhandler.gc.php
	 * @param maxlifetime int <p>
	 *      Sessions that have not updated for the last maxlifetime seconds will be removed.
	 *     </p>
	 * @return bool &returns.session.storage.retval;
	 */
	public function gc ($maxlifetime) {}

	/**
	 * Return a new session ID
	 * @link http://www.php.net/manual/en/sessionhandler.create-sid.php
	 * @return string A session ID valid for the default session handler.
	 */
	public function create_sid () {}

}

/**
 * Get and/or set the current session name
 * @link http://www.php.net/manual/en/function.session-name.php
 * @param name string[optional] <p>
 *       The session name references the name of the session, which is 
 *       used in cookies and URLs (e.g. PHPSESSID). It
 *       should contain only alphanumeric characters; it should be short and
 *       descriptive (i.e. for users with enabled cookie warnings).
 *       If name is specified, the name of the current
 *       session is changed to its value.
 *      </p>
 *      <p>
 *       
 *        <p>
 *         The session name can't consist of digits only, at least one letter
 *         must be present. Otherwise a new session id is generated every time.
 *        </p>
 *       
 *      </p>
 * @return string the name of the current session.
 */
function session_name ($name = null) {}

/**
 * Get and/or set the current session module
 * @link http://www.php.net/manual/en/function.session-module-name.php
 * @param module string[optional] <p>
 *       If module is specified, that module will be
 *       used instead.
 *      </p>
 * @return string the name of the current session module.
 */
function session_module_name ($module = null) {}

/**
 * Get and/or set the current session save path
 * @link http://www.php.net/manual/en/function.session-save-path.php
 * @param path string[optional] <p>
 *       Session data path. If specified, the path to which data is saved will
 *       be changed. session_save_path needs to be called
 *       before session_start for that purpose.
 *      </p>
 *      <p>
 *       
 *        <p>
 *         On some operating systems, you may want to specify a path on a
 *         filesystem that handles lots of small files efficiently. For example,
 *         on Linux, reiserfs may provide better performance than ext2fs.
 *        </p>
 *       
 *      </p>
 * @return string the path of the current directory used for data storage.
 */
function session_save_path ($path = null) {}

/**
 * Get and/or set the current session id
 * @link http://www.php.net/manual/en/function.session-id.php
 * @param id string[optional] <p>
 *        If id is specified, it will replace the current
 *        session id. session_id needs to be called before
 *        session_start for that purpose. Depending on the
 *        session handler, not all characters are allowed within the session id.
 *        For example, the file session handler only allows characters in the
 *        range a-z A-Z 0-9 , (comma) and - (minus)!
 *       </p>
 *       
 *        
 *         When using session cookies, specifying an id
 *         for session_id will always send a new cookie
 *         when session_start is called, regardless if the
 *         current session id is identical to the one being set.
 * @return string session_id returns the session id for the current
 *   session or the empty string ("") if there is no current
 *   session (no current session id exists).
 */
function session_id ($id = null) {}

/**
 * Update the current session id with a newly generated one
 * @link http://www.php.net/manual/en/function.session-regenerate-id.php
 * @param delete_old_session bool[optional] <p>
 *        Whether to delete the old associated session file or not.
 *       </p>
 * @return bool Returns true on success, false on failure.
 */
function session_regenerate_id ($delete_old_session = null) {}

/**
 * Decodes session data from a session encoded string
 * @link http://www.php.net/manual/en/function.session-decode.php
 * @param data string <p>
 *       The encoded data to be stored.
 *      </p>
 * @return bool Returns true on success, false on failure.
 */
function session_decode ($data) {}

/**
 * Encodes the current session data as a session encoded string
 * @link http://www.php.net/manual/en/function.session-encode.php
 * @return string the contents of the current session encoded.
 */
function session_encode () {}

/**
 * Start new or resume existing session
 * @link http://www.php.net/manual/en/function.session-start.php
 * @return bool This function returns true if a session was successfully started,
 *   otherwise false.
 */
function session_start () {}

/**
 * Destroys all data registered to a session
 * @link http://www.php.net/manual/en/function.session-destroy.php
 * @return bool Returns true on success, false on failure.
 */
function session_destroy () {}

/**
 * Free all session variables
 * @link http://www.php.net/manual/en/function.session-unset.php
 * @return void 
 */
function session_unset () {}

/**
 * Sets user-level session storage functions
 * @link http://www.php.net/manual/en/function.session-set-save-handler.php
 * @param open callable 
 * @param close callable 
 * @param read callable 
 * @param write callable 
 * @param destroy callable 
 * @param gc callable 
 * @param create_sid callable[optional] 
 * @return bool Returns true on success, false on failure.
 */
function session_set_save_handler ($open, $close, $read, $write, $destroy, $gc, $create_sid = null) {}

/**
 * Get and/or set the current cache limiter
 * @link http://www.php.net/manual/en/function.session-cache-limiter.php
 * @param cache_limiter string[optional] <p>
 *       If cache_limiter is specified, the name of the
 *       current cache limiter is changed to the new value.
 *      </p>
 *      <table>
 *       Possible values
 *       
 *        
 *         <tr valign="top">
 *          <td>Value</td>
 *          <td>Headers sent</td>
 *         </tr>
 *        
 *        
 *         <tr valign="top">
 *          <td>public</td>
 *          <td>
 *           
 *           
 *          </td>
 *         </tr>
 *         <tr valign="top">
 *          <td>private_no_expire</td>
 *          <td>
 *           
 *           
 *          </td>
 *         </tr>
 *         <tr valign="top">
 *          <td>private</td>
 *          <td>
 *           
 *           
 *          </td>
 *         </tr>
 *         <tr valign="top">
 *          <td>nocache</td>
 *          <td>
 *           
 *           
 *          </td>
 *         </tr>
 *        
 *       
 *      </table>
 * @return string the name of the current cache limiter.
 */
function session_cache_limiter ($cache_limiter = null) {}

/**
 * Return current cache expire
 * @link http://www.php.net/manual/en/function.session-cache-expire.php
 * @param new_cache_expire string[optional] <p>
 *       If new_cache_expire is given, the current cache
 *       expire is replaced with new_cache_expire.
 *      </p>
 *      <p>
 *       
 *        
 *         Setting new_cache_expire is of value only, if
 *         session.cache_limiter is set to a value
 *         different from nocache.
 *        
 *       
 *      </p>
 * @return int the current setting of session.cache_expire.
 *   The value returned should be read in minutes, defaults to 180.
 */
function session_cache_expire ($new_cache_expire = null) {}

/**
 * Set the session cookie parameters
 * @link http://www.php.net/manual/en/function.session-set-cookie-params.php
 * @param lifetime int <p>
 *       Lifetime of the
 *       session cookie, defined in seconds.
 *      </p>
 * @param path string[optional] <p>
 *       Path on the domain where
 *       the cookie will work. Use a single slash ('/') for all paths on the
 *       domain.
 *      </p>
 * @param domain string[optional] <p>
 *       Cookie domain, for
 *       example 'www.php.net'. To make cookies visible on all subdomains then
 *       the domain must be prefixed with a dot like '.php.net'.
 *      </p>
 * @param secure bool[optional] <p>
 *       If true cookie will only be sent over
 *       secure connections.
 *      </p>
 * @param httponly bool[optional] <p>
 *       If set to true then PHP will attempt to send the
 *       httponly
 *       flag when setting the session cookie.
 *      </p>
 * @return void 
 */
function session_set_cookie_params ($lifetime, $path = null, $domain = null, $secure = null, $httponly = null) {}

/**
 * Get the session cookie parameters
 * @link http://www.php.net/manual/en/function.session-get-cookie-params.php
 * @return array an array with the current session cookie information, the array
 *   contains the following items:
 *   
 *    
 *     
 *      "lifetime" -  The
 *      lifetime of the cookie in seconds.
 *     
 *    
 *    
 *     
 *      "path" -  The path where
 *      information is stored.
 *     
 *    
 *    
 *     
 *      "domain" -  The domain
 *      of the cookie.
 *     
 *    
 *    
 *     
 *      "secure" -  The cookie
 *      should only be sent over secure connections.
 *     
 *    
 *    
 *     
 *      "httponly" - The
 *      cookie can only be accessed through the HTTP protocol.
 */
function session_get_cookie_params () {}

/**
 * Write session data and end session
 * @link http://www.php.net/manual/en/function.session-write-close.php
 * @return void 
 */
function session_write_close () {}

/**
 * Discard session array changes and finish session
 * @link http://www.php.net/manual/en/function.session-abort.php
 * @return bool This function returns true if a session was successfully reinitialized,
 *   otherwise false.
 */
function session_abort () {}

/**
 * Re-initialize session array with original values
 * @link http://www.php.net/manual/en/function.session-reset.php
 * @return bool This function returns true if a session was successfully reinitialized,
 *   otherwise false.
 */
function session_reset () {}

/**
 * Returns the current session status
 * @link http://www.php.net/manual/en/function.session-status.php
 */
function session_status () {}

/**
 * Session shutdown function
 * @link http://www.php.net/manual/en/function.session-register-shutdown.php
 * @return void 
 */
function session_register_shutdown () {}

/**
 * &Alias; <function>session_write_close</function>
 * @link http://www.php.net/manual/en/function.session-commit.php
 */
function session_commit () {}


/**
 * Since PHP 5.4.0. Return value of session_status if sessions are disabled.
 * @link http://www.php.net/manual/en/session.constants.php
 */
define ('PHP_SESSION_DISABLED', 0);

/**
 * Since PHP 5.4.0. Return value of session_status if sessions are enabled,
 *     but no session exists.
 * @link http://www.php.net/manual/en/session.constants.php
 */
define ('PHP_SESSION_NONE', 1);

/**
 * Since PHP 5.4.0. Return value of session_status if sessions are enabled,
 *     and a session exists.
 * @link http://www.php.net/manual/en/session.constants.php
 */
define ('PHP_SESSION_ACTIVE', 2);

// End of session v.
?>