-
Notifications
You must be signed in to change notification settings - Fork 4
/
controller_pag.php
77 lines (69 loc) · 2.32 KB
/
controller_pag.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
<?php
/*
This file is part of IPnet CRecordings.
IPnet CRecordings is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
include_once 'config.php';
include_once 'connectDb.php';
$accion=$_GET["accion"];
$conf=new config();
$conDb=new connectDb();
$camposPermitidos=$conf->getCamposPermitidos();
$tabla=$conf->getTabla();
$id_editar=$conf->getId_editar();
$_idAuto=$conf->getIdAuto();
$credentials=$conf->getUseCredentials();
$con=$conDb->connect();
if($accion=="pagina")pagina();
if($accion=="buscar")buscar();
if($accion=="login")login($con);
if($accion=="salir")salir($con);
function login($con){
$user=$_POST["user"];
$password=$_POST["password"];
$query="SELECT * FROM asterisk.ampusers WHERE username='$user' and password_sha1=SHA1('$password')";
$result=mysqli_query($con,$query);
$numReg=mysqli_affected_rows($con);
if($numReg==1){
echo("<script>location.href = 'pagmain.php';</script>");
$_SESSION['login']=1;
}
echo("<script>location.href = 'login.php';</script>");
}
function salir($con){
echo "Salir";
mysqli_close($con);
unset($_SESSION["login"]);
session_destroy();
echo("<script>location.href = 'login.php';</script>");
}
function buscar(){
$date=$_GET["date"];
$phone=$_GET["phone"];
$dateStart=substr($date, 0,19);
$dateEnd=substr($date, 21,20);
$pagina=$_GET["pag"];
$query=" calldate>='$dateStart' AND calldate<='$dateEnd' AND (src LIKE '%$phone%' OR dst LIKE '%$phone%')";
unset($_SESSION['query']);
unset($_SESSION['datestart']);
unset($_SESSION['dateend']);
unset($_SESSION['phone']);
$_SESSION['query']=$query;
$_SESSION['datestart']=$dateStart;
$_SESSION['dateend']=$dateEnd;
$_SESSION['phone']=$phone;
echo("<script>location.href = 'pagmain.php?pagina=1';</script>");
}
function pagina(){
$pagina=$_GET["pag"];
echo("<script>location.href = 'pagmain.php?pagina=$pagina';</script>");
}