SlideShare una empresa de Scribd logo
1 de 30
Descargar para leer sin conexión
UNIVERSIDAD CENTRAL DEL ECUADOR
F FACULTAD DE FILOSOFÍA, LETRAS Y CIENCIAS DE LA EDUCACIÓN
PEDAGOGÍA DE LAS CIENCIAS EXPERIMENTALES DE LA
INFORMÁTICA
PROGRAMACIÓN ORIENTADA A OBJETOS
AUTOR:
Mateo Quishpe
PARALELO:
3 “C”
DOCENTE:
MSc. Víctor Zapata
FECHA:
22 – 09 – 2021
INFORME DEL EXAMEN
TEMA:
Examen
OBJETIVO:
Usar todo lo aprendido a lo largo del semestre en un programa alternativo
RESULTADOS DE APRENDIZAJE
Comprender todas las sentencias aprendidas
Desarrollar un proyecto propio
ACTIVIDADES:
- Elaborar un programa alternativo
- Pagina de compra de pizzas
DESARROLLO DE CONTENIDOS
CODIGO DEL PROGRAMA:
<?php
$host="localhost";
$bd= "proyectoe";
$usuario="root";
$contrasenia="";
try {
$conexion=new PDO("mysql:host=$host;dbname=$bd", $usuario, $contras
enia);
} catch ( Exception $ex) {
echo $ex->getMessage();
}
?>
<?php
session_start();
session_destroy();
header('Location: ../index.php');
?>
<?php
$conex = mysqli_connect("localhost","root","","proyectoe");
?>
* {
padding: 0;
margin: 0;
font-family: century gothic;
color: #444
}
h1 {
padding: 12px;
}
div {
padding: 10px 20px;
}
<?php
$inc = include("con_db.php");
?>
<?php
if ($inc) {
$consulta = "SELECT * FROM productos";
$resultado = mysqli_query($conex,$consulta);
if ($resultado) {
$u=1;
while ($row = $resultado->fetch_array()) {
$id = $row['id'];
$nombre = $row['nombre'];
$imagen = $row['imagen'];
$precio = $row['precio'];
$descripcion = $row['descripcion'];
?>
<div>
<div>
<p>
<?php print 'Registro: '.$u;?>
<b><br> ID: </b> <?php echo $id ?><br>
<b>NOMBRE: </b> <?php echo $nombre ?><br>
<b>IMAGEN: </b> <?php echo $imagen ?><br>
<b>PRECIO: </b> <?php echo $precio ?><br>
<b>DESCRIPCION: </b> <?php echo $descripcion ?><br
>
</p>
</div>
</div>
<?php
$u=$u+1;
}
}
}
?>
<?php include("../template/cabecera.php"); ?>
<?php
$txtID=(isset($_POST['txtID']))?$_POST['txtID']:"";
$txtNombre=(isset($_POST['txtNombre']))?$_POST['txtNombre']:"";
$txtImagen=(isset($_FILES['txtImagen']['name']))?$_FILES['txtImagen
']['name']:"";
$txtPrecio=(isset($_POST['txtPrecio']))?$_POST['txtPrecio']:"";
$txtDescripcion=(isset($_POST['txtDescripcion']))?$_POST['txtDescri
pcion']:"";
$accion=(isset($_POST['accion']))?$_POST['accion']:"";
include("../config/bd.php");
switch($accion){
case "Agregar":
$sentenciaSQL= $conexion-
>prepare("INSERT INTO productos (nombre, imagen, precio, descripcion) V
ALUES (:nombre,:imagen,:precio,:descripcion);");
$sentenciaSQL->bindParam(':nombre',$txtNombre);
$fecha= new DateTime();
$nombreArchivo=($txtImagen!="")?$fecha-
>getTimestamp()."_".$_FILES["txtImagen"]['name']:"imagen.jpg";
$tmpImagen=$_FILES["txtImagen"]["tmp_name"];
if ($tmpImagen!="") {
move_uploaded_file($tmpImagen,"../../img/".$nombreArchi
vo);
}
$sentenciaSQL->bindParam(':imagen',$nombreArchivo);
$sentenciaSQL->bindParam(':precio',$txtPrecio);
$sentenciaSQL->bindParam(':descripcion',$txtDescripcion);
$sentenciaSQL->execute();
break;
case "Modificar":
echo "Presionado botón Modificar";
$sentenciaSQL= $conexion-
>prepare("UPDATE productos SET nombre=:nombre WHERE id=:id");
$sentenciaSQL->bindParam(':nombre',$txtNombre);
$sentenciaSQL->bindParam(':id',$txtID);
$sentenciaSQL->execute();
$sentenciaSQL= $conexion-
>prepare("UPDATE productos SET precio=:precio WHERE id=:id");
$sentenciaSQL->bindParam(':precio',$txtPrecio);
$sentenciaSQL->bindParam(':id',$txtID);
$sentenciaSQL->execute();
$sentenciaSQL= $conexion-
>prepare("UPDATE productos SET descripcion=:descripcion WHERE id=:id");
$sentenciaSQL->bindParam(':descripcion',$txtDescripcion);
$sentenciaSQL->bindParam(':id',$txtID);
$sentenciaSQL->execute();
if ($txtImagen!="") {
$fecha= new DateTime();
$nombreArchivo=($txtImagen!="")?$fecha-
>getTimestamp()."_".$_FILES["txtImagen"]['name']:"imagen.jpg";
$tmpImagen=$_FILES["txtImagen"]["tmp_name"];
move_uploaded_file($tmpImagen,"../../img/".$nombreArchi
vo);
$sentenciaSQL= $conexion-
>prepare("SELECT imagen FROM productos WHERE id=:id");
$sentenciaSQL->bindParam(':id',$txtID);
$sentenciaSQL->execute();
$producto=$sentenciaSQL->fetch(PDO::FETCH_LAZY);
if ( isset($producto["imagen"]) &&($producto["imagen"]!="im
agen.jpg") ) {
if (file_exists("../../img/".$producto["imagen"])) {
unlink("../../img/".$producto["imagen"]);
}
}
$sentenciaSQL= $conexion-
>prepare("UPDATE productos SET imagen=:imagen WHERE id=:id");
$sentenciaSQL->bindParam(':imagen',$nombreArchivo);
$sentenciaSQL->bindParam(':id',$txtID);
$sentenciaSQL->execute();
}
header("Location: productos.php");
break;
case "Cancelar":
header("Location: productos.php");
break;
case "Seleccionar":
//busqueda e impresion de datos";
$sentenciaSQL= $conexion-
>prepare("SELECT * FROM productos WHERE id=:id");
$sentenciaSQL->bindParam(':id',$txtID);
$sentenciaSQL->execute();
$producto=$sentenciaSQL->fetch(PDO::FETCH_LAZY);
$txtNombre=$producto['nombre'];
$txtImagen=$producto['imagen'];
$txtPrecio=$producto['precio'];
$txtDescripcion=$producto['descripcion'];
break;
case "Borrar":
$sentenciaSQL= $conexion-
>prepare("SELECT imagen FROM productos WHERE id=:id");
$sentenciaSQL->bindParam(':id',$txtID);
$sentenciaSQL->execute();
$producto=$sentenciaSQL->fetch(PDO::FETCH_LAZY);
if ( isset($producto["imagen"]) &&($producto["imagen"]!="im
agen.jpg") ) {
if (file_exists("../../img/".$producto["imagen"])) {
unlink("../../img/".$producto["imagen"]);
}
}
$sentenciaSQL= $conexion-
>prepare("DELETE FROM productos WHERE id=:id");
$sentenciaSQL-> bindParam(':id', $txtID);
$sentenciaSQL->execute();
header("Location: productos.php");
break;
}
$sentenciaSQL= $conexion->prepare("SELECT * FROM productos ");
$sentenciaSQL->execute();
$listaproductos=$sentenciaSQL->fetchAll(PDO::FETCH_ASSOC);
?>
<div class="col-md-5">
<div class="card">
<div class="card-header">
<center>
<h4 style="color: red;">PRODUCTOS A INSERTAR </h4>
</center>
</div>
<div class="card-body">
<form method="POST" enctype="multipart/form-data">
<div class = "form-group">
<label for="txtID">ID:</label>
<input type="text" required readonly class="form-
control" value="<?php echo $txtID; ?>" name="txtID" id="txtID" placehol
der="ID">
</div>
<div class = "form-group">
<label for="txtNombre">Nombre del producto:</label>
<input type="text" required class="form-
control" value="<?php echo $txtNombre; ?>" name="txtNombre" id="txtNomb
re" placeholder="Nombre">
</div>
<div class = "form-group">
<label for="txtNombre">Imagen del producto:</label>
<br>
<?php if ($txtImagen!="") { ?>
<img class="img-
thumbnail rounded" src="../../img/<?php echo $txtImagen; ?>" width="50"
alt="">
<?php } ?>
<input type="file" class="form-
control" name="txtImagen" id="txtImagen" placeholder="Nombre">
</div>
<div class = "form-group">
<label for="txtPrecio">Precio del producto:</label>
<input type="text" required class="form-
control" value="<?php echo $txtPrecio; ?>" name="txtPrecio" id="txtPrec
io" >
</div>
<div class = "form-group">
<label for="txtDescripcion">Descripcion del product
o:</label>
<input type="text" required class="form-
control" value="<?php echo $txtDescripcion; ?>" name="txtDescripcion" i
d="txtDescripcion" placeholder="Descripcion">
</div>
<div class="btn-group" role="group" aria-label="">
<button type="submit" name="accion" <?php echo ($ac
cion == "Seleccionar")?"disabled":""; ?> value="Agregar" class="btn btn
-success">Agregar</button>
<button type="submit" name="accion" <?php echo ($ac
cion != "Seleccionar")?"disabled":""; ?> value="Modificar" class="btn b
tn-warning">Modificar</button>
<button type="submit" name="accion" <?php echo ($ac
cion != "Seleccionar")?"disabled":""; ?> value="Cancelar" class="btn bt
n-info">Cancelar</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-md-7">
<table class="table table-bordered">
<thead>
<tr>
<th>ID</th>
<th>Nombre de la pizza</th>
<th>Imagen del producto</th>
<th>Precio del producto</th>
<th>Descripcion del producto</th>
<th>Acciones a realizar</th>
</tr>
</thead>
<tbody>
<?php
foreach($listaproductos as $producto){ ?>
<tr>
<td><?php echo $producto['id']; ?></td>
<td><?php echo $producto['nombre']; ?></td>
<td>
<img class="img-
thumbnail rounded" src="../../img/<?php echo $producto['imagen']; ?>" w
idth="50" alt="">
</td>
<td><?php echo $producto['precio']; ?></td>
<td><?php echo $producto['descripcion']; ?></td>
<td>
<form method="POST">
<input type="hidden" name="txtID" id="txtID" va
lue="<?php echo $producto['id']; ?>">
<input type="submit" name="accion" value="Selec
cionar" class="btn btn-primary"/>
<input type="submit" name="accion" value="Borra
r" class="btn btn-danger"/>
</form>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php include("../template/pie.php"); ?>
<?php include("../template/cabecera.php"); ?>
<head>
<title>Registrar usuario</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="estilo.css">
</head>
<body>
<?php
include("mostrar.php");
?>
</body>
<?php include("../template/pie.php"); ?>
<?php
session_start();
if($_POST){
if(($_POST['usuario']=="Mateo")&&($_POST['contrasenia']=="45613")){
$_SESSION['usuario']="ok";
$_SESSION['nombreUsuario']="PIZZERIA";
header('Location: inicio.php');
}else {
$mensaje="Error: El usuario o contraseña son incorrectos";
}
}
?>
<!doctype html>
<html lang="en">
<head>
<title>SESION-ADMIN</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-
scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/boo
tstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-
ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" cross
origin="anonymous">
</head>
<body background="../img/fondo11.jpg">
<div class="container">
<div class="row">
<div class="col-md-4">
</div>
<div class="col-md-4">
<br><br><br>
<div class="card">
<div class="card-header">
<center>
Login
</center>
</div>
<div class="card-body">
<?php
if (isset($mensaje)) { ?>
<div class="alert alert-danger" role="alert">
<?php echo $mensaje; ?>
</div>
<?php } ?>
<form method="POST">
<div class = "form-group">
<label>Usuario</label>
<input type="text" class="form-
control" name="usuario" placeholder="Escribe tu usuario">
</div>
<div class="form-group">
<label>Contraseña:</label>
<input type="password" class="form-
control" name="contrasenia" placeholder="Escribe tu contraseña">
</div>
<button type="submit" class="btn btn-
primary">Entrar al administrdor</button>
</form>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
<?php include('template/cabecera.php');?>
<div class="col-md-12">
<div class="jumbotron">
<center>
<h1 class="display-
3">BIENVENIDO <?php echo $nombreUsuario; ?> </h1>
<p class="lead">Usted podra agregar, editar y borra
r los productos que quiere mostrar en su pagina web</p>
<hr class="my-2">
<img src="../img/img1.jfif" alt="">
</center>
<p class="lead">
<center>
<a class="btn btn-primary btn-
lg" href="seccion/productos.php" role="button">Administrar productos</a
>
</center>
</p>
</div>
</div>
<?php include('template/pie.php');?>
/* General */
body {
margin: 0;
padding: 0;
font-family: 'Roboto', sans-serif;
text-align: center;
}
/* Input Forms*/
input[type="text"], input[type="password"]{
outline: none;
padding: 20px;
display: block;
width: 300px;
border-radius: 3px;
border: 1px solid #eee;
margin: 20px auto;
}
input[type="submit"] {
padding: 10px;
color: #fff;
background: #0098cb;
width: 320px;
margin: 20px auto;
margin-top: 0;
border: 0;
border-radius: 3px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #00b8eb;
}
/* Header */
header {
border-bottom: 2px solid #eee;
padding: 20px 0;
margin-bottom: 10px;
width: 100%;
text-align: center;
}
header a {
text-decoration: none;
color: #333;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Welcome to you WebApp</title>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="st
ylesheet">
<link rel="stylesheet" href="assets/css/style.css">
</head>
<body>
<header>
<a href="index.php"><font style="color:magenta;">PIZERIA MATEO</font>
</a>
</header>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-
scale=1.0" />
<title>Pizeria AC</title>
<link rel="stylesheet" href="estillob.css"/>
<!--FONT OSWALD-->
<link rel="preconnect" href="https://fonts.gstatic.com" />
<!--FONT AWESOME-->
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/5.15.3/css/all.min.css"
/>
</head>
<body>
<?php require 'partials/header.php' ?>
<body>
<div class="menu-btn">
<i class="fas fa-bars"></i>
</div>
<div class="container">
<nav class="nav-main">
<img src="img/log.jpg" class="nav-brand" />
<ul class="nav-menu show">
<li>
<a href="index.php">INICIO</a>
</li>
<li>
<a href="informacion.php">INFORMACIÓN</a>
</li>
<li>
<a href="nosotros.php">QUIÉNES SOMOS</a>
</li>
<li>
<a href="productos.php">PIZZAS</a>
</li>
<li>
<a href="carritoCompras.php">OTROS PRODUCTOS</a>
</li>
<li>
<a href="ubicacion.php">UBICACIÓN</a>
</li>
</ul>
<ul class="nav-menu-right">
<li>
<a href="administrador/index.php">
<i class="fas fa-key"></i>
</a>
</li>
</ul>
</nav>
<hr class="my-2">
<br>
<hr class="my-2">
<section class="social">
<p>REDES SOCIALES</p>
<div class="links">
<a href="https://www.facebook.com">
<i class="fab fa-facebook-f" style="color: blue;"></i>
</a>
<a href="https://www.instagram.com">
<i class="fab fa-instagram" style="color: magenta;"></i>
</a>
<a href="https://wa.me/593992611164">
<i class="fab fa-whatsapp" style="color: black;"></i>
</a>
</div>
</section>
</div>
<script src="main.js"></script>
<hr class="my-2">
<center>
HECHO POR Mateo
</center>
<br>
</body>
</html>
<?php include("template/cabecera.php");?>
<?php
session_start();
$total=0;
echo "<h3>Carrito de compras</h3>";
if(isset($_SESSION["carrito"])){
foreach($_SESSION["carrito"] as $indice =>$arreglo){
echo "<hr>Producto: <strong> ".$indice."</strong><br>";
$total += $arreglo["cant"]*$arreglo["precio"];
foreach($arreglo as $key =>$value){
echo $key.": ".$value."<br>";
}
echo "<a href='carrito.php?item=$indice' style='color: blue
'>Eliminar Item</a>";
}
echo "<h3>El total de la compra actual es de: $total </h3>";
echo '<br><br><a href="carritoCompras.php" style="color: blue;"
>Regresar a Otros poductos</a><br>o<br>
<a href="productos.php" style="color: blue;">Regresar a Piz
zas</a><br><br>
<a href="carrito.php?vaciar=true" style="color: blue;">Vaci
ar carrito</a>';
}else{
echo "<script>alert('El carrito esta vacio')</script>";
?>
<a href="carritoCompras.php" style="color: blue;">Regressar a Otros
productos</a><br>o <br>
<a href="productos.php" style="color: blue;">Regressar a Pizzas</a>
<?php
}
if(isset($_REQUEST["vaciar"])){
session_destroy();
header("Location: carrito.php");
}
if(isset($_REQUEST["item"])){
$producto =$_REQUEST["item"];
unset($_SESSION["carrito"][$producto]);
echo "<script>alert('Se elimino el producto: $producto');</scri
pt>";
header("Location: carrito.php");
}
?>
<?php include("template/pie.php");?>
<?php
session_start();
?>
<?php include("template/cabecera.php");?>
<div align="center">
<h3>CARRITO</h3>
<a href="carrito.php"><img src="img/carrito.png" width="50px"></a>
<hr>
<table class="table table-dark" style="width: 600px;">
<h3>PRODUCTOS DEL AÑO</h3>
<thead>
<th>ID</th>
<th>NOMBRE</th>
<th>PRODUCTO</th>
<th>PRECIO</th>
<th>DESCRIPCIÓN</th>
<th>ACCIONES</th>
</thead>
<tbody>
<tr style="width: 600px;">
<td style="width: 100px;" align="center">1020</td>
<td style="width: 300px;" align="center">Coca - Cola</td>
<td style="width: 100px;">
<img src="img/fanta.jfif" width="100px" height="100px">
</td>
<td style="width: 300px;" align="center">
$ 0.75
</td>
<td style="width: 300px;" align="center">
Cola-cola lite, sabor fanta
</td>
<td style="width: 300px;" align="center">
<form action="carritoCompras.php" method="POST">
<input type="hidden" name="txtProducto" value="Coca-
Cola">
<input type="number" name="cant" value="1" style="width
: 50px;"><br>
<input type="hidden" name="txtPrecio" value="0.75">
<input type="submit" value="Agregar" name="btnAgregar">
</form>
</td>
</tr>
<tr style="width: 600px;">
<td style="width: 100px;" align="center">1021</td>
<td style="width: 300px;" align="center">Chetos</td>
<td style="width: 100px;">
<img src="img/chetos.jfif" width="100px" height="100px">
</td>
<td style="width: 300px;" align="center">
$ 1.75
</td>
<td style="width: 300px;" align="center">
Chetos de queso, picantes
</td>
<td style="width: 300px;" align="center">
<form action="carritoCompras.php" method="POST">
<input type="hidden" name="txtProducto" value="Chetos">
<input type="number" name="cant" value="1" style="width
: 50px;"><br>
<input type="hidden" name="txtPrecio" value="1.75">
<input type="submit" value="Agregar" name="btnAgregar">
</form>
</td>
</tr>
<tr style="width: 600px;">
<td style="width: 100px;" align="center">1022</td>
<td style="width: 300px;" align="center">Agua</td>
<td style="width: 100px;">
<img src="img/agua.jfif" width="100px" height="100px">
</td>
<td style="width: 300px;" align="center">
$ 1.00
</td>
<td style="width: 300px;" align="center">
Agua natural, Al clima
</td>
<td style="width: 300px;" align="center">
<form action="carritoCompras.php" method="POST">
<input type="hidden" name="txtProducto" value="Aguan">
<input type="number" name="cant" value="1" style="width
: 50px;"><br>
<input type="hidden" name="txtPrecio" value="1.00">
<input type="submit" value="Agregar" name="btnAgregar">
</form>
</td>
<tr style="width: 600px;">
<td style="width: 100px;" align="center">1023</td>
<td style="width: 300px;" align="center">Platanitos</td>
<td style="width: 100px;">
<img src="img/platanitos.jfif" width="100px" height="100px"
>
</td>
<td style="width: 300px;" align="center">
$ 0.75
</td>
<td style="width: 300px;" align="center">
Platanitos de limon
</td>
<td style="width: 300px;" align="center">
<form action="carritoCompras.php" method="POST">
<input type="hidden" name="txtProducto" value="Platanit
os">
<input type="number" name="cant" value="1" style="width
: 50px;"><br>
<input type="hidden" name="txtPrecio" value="0.75">
<input type="submit" value="Agregar" name="btnAgregar">
</form>
</td>
</tr>
<tr style="width: 600px;">
<td style="width: 100px;" align="center">1024</td>
<td style="width: 300px;" align="center">Doritos</td>
<td style="width: 100px;">
<img src="img/doritos.jfif" width="100px" height="100px">
</td>
<td style="width: 300px;" align="center">
$ 1.35
</td>
<td style="width: 300px;" align="center">
Doritos
</td>
<td style="width: 300px;" align="center">
<form action="carritoCompras.php" method="POST">
<input type="hidden" name="txtProducto" value="Doritos"
>
<input type="number" name="cant" value="1" style="width
: 50px;"><br>
<input type="hidden" name="txtPrecio" value="1.35">
<input type="submit" value="Agregar" name="btnAgregar">
</form>
</td>
</tr>
</tr>
</tbody>
</table>
</div>
<?php
if(isset($_REQUEST["btnAgregar"])){
$producto = $_REQUEST["txtProducto"];
$cantidad = $_REQUEST["cant"];
$precio = $_REQUEST["txtPrecio"];
$_SESSION["carrito"][$producto]["cant"]= $cantidad;
$_SESSION["carrito"][$producto]["precio"]= $precio;
echo "<script>alert('Producto $producto agregado con éxito al c
arrito de compras');</script>";
}
?>
<?php include("template/pie.php"); ?>
f.) _______ _______ f.) __________________
MSc. Víctor Zapata
ESTUDIANTE DOCENTE

Más contenido relacionado

Similar a Examen (20)

Proyecto final
Proyecto finalProyecto final
Proyecto final
 
I2 u4
I2 u4I2 u4
I2 u4
 
Informe grupal f_arinango_ cuenca
Informe grupal f_arinango_ cuencaInforme grupal f_arinango_ cuenca
Informe grupal f_arinango_ cuenca
 
EXAMEN
EXAMENEXAMEN
EXAMEN
 
Anthony saravia documentacion-php
Anthony saravia documentacion-phpAnthony saravia documentacion-php
Anthony saravia documentacion-php
 
PROYECTO_PARTE_3.pdf
PROYECTO_PARTE_3.pdfPROYECTO_PARTE_3.pdf
PROYECTO_PARTE_3.pdf
 
Guiapractica de bd completa
Guiapractica de bd completaGuiapractica de bd completa
Guiapractica de bd completa
 
Inf 17 (chatbot)
Inf 17 (chatbot)Inf 17 (chatbot)
Inf 17 (chatbot)
 
Software de Búsqueda
Software de BúsquedaSoftware de Búsqueda
Software de Búsqueda
 
I3 u4
I3 u4I3 u4
I3 u4
 
I1 u4
I1 u4I1 u4
I1 u4
 
Tema3[php]
Tema3[php]Tema3[php]
Tema3[php]
 
Insertar Elemento de Contenido PHP en Typo3 6.0+ 6.2+
Insertar Elemento de Contenido PHP en Typo3 6.0+ 6.2+Insertar Elemento de Contenido PHP en Typo3 6.0+ 6.2+
Insertar Elemento de Contenido PHP en Typo3 6.0+ 6.2+
 
Jefferson cuenca practica_b#5
Jefferson cuenca practica_b#5Jefferson cuenca practica_b#5
Jefferson cuenca practica_b#5
 
Elemento 3
Elemento 3Elemento 3
Elemento 3
 
Base de datos 8
Base de datos 8Base de datos 8
Base de datos 8
 
Variables en lenguaje php
Variables en lenguaje phpVariables en lenguaje php
Variables en lenguaje php
 
Iniciando el front end
Iniciando el front endIniciando el front end
Iniciando el front end
 
Ejercicio denisse chacaguasay 3_c
Ejercicio denisse chacaguasay 3_cEjercicio denisse chacaguasay 3_c
Ejercicio denisse chacaguasay 3_c
 
Jacqueline nuñez pacco
Jacqueline nuñez paccoJacqueline nuñez pacco
Jacqueline nuñez pacco
 

Más de LENINMATEO1 (20)

Chatbot
ChatbotChatbot
Chatbot
 
Cheque
ChequeCheque
Cheque
 
Ejercicios basicos php lenin quishpe
Ejercicios basicos php lenin quishpeEjercicios basicos php lenin quishpe
Ejercicios basicos php lenin quishpe
 
Tabla de multiplicar con for y while
Tabla de multiplicar con for y whileTabla de multiplicar con for y while
Tabla de multiplicar con for y while
 
Tabla de multiplicar con for
Tabla de multiplicar con forTabla de multiplicar con for
Tabla de multiplicar con for
 
Tabla de multiplicar con while
Tabla de multiplicar con whileTabla de multiplicar con while
Tabla de multiplicar con while
 
Tarea con switch
Tarea con switchTarea con switch
Tarea con switch
 
Uso de variables en php
Uso de variables en phpUso de variables en php
Uso de variables en php
 
In 29
In 29In 29
In 29
 
In 28
In 28In 28
In 28
 
In 27
In 27In 27
In 27
 
In 26
In 26In 26
In 26
 
In 25
In 25In 25
In 25
 
In 24
In 24In 24
In 24
 
In 23
In 23In 23
In 23
 
In 22
In 22In 22
In 22
 
In 21
In 21In 21
In 21
 
In 20
In 20In 20
In 20
 
In 18
In 18In 18
In 18
 
In 19
In 19In 19
In 19
 

Último

Sesión de aprendizaje Planifica Textos argumentativo.docx
Sesión de aprendizaje Planifica Textos argumentativo.docxSesión de aprendizaje Planifica Textos argumentativo.docx
Sesión de aprendizaje Planifica Textos argumentativo.docxMaritzaRetamozoVera
 
Estrategias de enseñanza-aprendizaje virtual.pptx
Estrategias de enseñanza-aprendizaje virtual.pptxEstrategias de enseñanza-aprendizaje virtual.pptx
Estrategias de enseñanza-aprendizaje virtual.pptxdkmeza
 
ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...
ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...
ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...JAVIER SOLIS NOYOLA
 
BIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICA
BIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICABIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICA
BIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICAÁngel Encinas
 
Qué es la Inteligencia artificial generativa
Qué es la Inteligencia artificial generativaQué es la Inteligencia artificial generativa
Qué es la Inteligencia artificial generativaDecaunlz
 
ACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLA
ACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLAACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLA
ACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLAJAVIER SOLIS NOYOLA
 
Lecciones 05 Esc. Sabática. Fe contra todo pronóstico.
Lecciones 05 Esc. Sabática. Fe contra todo pronóstico.Lecciones 05 Esc. Sabática. Fe contra todo pronóstico.
Lecciones 05 Esc. Sabática. Fe contra todo pronóstico.Alejandrino Halire Ccahuana
 
ACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptx
ACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptxACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptx
ACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptxzulyvero07
 
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptxTIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptxlclcarmen
 
Imperialismo informal en Europa y el imperio
Imperialismo informal en Europa y el imperioImperialismo informal en Europa y el imperio
Imperialismo informal en Europa y el imperiomiralbaipiales2016
 
Valoración Crítica de EEEM Feco2023 FFUCV
Valoración Crítica de EEEM Feco2023 FFUCVValoración Crítica de EEEM Feco2023 FFUCV
Valoración Crítica de EEEM Feco2023 FFUCVGiustinoAdesso1
 
Programacion Anual Matemática4 MPG 2024 Ccesa007.pdf
Programacion Anual Matemática4    MPG 2024  Ccesa007.pdfProgramacion Anual Matemática4    MPG 2024  Ccesa007.pdf
Programacion Anual Matemática4 MPG 2024 Ccesa007.pdfDemetrio Ccesa Rayme
 
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURA
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURAFORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURA
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURAEl Fortí
 
INSTRUCCION PREPARATORIA DE TIRO .pptx
INSTRUCCION PREPARATORIA DE TIRO   .pptxINSTRUCCION PREPARATORIA DE TIRO   .pptx
INSTRUCCION PREPARATORIA DE TIRO .pptxdeimerhdz21
 
Ley 21.545 - Circular Nº 586.pdf circular
Ley 21.545 - Circular Nº 586.pdf circularLey 21.545 - Circular Nº 586.pdf circular
Ley 21.545 - Circular Nº 586.pdf circularMooPandrea
 
OCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VS
OCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VSOCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VS
OCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VSYadi Campos
 
actividades comprensión lectora para 3° grado
actividades comprensión lectora para 3° gradoactividades comprensión lectora para 3° grado
actividades comprensión lectora para 3° gradoJosDanielEstradaHern
 
proyecto de mayo inicial 5 añitos aprender es bueno para tu niño
proyecto de mayo inicial 5 añitos aprender es bueno para tu niñoproyecto de mayo inicial 5 añitos aprender es bueno para tu niño
proyecto de mayo inicial 5 añitos aprender es bueno para tu niñotapirjackluis
 
SEXTO SEGUNDO PERIODO EMPRENDIMIENTO.pptx
SEXTO SEGUNDO PERIODO EMPRENDIMIENTO.pptxSEXTO SEGUNDO PERIODO EMPRENDIMIENTO.pptx
SEXTO SEGUNDO PERIODO EMPRENDIMIENTO.pptxYadi Campos
 
Dinámica florecillas a María en el mes d
Dinámica florecillas a María en el mes dDinámica florecillas a María en el mes d
Dinámica florecillas a María en el mes dstEphaniiie
 

Último (20)

Sesión de aprendizaje Planifica Textos argumentativo.docx
Sesión de aprendizaje Planifica Textos argumentativo.docxSesión de aprendizaje Planifica Textos argumentativo.docx
Sesión de aprendizaje Planifica Textos argumentativo.docx
 
Estrategias de enseñanza-aprendizaje virtual.pptx
Estrategias de enseñanza-aprendizaje virtual.pptxEstrategias de enseñanza-aprendizaje virtual.pptx
Estrategias de enseñanza-aprendizaje virtual.pptx
 
ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...
ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...
ACERTIJO DE LA BANDERA OLÍMPICA CON ECUACIONES DE LA CIRCUNFERENCIA. Por JAVI...
 
BIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICA
BIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICABIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICA
BIOMETANO SÍ, PERO NO ASÍ. LA NUEVA BURBUJA ENERGÉTICA
 
Qué es la Inteligencia artificial generativa
Qué es la Inteligencia artificial generativaQué es la Inteligencia artificial generativa
Qué es la Inteligencia artificial generativa
 
ACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLA
ACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLAACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLA
ACERTIJO DE POSICIÓN DE CORREDORES EN LA OLIMPIADA. Por JAVIER SOLIS NOYOLA
 
Lecciones 05 Esc. Sabática. Fe contra todo pronóstico.
Lecciones 05 Esc. Sabática. Fe contra todo pronóstico.Lecciones 05 Esc. Sabática. Fe contra todo pronóstico.
Lecciones 05 Esc. Sabática. Fe contra todo pronóstico.
 
ACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptx
ACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptxACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptx
ACUERDO MINISTERIAL 078-ORGANISMOS ESCOLARES..pptx
 
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptxTIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
 
Imperialismo informal en Europa y el imperio
Imperialismo informal en Europa y el imperioImperialismo informal en Europa y el imperio
Imperialismo informal en Europa y el imperio
 
Valoración Crítica de EEEM Feco2023 FFUCV
Valoración Crítica de EEEM Feco2023 FFUCVValoración Crítica de EEEM Feco2023 FFUCV
Valoración Crítica de EEEM Feco2023 FFUCV
 
Programacion Anual Matemática4 MPG 2024 Ccesa007.pdf
Programacion Anual Matemática4    MPG 2024  Ccesa007.pdfProgramacion Anual Matemática4    MPG 2024  Ccesa007.pdf
Programacion Anual Matemática4 MPG 2024 Ccesa007.pdf
 
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURA
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURAFORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURA
FORTI-MAYO 2024.pdf.CIENCIA,EDUCACION,CULTURA
 
INSTRUCCION PREPARATORIA DE TIRO .pptx
INSTRUCCION PREPARATORIA DE TIRO   .pptxINSTRUCCION PREPARATORIA DE TIRO   .pptx
INSTRUCCION PREPARATORIA DE TIRO .pptx
 
Ley 21.545 - Circular Nº 586.pdf circular
Ley 21.545 - Circular Nº 586.pdf circularLey 21.545 - Circular Nº 586.pdf circular
Ley 21.545 - Circular Nº 586.pdf circular
 
OCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VS
OCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VSOCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VS
OCTAVO SEGUNDO PERIODO. EMPRENDIEMIENTO VS
 
actividades comprensión lectora para 3° grado
actividades comprensión lectora para 3° gradoactividades comprensión lectora para 3° grado
actividades comprensión lectora para 3° grado
 
proyecto de mayo inicial 5 añitos aprender es bueno para tu niño
proyecto de mayo inicial 5 añitos aprender es bueno para tu niñoproyecto de mayo inicial 5 añitos aprender es bueno para tu niño
proyecto de mayo inicial 5 añitos aprender es bueno para tu niño
 
SEXTO SEGUNDO PERIODO EMPRENDIMIENTO.pptx
SEXTO SEGUNDO PERIODO EMPRENDIMIENTO.pptxSEXTO SEGUNDO PERIODO EMPRENDIMIENTO.pptx
SEXTO SEGUNDO PERIODO EMPRENDIMIENTO.pptx
 
Dinámica florecillas a María en el mes d
Dinámica florecillas a María en el mes dDinámica florecillas a María en el mes d
Dinámica florecillas a María en el mes d
 

Examen

  • 1. UNIVERSIDAD CENTRAL DEL ECUADOR F FACULTAD DE FILOSOFÍA, LETRAS Y CIENCIAS DE LA EDUCACIÓN PEDAGOGÍA DE LAS CIENCIAS EXPERIMENTALES DE LA INFORMÁTICA PROGRAMACIÓN ORIENTADA A OBJETOS AUTOR: Mateo Quishpe PARALELO: 3 “C” DOCENTE: MSc. Víctor Zapata FECHA: 22 – 09 – 2021
  • 2. INFORME DEL EXAMEN TEMA: Examen OBJETIVO: Usar todo lo aprendido a lo largo del semestre en un programa alternativo RESULTADOS DE APRENDIZAJE Comprender todas las sentencias aprendidas Desarrollar un proyecto propio ACTIVIDADES: - Elaborar un programa alternativo - Pagina de compra de pizzas DESARROLLO DE CONTENIDOS
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12. CODIGO DEL PROGRAMA: <?php $host="localhost"; $bd= "proyectoe"; $usuario="root"; $contrasenia=""; try { $conexion=new PDO("mysql:host=$host;dbname=$bd", $usuario, $contras enia); } catch ( Exception $ex) {
  • 13. echo $ex->getMessage(); } ?> <?php session_start(); session_destroy(); header('Location: ../index.php'); ?> <?php $conex = mysqli_connect("localhost","root","","proyectoe"); ?> * { padding: 0; margin: 0; font-family: century gothic; color: #444 } h1 { padding: 12px; } div { padding: 10px 20px; } <?php $inc = include("con_db.php"); ?> <?php if ($inc) { $consulta = "SELECT * FROM productos"; $resultado = mysqli_query($conex,$consulta); if ($resultado) { $u=1; while ($row = $resultado->fetch_array()) { $id = $row['id']; $nombre = $row['nombre']; $imagen = $row['imagen']; $precio = $row['precio']; $descripcion = $row['descripcion'];
  • 14. ?> <div> <div> <p> <?php print 'Registro: '.$u;?> <b><br> ID: </b> <?php echo $id ?><br> <b>NOMBRE: </b> <?php echo $nombre ?><br> <b>IMAGEN: </b> <?php echo $imagen ?><br> <b>PRECIO: </b> <?php echo $precio ?><br> <b>DESCRIPCION: </b> <?php echo $descripcion ?><br > </p> </div> </div> <?php $u=$u+1; } } } ?> <?php include("../template/cabecera.php"); ?> <?php $txtID=(isset($_POST['txtID']))?$_POST['txtID']:""; $txtNombre=(isset($_POST['txtNombre']))?$_POST['txtNombre']:""; $txtImagen=(isset($_FILES['txtImagen']['name']))?$_FILES['txtImagen ']['name']:""; $txtPrecio=(isset($_POST['txtPrecio']))?$_POST['txtPrecio']:""; $txtDescripcion=(isset($_POST['txtDescripcion']))?$_POST['txtDescri pcion']:""; $accion=(isset($_POST['accion']))?$_POST['accion']:""; include("../config/bd.php"); switch($accion){ case "Agregar": $sentenciaSQL= $conexion- >prepare("INSERT INTO productos (nombre, imagen, precio, descripcion) V ALUES (:nombre,:imagen,:precio,:descripcion);"); $sentenciaSQL->bindParam(':nombre',$txtNombre); $fecha= new DateTime(); $nombreArchivo=($txtImagen!="")?$fecha- >getTimestamp()."_".$_FILES["txtImagen"]['name']:"imagen.jpg";
  • 15. $tmpImagen=$_FILES["txtImagen"]["tmp_name"]; if ($tmpImagen!="") { move_uploaded_file($tmpImagen,"../../img/".$nombreArchi vo); } $sentenciaSQL->bindParam(':imagen',$nombreArchivo); $sentenciaSQL->bindParam(':precio',$txtPrecio); $sentenciaSQL->bindParam(':descripcion',$txtDescripcion); $sentenciaSQL->execute(); break; case "Modificar": echo "Presionado botón Modificar"; $sentenciaSQL= $conexion- >prepare("UPDATE productos SET nombre=:nombre WHERE id=:id"); $sentenciaSQL->bindParam(':nombre',$txtNombre); $sentenciaSQL->bindParam(':id',$txtID); $sentenciaSQL->execute(); $sentenciaSQL= $conexion- >prepare("UPDATE productos SET precio=:precio WHERE id=:id"); $sentenciaSQL->bindParam(':precio',$txtPrecio); $sentenciaSQL->bindParam(':id',$txtID); $sentenciaSQL->execute(); $sentenciaSQL= $conexion- >prepare("UPDATE productos SET descripcion=:descripcion WHERE id=:id"); $sentenciaSQL->bindParam(':descripcion',$txtDescripcion); $sentenciaSQL->bindParam(':id',$txtID); $sentenciaSQL->execute(); if ($txtImagen!="") { $fecha= new DateTime(); $nombreArchivo=($txtImagen!="")?$fecha- >getTimestamp()."_".$_FILES["txtImagen"]['name']:"imagen.jpg"; $tmpImagen=$_FILES["txtImagen"]["tmp_name"]; move_uploaded_file($tmpImagen,"../../img/".$nombreArchi vo); $sentenciaSQL= $conexion- >prepare("SELECT imagen FROM productos WHERE id=:id"); $sentenciaSQL->bindParam(':id',$txtID); $sentenciaSQL->execute();
  • 16. $producto=$sentenciaSQL->fetch(PDO::FETCH_LAZY); if ( isset($producto["imagen"]) &&($producto["imagen"]!="im agen.jpg") ) { if (file_exists("../../img/".$producto["imagen"])) { unlink("../../img/".$producto["imagen"]); } } $sentenciaSQL= $conexion- >prepare("UPDATE productos SET imagen=:imagen WHERE id=:id"); $sentenciaSQL->bindParam(':imagen',$nombreArchivo); $sentenciaSQL->bindParam(':id',$txtID); $sentenciaSQL->execute(); } header("Location: productos.php"); break; case "Cancelar": header("Location: productos.php"); break; case "Seleccionar": //busqueda e impresion de datos"; $sentenciaSQL= $conexion- >prepare("SELECT * FROM productos WHERE id=:id"); $sentenciaSQL->bindParam(':id',$txtID); $sentenciaSQL->execute(); $producto=$sentenciaSQL->fetch(PDO::FETCH_LAZY); $txtNombre=$producto['nombre']; $txtImagen=$producto['imagen']; $txtPrecio=$producto['precio']; $txtDescripcion=$producto['descripcion']; break; case "Borrar": $sentenciaSQL= $conexion- >prepare("SELECT imagen FROM productos WHERE id=:id"); $sentenciaSQL->bindParam(':id',$txtID); $sentenciaSQL->execute(); $producto=$sentenciaSQL->fetch(PDO::FETCH_LAZY); if ( isset($producto["imagen"]) &&($producto["imagen"]!="im agen.jpg") ) { if (file_exists("../../img/".$producto["imagen"])) { unlink("../../img/".$producto["imagen"]); }
  • 17. } $sentenciaSQL= $conexion- >prepare("DELETE FROM productos WHERE id=:id"); $sentenciaSQL-> bindParam(':id', $txtID); $sentenciaSQL->execute(); header("Location: productos.php"); break; } $sentenciaSQL= $conexion->prepare("SELECT * FROM productos "); $sentenciaSQL->execute(); $listaproductos=$sentenciaSQL->fetchAll(PDO::FETCH_ASSOC); ?> <div class="col-md-5"> <div class="card"> <div class="card-header"> <center> <h4 style="color: red;">PRODUCTOS A INSERTAR </h4> </center> </div> <div class="card-body"> <form method="POST" enctype="multipart/form-data"> <div class = "form-group"> <label for="txtID">ID:</label> <input type="text" required readonly class="form- control" value="<?php echo $txtID; ?>" name="txtID" id="txtID" placehol der="ID"> </div> <div class = "form-group"> <label for="txtNombre">Nombre del producto:</label> <input type="text" required class="form- control" value="<?php echo $txtNombre; ?>" name="txtNombre" id="txtNomb re" placeholder="Nombre"> </div> <div class = "form-group"> <label for="txtNombre">Imagen del producto:</label> <br>
  • 18. <?php if ($txtImagen!="") { ?> <img class="img- thumbnail rounded" src="../../img/<?php echo $txtImagen; ?>" width="50" alt=""> <?php } ?> <input type="file" class="form- control" name="txtImagen" id="txtImagen" placeholder="Nombre"> </div> <div class = "form-group"> <label for="txtPrecio">Precio del producto:</label> <input type="text" required class="form- control" value="<?php echo $txtPrecio; ?>" name="txtPrecio" id="txtPrec io" > </div> <div class = "form-group"> <label for="txtDescripcion">Descripcion del product o:</label> <input type="text" required class="form- control" value="<?php echo $txtDescripcion; ?>" name="txtDescripcion" i d="txtDescripcion" placeholder="Descripcion"> </div> <div class="btn-group" role="group" aria-label=""> <button type="submit" name="accion" <?php echo ($ac cion == "Seleccionar")?"disabled":""; ?> value="Agregar" class="btn btn -success">Agregar</button> <button type="submit" name="accion" <?php echo ($ac cion != "Seleccionar")?"disabled":""; ?> value="Modificar" class="btn b tn-warning">Modificar</button> <button type="submit" name="accion" <?php echo ($ac cion != "Seleccionar")?"disabled":""; ?> value="Cancelar" class="btn bt n-info">Cancelar</button> </div> </form> </div> </div> </div> <div class="col-md-7">
  • 19. <table class="table table-bordered"> <thead> <tr> <th>ID</th> <th>Nombre de la pizza</th> <th>Imagen del producto</th> <th>Precio del producto</th> <th>Descripcion del producto</th> <th>Acciones a realizar</th> </tr> </thead> <tbody> <?php foreach($listaproductos as $producto){ ?> <tr> <td><?php echo $producto['id']; ?></td> <td><?php echo $producto['nombre']; ?></td> <td> <img class="img- thumbnail rounded" src="../../img/<?php echo $producto['imagen']; ?>" w idth="50" alt=""> </td> <td><?php echo $producto['precio']; ?></td> <td><?php echo $producto['descripcion']; ?></td> <td> <form method="POST"> <input type="hidden" name="txtID" id="txtID" va lue="<?php echo $producto['id']; ?>"> <input type="submit" name="accion" value="Selec cionar" class="btn btn-primary"/> <input type="submit" name="accion" value="Borra r" class="btn btn-danger"/> </form> </td> </tr> <?php } ?> </tbody> </table> </div> <?php include("../template/pie.php"); ?> <?php include("../template/cabecera.php"); ?> <head> <title>Registrar usuario</title> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="estilo.css"> </head>
  • 20. <body> <?php include("mostrar.php"); ?> </body> <?php include("../template/pie.php"); ?> <?php session_start(); if($_POST){ if(($_POST['usuario']=="Mateo")&&($_POST['contrasenia']=="45613")){ $_SESSION['usuario']="ok"; $_SESSION['nombreUsuario']="PIZZERIA"; header('Location: inicio.php'); }else { $mensaje="Error: El usuario o contraseña son incorrectos"; } } ?> <!doctype html> <html lang="en"> <head> <title>SESION-ADMIN</title> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial- scale=1, shrink-to-fit=no"> <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/boo tstrap/4.3.1/css/bootstrap.min.css" integrity="sha384- ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" cross origin="anonymous"> </head> <body background="../img/fondo11.jpg"> <div class="container"> <div class="row"> <div class="col-md-4"> </div> <div class="col-md-4"> <br><br><br> <div class="card"> <div class="card-header">
  • 21. <center> Login </center> </div> <div class="card-body"> <?php if (isset($mensaje)) { ?> <div class="alert alert-danger" role="alert"> <?php echo $mensaje; ?> </div> <?php } ?> <form method="POST"> <div class = "form-group"> <label>Usuario</label> <input type="text" class="form- control" name="usuario" placeholder="Escribe tu usuario"> </div> <div class="form-group"> <label>Contraseña:</label> <input type="password" class="form- control" name="contrasenia" placeholder="Escribe tu contraseña"> </div> <button type="submit" class="btn btn- primary">Entrar al administrdor</button> </form> </div> </div> </div> </div> </div> </body> </html> <?php include('template/cabecera.php');?> <div class="col-md-12">
  • 22. <div class="jumbotron"> <center> <h1 class="display- 3">BIENVENIDO <?php echo $nombreUsuario; ?> </h1> <p class="lead">Usted podra agregar, editar y borra r los productos que quiere mostrar en su pagina web</p> <hr class="my-2"> <img src="../img/img1.jfif" alt=""> </center> <p class="lead"> <center> <a class="btn btn-primary btn- lg" href="seccion/productos.php" role="button">Administrar productos</a > </center> </p> </div> </div> <?php include('template/pie.php');?> /* General */ body { margin: 0; padding: 0; font-family: 'Roboto', sans-serif; text-align: center; } /* Input Forms*/ input[type="text"], input[type="password"]{ outline: none; padding: 20px; display: block; width: 300px; border-radius: 3px; border: 1px solid #eee; margin: 20px auto; } input[type="submit"] { padding: 10px; color: #fff; background: #0098cb; width: 320px; margin: 20px auto; margin-top: 0; border: 0; border-radius: 3px;
  • 23. cursor: pointer; } input[type="submit"]:hover { background-color: #00b8eb; } /* Header */ header { border-bottom: 2px solid #eee; padding: 20px 0; margin-bottom: 10px; width: 100%; text-align: center; } header a { text-decoration: none; color: #333; } <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Welcome to you WebApp</title> <link href="https://fonts.googleapis.com/css?family=Roboto" rel="st ylesheet"> <link rel="stylesheet" href="assets/css/style.css"> </head> <body> <header> <a href="index.php"><font style="color:magenta;">PIZERIA MATEO</font> </a> </header> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial- scale=1.0" /> <title>Pizeria AC</title> <link rel="stylesheet" href="estillob.css"/> <!--FONT OSWALD--> <link rel="preconnect" href="https://fonts.gstatic.com" /> <!--FONT AWESOME--> <link rel="stylesheet"
  • 24. href="https://cdnjs.cloudflare.com/ajax/libs/font- awesome/5.15.3/css/all.min.css" /> </head> <body> <?php require 'partials/header.php' ?> <body> <div class="menu-btn"> <i class="fas fa-bars"></i> </div> <div class="container"> <nav class="nav-main"> <img src="img/log.jpg" class="nav-brand" /> <ul class="nav-menu show"> <li> <a href="index.php">INICIO</a> </li> <li> <a href="informacion.php">INFORMACIÓN</a> </li> <li> <a href="nosotros.php">QUIÉNES SOMOS</a> </li> <li> <a href="productos.php">PIZZAS</a> </li> <li> <a href="carritoCompras.php">OTROS PRODUCTOS</a> </li> <li> <a href="ubicacion.php">UBICACIÓN</a> </li> </ul> <ul class="nav-menu-right"> <li> <a href="administrador/index.php"> <i class="fas fa-key"></i> </a> </li> </ul> </nav> <hr class="my-2"> <br> <hr class="my-2"> <section class="social"> <p>REDES SOCIALES</p> <div class="links"> <a href="https://www.facebook.com">
  • 25. <i class="fab fa-facebook-f" style="color: blue;"></i> </a> <a href="https://www.instagram.com"> <i class="fab fa-instagram" style="color: magenta;"></i> </a> <a href="https://wa.me/593992611164"> <i class="fab fa-whatsapp" style="color: black;"></i> </a> </div> </section> </div> <script src="main.js"></script> <hr class="my-2"> <center> HECHO POR Mateo </center> <br> </body> </html> <?php include("template/cabecera.php");?> <?php session_start(); $total=0; echo "<h3>Carrito de compras</h3>"; if(isset($_SESSION["carrito"])){ foreach($_SESSION["carrito"] as $indice =>$arreglo){ echo "<hr>Producto: <strong> ".$indice."</strong><br>"; $total += $arreglo["cant"]*$arreglo["precio"]; foreach($arreglo as $key =>$value){ echo $key.": ".$value."<br>"; } echo "<a href='carrito.php?item=$indice' style='color: blue '>Eliminar Item</a>"; } echo "<h3>El total de la compra actual es de: $total </h3>"; echo '<br><br><a href="carritoCompras.php" style="color: blue;" >Regresar a Otros poductos</a><br>o<br> <a href="productos.php" style="color: blue;">Regresar a Piz zas</a><br><br> <a href="carrito.php?vaciar=true" style="color: blue;">Vaci ar carrito</a>'; }else{
  • 26. echo "<script>alert('El carrito esta vacio')</script>"; ?> <a href="carritoCompras.php" style="color: blue;">Regressar a Otros productos</a><br>o <br> <a href="productos.php" style="color: blue;">Regressar a Pizzas</a> <?php } if(isset($_REQUEST["vaciar"])){ session_destroy(); header("Location: carrito.php"); } if(isset($_REQUEST["item"])){ $producto =$_REQUEST["item"]; unset($_SESSION["carrito"][$producto]); echo "<script>alert('Se elimino el producto: $producto');</scri pt>"; header("Location: carrito.php"); } ?> <?php include("template/pie.php");?> <?php session_start(); ?> <?php include("template/cabecera.php");?> <div align="center"> <h3>CARRITO</h3> <a href="carrito.php"><img src="img/carrito.png" width="50px"></a> <hr> <table class="table table-dark" style="width: 600px;"> <h3>PRODUCTOS DEL AÑO</h3> <thead> <th>ID</th> <th>NOMBRE</th> <th>PRODUCTO</th> <th>PRECIO</th> <th>DESCRIPCIÓN</th> <th>ACCIONES</th> </thead> <tbody> <tr style="width: 600px;"> <td style="width: 100px;" align="center">1020</td> <td style="width: 300px;" align="center">Coca - Cola</td> <td style="width: 100px;">
  • 27. <img src="img/fanta.jfif" width="100px" height="100px"> </td> <td style="width: 300px;" align="center"> $ 0.75 </td> <td style="width: 300px;" align="center"> Cola-cola lite, sabor fanta </td> <td style="width: 300px;" align="center"> <form action="carritoCompras.php" method="POST"> <input type="hidden" name="txtProducto" value="Coca- Cola"> <input type="number" name="cant" value="1" style="width : 50px;"><br> <input type="hidden" name="txtPrecio" value="0.75"> <input type="submit" value="Agregar" name="btnAgregar"> </form> </td> </tr> <tr style="width: 600px;"> <td style="width: 100px;" align="center">1021</td> <td style="width: 300px;" align="center">Chetos</td> <td style="width: 100px;"> <img src="img/chetos.jfif" width="100px" height="100px"> </td> <td style="width: 300px;" align="center"> $ 1.75 </td> <td style="width: 300px;" align="center"> Chetos de queso, picantes </td> <td style="width: 300px;" align="center"> <form action="carritoCompras.php" method="POST"> <input type="hidden" name="txtProducto" value="Chetos"> <input type="number" name="cant" value="1" style="width : 50px;"><br> <input type="hidden" name="txtPrecio" value="1.75"> <input type="submit" value="Agregar" name="btnAgregar"> </form> </td> </tr> <tr style="width: 600px;"> <td style="width: 100px;" align="center">1022</td> <td style="width: 300px;" align="center">Agua</td> <td style="width: 100px;"> <img src="img/agua.jfif" width="100px" height="100px"> </td> <td style="width: 300px;" align="center"> $ 1.00
  • 28. </td> <td style="width: 300px;" align="center"> Agua natural, Al clima </td> <td style="width: 300px;" align="center"> <form action="carritoCompras.php" method="POST"> <input type="hidden" name="txtProducto" value="Aguan"> <input type="number" name="cant" value="1" style="width : 50px;"><br> <input type="hidden" name="txtPrecio" value="1.00"> <input type="submit" value="Agregar" name="btnAgregar"> </form> </td> <tr style="width: 600px;"> <td style="width: 100px;" align="center">1023</td> <td style="width: 300px;" align="center">Platanitos</td> <td style="width: 100px;"> <img src="img/platanitos.jfif" width="100px" height="100px" > </td> <td style="width: 300px;" align="center"> $ 0.75 </td> <td style="width: 300px;" align="center"> Platanitos de limon </td> <td style="width: 300px;" align="center"> <form action="carritoCompras.php" method="POST"> <input type="hidden" name="txtProducto" value="Platanit os"> <input type="number" name="cant" value="1" style="width : 50px;"><br> <input type="hidden" name="txtPrecio" value="0.75"> <input type="submit" value="Agregar" name="btnAgregar"> </form> </td> </tr> <tr style="width: 600px;"> <td style="width: 100px;" align="center">1024</td> <td style="width: 300px;" align="center">Doritos</td> <td style="width: 100px;"> <img src="img/doritos.jfif" width="100px" height="100px"> </td> <td style="width: 300px;" align="center"> $ 1.35 </td> <td style="width: 300px;" align="center"> Doritos </td>
  • 29. <td style="width: 300px;" align="center"> <form action="carritoCompras.php" method="POST"> <input type="hidden" name="txtProducto" value="Doritos" > <input type="number" name="cant" value="1" style="width : 50px;"><br> <input type="hidden" name="txtPrecio" value="1.35"> <input type="submit" value="Agregar" name="btnAgregar"> </form> </td> </tr> </tr> </tbody> </table> </div> <?php if(isset($_REQUEST["btnAgregar"])){ $producto = $_REQUEST["txtProducto"]; $cantidad = $_REQUEST["cant"]; $precio = $_REQUEST["txtPrecio"]; $_SESSION["carrito"][$producto]["cant"]= $cantidad; $_SESSION["carrito"][$producto]["precio"]= $precio; echo "<script>alert('Producto $producto agregado con éxito al c arrito de compras');</script>"; } ?> <?php include("template/pie.php"); ?>
  • 30. f.) _______ _______ f.) __________________ MSc. Víctor Zapata ESTUDIANTE DOCENTE