-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
92 lines (80 loc) · 2.25 KB
/
index.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
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
<?php
// You'd put this code at the top of any "protected" page you create
// Always start this first
session_start();
if ( isset( $_SESSION['user_id'] ) ) {
/*
IMPORTANT: DO NOT MODIFY THIS FILE.
*/
include('config.php');
include('functions.php');
//request_authentication($USERNAME,$PASSWORD);
include('templates/header.html');
$op = sanitize($_REQUEST['op']);
switch($op) {
default:
print_stats_counters();
break; break;
case "add":
$data=array(
'op'=>'adding',
'id'=>'',
'startcounter'=>'',
'maxcounter'=>'',
'url'=>'',
'utmtags'=>'',
'percent'=>''
);
echo parse_template($data,"templates/form_add.html");
break;
case "adding":
$data=verify_form();
if($data!="ERROR"){
$data['id']=create_counter($data);
create_history_log_file($data['id'],date("Ymd"));
echo '<br><div class="alert alert-success"><p style="color:black;">Counter ID '.$data['id'].' has been created.</p></div>';
echo parse_template($data,"templates/counter_details.html");
};
break;
case "edit":
$data=get_counter($_REQUEST['id']);
echo parse_template($data,"templates/form_add.html");
break;
case "editing":
$data=verify_form();
if($data!="ERROR"){
edit_counter($data,$op);
echo '<br><div class="alert alert-success"><p style="color:black;">Counter ID '.$data['id'].' has been edited.</p></div>';
echo parse_template($data,"templates/counter_details.html");
}
break;
case "remove":
remove_counter($_REQUEST['id'],$op);
echo '<br><div class="alert alert-success"><p style="color:black;">Counter ID '.$data['id'].' has been deleted.</p></div>';
break;
case "counter_code":
$data=array(
'id'=>$_REQUEST['id'],
'url'=>$URL_SCRIPT_FOLDER
);
echo parse_template($data,"templates/counter_code.html");
break;
case "counter_link":
$data=array(
'id'=>$_REQUEST['id'],
'urlscriptfolder'=>$URL_SCRIPT_FOLDER
);
echo parse_template($data,"templates/counter_link.html");
break;
case "counter_history":
$data=get_counter($_REQUEST['id']);
$data['html_history']=get_counter_history($_REQUEST['id']);
echo parse_template($data,"templates/counter_history.html");
break;
}
include('templates/footer.html');
} else {
// Redirect them to the login page
header("Location: login.php");
}
?>