-
Notifications
You must be signed in to change notification settings - Fork 22
/
init_js.php
38 lines (30 loc) · 1.34 KB
/
init_js.php
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
<?php
if (!defined('_VALID_ACCESS'))
define('_VALID_ACCESS',1);
require_once('include/data_dir.php');
if(!file_exists(DATA_DIR.'/config.php'))
die();
if(!is_writable(DATA_DIR))
die();
require_once('include/config.php');
require_once('include/error.php');
require_once('include/database.php');
if(defined('CID')) {
if(constant('CID')!==false) die('alert(\'Invalid update script defined custom CID. Please try to refresh site manually.\');');
} else
define('CID',false); //i know that i won't access $_SESSION['client']
require_once('include/session.php');
// if it's direct request to this file return content-type: text/javascript
// otherwise it's include and do not send header.
if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__)
header("Content-type: text/javascript");
$client_id = isset($_SESSION['num_of_clients'])?$_SESSION['num_of_clients']:0;
$client_id_next = $client_id+1;
$_SESSION['num_of_clients'] = $client_id_next;
//DBSession::destroy_client(session_id(),$client_id);
if($client_id-5>=0) {
EpesiSession::destroy_client(session_id(),$client_id-5);
$_SESSION['session_destroyed'][$client_id-5] = 1;
}
session_commit();
?>Epesi.init(<?php print($client_id); ?>,'<?php print(rtrim(str_replace('\\','/',dirname($_SERVER['PHP_SELF'])),'/').'/process.php'); ?>','<?php print(http_build_query($_GET));?>');