-
Notifications
You must be signed in to change notification settings - Fork 0
/
importa_do.php
150 lines (124 loc) · 5.87 KB
/
importa_do.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?php require_once('Connections/local.php'); ?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "index.php?error=2";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
$MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
mysql_select_db($database_local, $local);
$query_usuarios = "SELECT * FROM usuarios where empresa_id='".$_SESSION['MM_UserGroup']."'";
$usuarios = mysql_query($query_usuarios, $local) or die(mysql_error());
$row_usuarios = mysql_fetch_assoc($usuarios);
$totalRows_usuarios = mysql_num_rows($usuarios);
mysql_select_db($database_local, $local);
$query_creditos_disponibles = "SELECT sum(creditos) FROM creditos WHERE empresa_id ='".$_SESSION['MM_UserGroup']."'";
$creditos_disponibles = mysql_query($query_creditos_disponibles, $local) or die(mysql_error());
$row_creditos_disponibles = mysql_fetch_assoc($creditos_disponibles);
$totalRows_creditos_disponibles = mysql_num_rows($creditos_disponibles);
?><!DOCTYPE html>
<html>
<head>
<title>tured.com</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="js/jquery.mobile-1.2.1.css" />
<script src="js/jquery-1.7.1.min.js"></script>
<script src="js/jquery.mobile-1.2.1.js"></script>
<script src="jquery.validate.js"></script>
<script src="main.js"></script>
</head>
<style>
.nav-glyphish-example .ui-btn .ui-btn-inner { padding-top: 40px !important; }
.nav-glyphish-example .ui-btn .ui-icon { width: 30px!important; height: 30px!important; margin-left: -15px !important; box-shadow: none!important; -moz-box-shadow: none!important; -webkit-box-shadow: none!important; -webkit-border-radius: 0 !important; border-radius: 0 !important; }
#chat .ui-icon { background: url(glyphish-icons/119-piggy-bank.png) 50% 50% no-repeat; }
#email .ui-icon { background: url(glyphish-icons/06-magnify.png) 50% 50% no-repeat;}
#login .ui-icon { background: url(glyphish-icons/30-key.png) 50% 50% no-repeat; }
#beer .ui-icon { background: url(glyphish-icons/139-flags.png) 50% 50% no-repeat; }
#coffee .ui-icon { background: url(glyphish-icons/192-credit-card.png) 50% 50% no-repeat;}
#skull .ui-icon { background: url(glyphish-icons/17-bar-chart.png) 50% 50% no-repeat; }
</style>
<body>
<!-- Start of first page: #one -->
<div data-role="page" id="registerPage">
<div data-role="header">
<a href="logout.php" data-icon="delete" rel="external">Salir</a>
<h1>TuRed.com</h1>
<a href="micuenta.php" data-icon="gear" rel="external">Mi Cuenta</a>
<div class="ui-body-d ui-body">
<div data-role="navbar" class="nav-glyphish-example" data-grid="d" >
<ul>
<li><a href="compras.php" id="chat" data-icon="custom" rel="external">Registrar Compra</a></li>
<li><a href="consulta.php" id="email" data-icon="custom" rel="external">Consultas</a></li>
<li><a href="reporte.php" id="skull" data-icon="custom" rel="external">Reportes</a></li>
<li><a href="campanas.php" id="beer" data-icon="custom" rel="external" class="ui-btn-active ui-state-persist" >Campañas</a></li>
<li><a href="creditos.php" id="coffee" data-icon="custom" rel="external">Créditos(<?php echo $row_creditos_disponibles['sum(creditos)']; ?>)</a></li>
</ul>
</div>
<div class="ui-body-d ui-body" >
<div data-role="navbar" data-theme="b" >
<ul>
<li><a href="campanas.php" rel="external">Mensaje Masivo (SMS)</a></li>
<li><a href="mensajes_seleccionados.php" rel="external" >Mensaje a Seleccionados</a></li>
<li><a href="import.php" rel="external" class="ui-btn-active ui-state-persist" >Importar Base de Datos de Clientes</a></li>
</ul>
</div></div><!-- /navbar -->
</div></div>
<div data-role="content">
<?php
$upi=0;
foreach ($_SESSION['query'] as &$valor) {$upi=$upi+1;
$insertSQL = "INSERT INTO usuarios (nombres, ci, telf,estado,fecha_in,empresa_id) VALUES ".$valor;
mysql_select_db($database_local, $local);
$Result1 = mysql_query($insertSQL, $local) or die(mysql_error());
}
// $array ahora es array(2, 4, 6, 8)
unset($valor);
?>
<a href="reporte.php" data-role="button" rel="external">Listo! <?php echo $upi;?> Clientes importados</a>
</div><!-- /content -->
<div data-role="footer" class="footer-docs" data-theme="b" align="center">
<p class="jqm-version"></p>
<p>tured.com 2013</p>
</div>
</div>
<!-- /page -->
</body>
</html>
<?php
mysql_free_result($usuarios);
?>