-
Notifications
You must be signed in to change notification settings - Fork 0
/
global.php
62 lines (43 loc) · 1.68 KB
/
global.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
require 'functions.php';
require 'js/jsLibs.php';
require 'includes/SQLWrapper.php';
require 'includes/Command.php';
//global $DBRegion,$conn;
$DBRegion = "CRMSGP2";
date_default_timezone_set('Asia/Singapore');
session_start();
//autoloading classes
spl_autoload_register('autoload');
//testing MYSQL Connection
$conn = SQLWrapperConfiguration::setConnection("localhost:3306", "root", "sooann", "CRMSGP2");
//Security settings - webpage tracking
//webtracking functionalities
$webpageTracking = new SQLWrapper("SEC_Webpagetracking");
$webpageTracking->addparam('Url', $_SERVER['REQUEST_URI'], 'text');
$webpageTracking->addparam('Requestmethod', $_SERVER['REQUEST_METHOD'], 'text');
if ($_SERVER['REQUEST_METHOD']=="POST") {
ob_start();
var_dump($_POST);
$postdump = ob_get_clean();
$webpageTracking->addparam('Postdata', $postdump, 'text');
}
$webpageTracking->addparam('Querystring', $_SERVER['QUERY_STRING'], 'text');
$webpageTracking->addparam('Httpuseragent', $_SERVER['HTTP_USER_AGENT'], 'text');
$webpageTracking->addparam('Remoteaddr', $_SERVER['REMOTE_ADDR'], 'text');
if(isset($_SERVER['HTTP_REFERER'])) {
$webpageTracking->addparam('Httpreferer', $_SERVER['HTTP_REFERER'], 'text');
}
$webpageTracking->addparam('Sessionid', session_id(), 'text');
if(isset($_SESSION["user_id"])) {
if(!is_nan($_SESSION["user_id"])) {
$webpageTracking->addparam('Createdby', $_SESSION["user_id"], 'int');
}
}
$webpageTracking->addparam('createddate', now(), 'date');
$webpageTracking->insert();
?>