-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathgetversion.php
More file actions
107 lines (69 loc) · 2.12 KB
/
getversion.php
File metadata and controls
107 lines (69 loc) · 2.12 KB
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
<?php
///////////// PHP routines
// Headers
header('Content-Type: text/plain');
header('Access-Control-Allow-Origin: *');
// Utilities
include('php/version.php');
include('php/util.php');
util_inicializar("RemoteDebugApp");
function D($msg) {echo $msg . "<br>";}
// Codigo PHP para gravar o acesso e retornar a versao do app
// Localhost ?
$localhost = (startsWith(gethostname(), "MacBook-Pro"));
// Liga o debug
if ($localhost) {
$debug = true;
util_debug_ligar (true);
util_debug_limpar();
}
// Get version
echo $appVersion;
// Save access, only on page load
if (isset($_GET["onload"])) {
// Conecta ao banco de dados MySql/MariaDB
if ($localhost) { // Local
// Conecta
$conn_mysql = util_db_conectar("joaolopesf_net", "192.168.0.106",
"root", "d@t@b@s3.");
} else { // Producao - GoDaddy - www.joaolopesf.net
$conn_mysql = util_db_conectar("joaolopesf_net", "127.0.0.1",
"joaolopesf", "d@t@b@s3.");
}
// Liga o debug
if (isset($_GET["debug"]) == true) {
$debug = true;
util_debug_ligar (true);
util_debug_limpar();
}
//util_grava_log ('I', "*** Inicio do processamento");
// Data e hora
$data = date('Y-m-d H:i:s');
// Inicia a transacao
util_db_begin_trans();
$commit = true;
// Adiciona acesso
$sql = "INSERT INTO remotedebugapp_acesso
(data, ip)
VALUES (
:data, :ip
)";
$sth = util_db_exec_sql($sql, [ 'data' => $data,
'ip' => getRealIpAddr()
], true);
if (is_null($sth)) {
$causa = "insert remotedebugapp_acesso";
util_grava_log('I',"util_db_exec_sql: retornou nulo - " . $causa);
$commit = false;
}
// Finaliza a transacao
if ($commit == true) {
// Salva os dados
util_db_commit_trans();
} else {
// Nao salva os dados
util_db_rollback_trans();
}
}
///// PHP - End
?>