asi no funciona mi pana :-D
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menúdocument.querySelector(".categories").addEventListener("change", handleChangeCategory, true);
function handleChangeCategory() {
var selected = document.querySelector(".categories").value;
var request = new XmlHttpRequest();
// PHP
request.open("GET", "/ruta/al/script.php?"+selected, true);
// Java - Servlet
request.open("GET", "/TuServlet?"+selected, true);
// Java - REST
request.open("GET", "http://localhost:8080/api/products/"+selected, true);
request.onreadystatechange = function() {
if(request.readyState === 4 && request.status === 200) {
// renderizas los productos
render(request.responseText); // JSON
}
}
request.send();
}
<?php
session_start();
include('php_conexion.php');
$act="0";
include_once("php_conexion.php");
if(!empty($_GET['del'])){
$id=$_GET['del'];
mysql_query("DELETE FROM carrito WHERE codigo='$id'");
}
?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>Carrito de Compras</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->
<link href="css/bootstrap.css" rel="stylesheet">
<style type="text/css">
body {
padding-top: 60px;
padding-bottom: 40px;
}
</style>
<link href="css/bootstrap-responsive.css" rel="stylesheet">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="../assets/js/html5shiv.js"></script>
<![endif]-->
<!-- Fav and touch icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="ico/apple-touch-icon-57-precomposed.png">
<link rel="shortcut icon" href="ico/favicon.png">
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="#">Tienda Venezuela Computer</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class="active"><a href="index.php">Principal</a></li>
<li><a href="mis_pedidos.php">Mis Pedidos</a></li>
</ul>
</li>
<table width="200" border="2" align="right">
<tr>
<td bgcolor="#FFFFFF"><a href="#" target="_blank" class="dropdown-toggle" id="drop3" role="button" data-toggle="dropdown"><i class="icon-user"></i> Hola! <?php echo $_SESSION['username']; ?> <b class="caret"></b></td>
</tr>
</table>
</div><!--/.nav-collapse -->
</a>
</div>
</div>
</div>
<div class="container">
<!-- Main hero unit for a primary marketing message or call to action -->
<div class="hero-unit" align="center">
<table width="200" border="0">
<tr>
<th scope="col">Computacion </th>
<th scope="col">Relojeria </th>
<th scope="col">Seguridad CCTV </th>
<th scope="col">Calculadoras</th>
</tr>
</table>
</div>
<!-- Example row of columns -->
<div class="row">
</div>
<div align="center">
<div class="row-fluid">
<div class="span8">
<?php
$pa=mysql_query("SELECT * FROM producto where estado='s'");
while($row=mysql_fetch_array($pa)){
?>
<table class="table table-bordered">
<tr><td>
<div class="row-fluid">
<div class="span4">
<center><strong><?php echo $row['nombre']; ?></strong></center><br>
<img src="img/producto/<?php echo $row['codigo']; ?>.jpg" class="img-polaroid">
</div>
<div class="span4"><br><br><br><br>
<strong><?php echo $row['nota']; ?></strong><br><br>
<strong>Valor: </strong>$ <?php echo number_format($row['valor'],2,",","."); ?>
</div>
<div class="span4"><br><br><br><br><br>
<form name="form<?php $row['codigo']; ?>" method="post" action="">
<input type="hidden" name="codigo" value="<?php echo $row['codigo']; ?>">
<button type="submit" name="boton" class="btn btn-primary">
<i class="icon-shopping-cart"></i> <strong>Agregar</strong>
</button>
</form>
</div>
</div>
</td></tr>
</table>
<?php } ?>
</div>
<div class="span4">
<?php
if(!empty($_POST['codigo'])){
$codigo=$_POST['codigo'];
$pa=mysql_query("SELECT * FROM carrito WHERE codigo='$codigo'");
if($row=mysql_fetch_array($pa)){
$new_cant=$row['cantidad']+1;
mysql_query("UPDATE carrito SET cantidad='$new_cant' WHERE codigo='$codigo'");
}else{
mysql_query("INSERT INTO carrito (codigo, cantidad) VALUES ('$codigo','1')");
}
}
?>
<div id="sidebar"><br><br><br>
<h2 align="center">Mis Pedidos</h2>
<table class="table table-bordered">
<tr>
<td height="153">
<table class="table table-bordered table table-hover">
<?php
$neto=0;$tneto=0;
$pa=mysql_query("SELECT * FROM carrito");
while($row=mysql_fetch_array($pa)){
$oProducto=new Consultar_Producto($row['codigo']);
$neto=$oProducto->consultar('valor')*$row['cantidad'];
$tneto=$tneto+$neto;
?>
<tr style="font-size:9px">
<td><?php echo $oProducto->consultar('nombre'); ?></td>
<td><?php echo $row['cantidad']; ?></td>
<td>$ <?php echo number_format($neto,2,",","."); ?></td>
<td>
<a href="index.php?del=<?php echo $row['codigo']; ?>" title="Eliminar de la Lista">
<i class="icon-remove"></i>
</a>
</td>
</tr>
<?php }
?>
<td colspan="4" style="font-size:9px"><div align="right">$<?php echo number_format($tneto,2,",","."); ?></div></td>
<?php
$pa=mysql_query("SELECT * FROM carrito");
if(!$row=mysql_fetch_array($pa)){
?>
<tr><div class="alert alert-success" align="center"><strong>No hay Productos Registrados</strong></div></tr>
<?php } ?>
</table></td>
</tr>
</table>
</div>
</div>
</div>
</div>
<hr>
<footer>
<p>© Venezuela Computer 2014</p>
<p> </p>
</footer>
</div> <!-- /container -->
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="js/jquery.js"></script>
<script src="js/bootstrap-transition.js"></script>
<script src="js/bootstrap-alert.js"></script>
<script src="js/bootstrap-modal.js"></script>
<script src="js/bootstrap-dropdown.js"></script>
<script src="js/bootstrap-scrollspy.js"></script>
<script src="js/bootstrap-tab.js"></script>
<script src="js/bootstrap-tooltip.js"></script>
<script src="js/bootstrap-popover.js"></script>
<script src="js/bootstrap-button.js"></script>
<script src="js/bootstrap-collapse.js"></script>
<script src="js/bootstrap-carousel.js"></script>
<script src="js/bootstrap-typeahead.js"></script>
<script>
$(function() {
var offset = $("#sidebar").offset();
var topPadding = 15;
$(window).scroll(function() {
if ($("#sidebar").height() < $(window).height() && $(window).scrollTop() > offset.top) { /* LINEA MODIFICADA POR ALEX PARA NO ANIMAR SI EL SIDEBAR ES MAYOR AL TAMAÑO DE PANTALLA */
$("#sidebar").stop().animate({
marginTop: $(window).scrollTop() - offset.top + topPadding
});
} else {
$("#sidebar").stop().animate({
marginTop: 0
});
};
});
});
</script>
</body>
</html>
if($_SESSION['tipo_usu']=='a' or $_SESSION['tipo_usu']=='ca')
<?php
$act="1";
if(!empty($_POST['usuario']) and !empty($_POST['contra'])){
$usuario=trim($_POST['usuario']);
$contra=trim($_POST['contra']);
$can=mysql_query("SELECT * FROM usuarios WHERE (usu='".$usuario."' or ced='".$usuario."') and con='".$contra."'");
if($dato=mysql_fetch_array($can)){
$_SESSION['username']=$dato['usu'];
$_SESSION['tipo_usu']=$dato['tipo'];
$_SESSION["ced"] = $dato["ced"];
if($_SESSION['tipo_usu']=='a' or $_SESSION['tipo_usu']=='ca'){
header('location:index.php');
}
}else{
if($act=="1"){echo '<div class="alert alert-error" align="center">Usuario y Contraseña Incorrecta</div>';}else{$act="0";}
}
}else{
}
?>
<?php
if(!empty($_POST['codigo'])){
if(!empty($_POST['valor'])){
$codigo=$_POST['codigo'];
$valor=$_POST['valor'];
$pa=mysql_query("SELECT codigo, cantidad FROM carrito WHERE usu = '" . $_SESSION["username"] . "' AND codigo = '". $codigo . "'". "' AND valor = '". $valor . "'");
if($row=mysql_fetch_array($pa)){
$new_cant=$row['cantidad']+1;
mysql_query("UPDATE carrito SET cantidad = '" . $new_cant . "' WHERE usu = '" . $_SESSION["username"] . "' AND codigo = '" . $codigo . "'". "' AND valor = '" . $valor . "'");
}else{
mysql_query("INSERT INTO carrito (codigo, cantidad, usu, valor) VALUES('" . $valor . "','" . $codigo . "', '1', '" . $_SESSION["username"] . "'))");
}
}
}
?>