-
Notifications
You must be signed in to change notification settings - Fork 0
/
usuarios.php
143 lines (118 loc) · 3.55 KB
/
usuarios.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
<?php
include "conexion.php";
session_start();
if (!isset($_SESSION['usuario'])){
echo "<script>window.location='index.php'</script>";
}
?>
<html lang="es">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Panel Comedor Estudiantil</title>
<link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Comedor Estudiantil</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="usuarios.php">Usuarios</a></li>
<li><a href="contabilidad.php">Contabilidad</a></li>
<li><a href="cuenta_panel.php">Cuenta</a></li>
<li><a href="aut_logout.php">Salir</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="container">
<br><br><br><br>
<form class="form-horizontal" action="usuarios.php" method="POST">
<fieldset>
<!-- Form Name -->
<legend>Buscar Usuario</legend>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="buscar">Buscar</label>
<div class="col-md-4">
<input id="buscar" name="buscar" type="text" placeholder="Digite el nombre" class="form-control input-md">
<span class="help-block">Digite el nombre del usuario para buscar</span>
</div>
</div><center>
<button type="submit" class="btn btn-primary">Buscar</button>
</fieldset>
</form>
<table class="table table-striped">
<tr>
<td>
<b><center>NOMBRE
</td>
<td>
<b><center>Tipo
</td>
<td>
<b><center>Editar
</td>
</tr>
<?php
if(isset($_POST['buscar'])){
$queEmp = "SELECT * FROM usuarios where nombre like '%".$_POST['buscar']."%' limit 50 ";
}else{
$queEmp = "SELECT * FROM usuarios limit 50 ";
}
$resEmp = mysql_query($queEmp, $conexion) or die(mysql_error());
$totEmp = mysql_num_rows($resEmp);
if ($totEmp> 0) {
echo "";
while ($rowEmp = mysql_fetch_assoc($resEmp)) {
if($rowEmp['tipo'] == 1){
$id = 1;
$tipo = "Estudiante Regular";
}
if($rowEmp['tipo'] == 2){
$id = 2;
$tipo = "Profesor";
}
if($rowEmp['tipo'] == 3){
$id = 1;
$tipo = "Estudiante Becado";
}
if($rowEmp['tipo'] == 0){
$id = 0;
$tipo = "ADMINISTRADOR";
}
echo "
<tr>
<td>
<center>".$rowEmp['nombre']."
</td>
<td>
<center>".$tipo."
</td>
<td>
<center>
<a href='cuenta_mod.php?id=".$rowEmp['id_user']."' class='btn btn-success'>Editar</a>
</td>
</tr>";
}}
?>
</table>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
</body>
</html>