-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Cliente, Slider, Imagen, Nav, Botones
- Cliente: se añade la funcionalidad de agregar y eliminar clientes por medio de peticiones ajax. - Slider: se elimina código innecesario relacionado con agregar imagen slider, se evita ataques XSS en el titulo de la imagen del slider. - Nav: se elimina código innecesario. - Botones: se añaden acciones para el botón de agregar cliente, agregar slider.
- Loading branch information
Showing
12 changed files
with
210 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
session_start(); | ||
if(!isset($_SESSION['idUsuario'],$_SESSION['nombreUsuario'], $_SESSION['apellidoUsuario'], $_SESSION['superAdminUsuario'])){ | ||
header('location: error'); | ||
} | ||
require_once ("notificaciones.php"); | ||
$mensaje = get_error_insert_client(); | ||
print_r($_POST); | ||
print_r($_FILES); | ||
if(sizeof($_POST) == 1 && isset($_POST['nombreCliente'], $_FILES['myfile'])){ | ||
|
||
$directorioDeGuardado = "../../images/clientes/"; | ||
$nombreArchivo = $_FILES['myfile']['name']; | ||
$fullPath = $directorioDeGuardado.$nombreArchivo; // construyo la ruta completa donde se guardará el archivo. | ||
if (! file_exists($fullPath)){ //verifico que no exista la imagen anterior | ||
require_once ("clientModel.php"); | ||
require_once ("userModel.php"); | ||
$clientModel = new ClientModel(); | ||
$userModel = new UserModel(); | ||
$usuario = $userModel->view_db_user($_SESSION['idUsuario']); | ||
$nombreCliente = htmlspecialchars($_POST['nombreCliente'], ENT_NOQUOTES); //evito ataques XSS | ||
$resultado = $clientModel->insert_db_client($nombreCliente, $usuario['idUsuario']); | ||
if($resultado){ | ||
$ultimoCliente = $clientModel->view_db_last_client(); | ||
print_r($ultimoCliente); | ||
if($ultimoCliente != null){ | ||
|
||
require_once ("imagenModel.php"); | ||
$imagenModel = new ImagenModel(); | ||
$resultado = $imagenModel->insert_image_client($fullPath, $nombreCliente, $ultimoCliente['idCliente']); | ||
if($resultado){ | ||
move_uploaded_file($_FILES["myfile"]["tmp_name"], $fullPath); //muevo el archivo cargado | ||
$mensaje = get_success_insert_client($nombreCliente); // obtengo el mensaje de que todo ha salido bien. | ||
} | ||
} | ||
else | ||
print("ultimoCliente null"); | ||
} | ||
} | ||
} | ||
echo $mensaje; | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
session_start(); | ||
if(!isset($_SESSION['idUsuario'],$_SESSION['nombreUsuario'], $_SESSION['apellidoUsuario'], $_SESSION['superAdminUsuario'])){ | ||
header('location: error'); | ||
} | ||
include_once ("imports.php"); | ||
include_once ("header.php"); | ||
include_once ("nav.php"); | ||
include_once ("footer.php"); | ||
getImportsUp(); | ||
?> | ||
<body id="body"> | ||
<div class="con" id="con"> | ||
<div class="container" id="main"> | ||
<?php | ||
getHeader(); | ||
if($_SESSION['superAdminUsuario'] == 1){ | ||
getNavSuperAdmin(); | ||
} | ||
else | ||
getNavAdmin(); | ||
?> | ||
</div> | ||
<div class="contenido"> | ||
<div class="row"> | ||
<br> | ||
<div class="col-xs-12 col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2"> | ||
<div class="panel panel-default empresa"> | ||
<div class="panel-heading"> | ||
Crear cliente | ||
</div> | ||
<div class="panel-body"> | ||
<div id="mensaje"></div> | ||
<h2 style="color: #019831; text-align: center;">Formulario para agregar un nuevo cliente de Ingnovarq S.A.S</h2> | ||
<br> | ||
<div class="form-horizontal"> | ||
<div class="form-group"> | ||
<label for="name" class="control-label col-xs-2">Nombre:</label> | ||
<div class="col-xs-10"> | ||
<input type="name" id="nombreCliente" name="nombreCliente" class="form-control" placeholder="Nombre"> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<label class="control-label col-xs-2">Imagen:</label> | ||
<div class="col-xs-10" id="cargador"> | ||
<div id="fileuploader">Cargar imagen</div> | ||
</div> | ||
</div> | ||
<div class="form-group"> | ||
<div class="col-xs-offset-2 col-xs-8"> | ||
<div id="btn-agregar-cliente-ajax" class="btn btn-success"> | ||
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span> Crear nuevo cliente</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<?php | ||
getFooter(); | ||
getImportsDown(); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters