예제 #1
0
<?php

session_start();
require_once "install.php";
/* REQUEST = $_POST $_GET */
if (!empty($_REQUEST['action'])) {
    $accion = $_REQUEST['action'];
    if ($accion == 'crear') {
        crearUsuario();
    } else {
        if ($accion == 'ver') {
            verUsuarios();
        } else {
            if ($accion == 'update') {
                updateUser();
            } else {
                if ($accion == 'delete') {
                    deleteUser();
                }
            }
        }
    }
}
function crearUsuario()
{
    /* Proteccion de Datos */
    $params = array(':Usuario' => $_POST['Usuario'], ':Contrasena' => $_POST['Contrasena'], ':Nombres' => $_POST['Nombres'], ':ApellidoUno' => $_POST['ApellidoUno'], ':ApellidoDos' => $_POST['ApellidoDos'], ':Titulo' => $_POST['Titulo'], ':Descripcion' => $_POST['Descripcion'], ':Foto' => $_POST['Foto'], ':WebPersonal' => $_POST['WebPersonal'], ':Email' => $_POST['Email']);
    /* Preparamos el query apartir del array $params*/
    $query = 'INSERT INTO Usuarios 
					(Usuario, Contrasena, Nombres, ApellidoUno, ApellidoDos,Titulo ,Descripcion ,Foto,WebPersonal,Email) 
				VALUES 
                                    <th data-column-id="Contrasena" data-width="25%">Contrasena</th>
                                    <th data-column-id="Nombres" data-width="20%">Nombre</th>
                                    <th data-column-id="ApellidoUno" data-width="100px">ApellidoUno </th>
                                    <th data-column-id="ApellidoDos" data-width="100px">ApellidoDos </th>
                                     <th data-column-id="Titulo" data-width="20%">Titulo </th>
                                    <th data-column-id="Descripcion" data-width="100px">Descripcion </th>
                                    <th data-column-id="Foto" data-width="100px">Foto </th>
                                    <th data-column-id="WebPersonal" data-width="20%">Webpersonal </th>
                                    <th data-column-id="Email" data-width="100px">Email  </th>
                                   
                                    <th data-column-id="actions" align="center" data-formatter="actions" data-width="100px">Acciones</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php 
echo verUsuarios();
?>
                            </tbody>
                        </table>

                            </div>
                        </div>
                    </div>
                </div>
                <a type="button" href="addUser.php" class="btn btn-primary pull-right"><i class="fa fa-plus fa-fw"></i> Agregar</a>

                

                <!-- /.row -->

            </div>