elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Rompecabezas de Bitcoin, Medio millón USD en premios


  Mostrar Mensajes
Páginas: 1 2 [3] 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ... 20
21  Programación / PHP / Disminuir inventario en php en: 30 Julio 2014, 14:57 pm
hola buen dia horario venezuela :-D

tengo una pequeña duda y no se como resolverla, como vengo diciendo desde hace tiempo aqui estoy armando un carrito de compras a mi propio estilo el cual ando puliendo mi problema es el siguiente:

tengo un row que me indica cuantas piezas me quedan de x producto, lo que quiero hacer es que cuando x usuario entre al carrito de compras y le de click a agregar a carrito se elimine una pieza del producto escogido alguien me podria dar un apoyo por favor.
22  Programación / PHP / Re: ayuda no me guarda los datos en: 30 Julio 2014, 14:30 pm
Código
  1. mysql_query("INSERT INTO `servicio`(Vendedor,Semana,QuienPago,Proveedor,Fecha,Control,Adelanto,Cotizacion,Año,Tipo,Cliente,Descripcion,Factura,MontoTotal,MontoTotal2,Factura2)
  2. VALUES ('$Vendedor','$Semana','$QuienPago','$Proveedor''$Fecha','$Control','$Adelanto','$Cotizacion','$Año','$Tipo','$Cliente','$Descripcion','$Factura','$MontoTotal','$MontoTotal2','$Factura2')");

amigo me manda error `servicio` quitales las comillas que apartes creo que estan mal
23  Programación / PHP / Re: ocultar botones en php en: 29 Julio 2014, 23:21 pm
disculpa quise decir en la misma pagina error de dedo
24  Programación / PHP / Re: mostrar datos en: 29 Julio 2014, 15:56 pm
listo ya lo hice por si alguien le interesa se coloca asi

Código
  1. <div class="span4"><br><br><br><br>
  2.                            <strong>Existencia: </strong> <?php echo number_format($row['existencia']); ?>
  3.                        </div>

25  Programación / PHP / mostrar datos en: 29 Julio 2014, 15:21 pm
hola buenos dias horario venezuela, estoy modificando mi carrito de compras que tengo en php y quiero agregar una linea en mi base de datos que me diga existencia, la cual ire cargando con los productos que me quedan, bien el problema o la duda seria como mostrarlo lo puedo hacer mediante un echo,

Código
  1. <?php
  2. include('php_conexion.php');
  3. $act="0";
  4. include_once("php_conexion.php");
  5. if(!empty($_GET['del'])){
  6. $id=$_GET['del'];
  7. mysql_query("DELETE FROM carrito WHERE codigo='$id'");
  8.    }
  9. ?>
  10.  
  11. <!DOCTYPE html>
  12. <html lang="es">
  13.  <head>
  14.    <meta charset="utf-8">
  15.    <title>Carrito de Compras</title>
  16.    <meta name="viewport" content="width=device-width, initial-scale=1.0">
  17.    <meta name="description" content="">
  18.    <meta name="author" content="">
  19.  
  20.    <!-- Le styles -->
  21.    <link href="css/bootstrap.css" rel="stylesheet">
  22.    <style type="text/css">
  23.      body {
  24.        padding-top: 60px;
  25.        padding-bottom: 40px;
  26.      }
  27.    </style>
  28.    <link href="css/bootstrap-responsive.css" rel="stylesheet">
  29.  
  30.    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
  31.    <!--[if lt IE 9]>
  32.      <script src="../assets/js/html5shiv.js"></script>
  33.    <![endif]-->
  34.  
  35.    <!-- Fav and touch icons -->
  36.  
  37.    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png">
  38.    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png">
  39.      <link rel="apple-touch-icon-precomposed" sizes="72x72" href="ico/apple-touch-icon-72-precomposed.png">
  40.                    <link rel="apple-touch-icon-precomposed" href="ico/apple-touch-icon-57-precomposed.png">
  41.                                   <link rel="shortcut icon" href="ico/favicon.png">
  42.  </head>
  43.  
  44.  <body>
  45.  
  46.    <div class="navbar navbar-inverse navbar-fixed-top">
  47.      <div class="navbar-inner">
  48.        <div class="container">
  49.          <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
  50.            <span class="icon-bar"></span>
  51.            <span class="icon-bar"></span>
  52.            <span class="icon-bar"></span>
  53.          </button>
  54.          <a class="brand" href="#">Tienda Venezuela Computer</a>
  55.          <div class="nav-collapse collapse">
  56.            <ul class="nav">
  57.              <li class="active"><a href="index.php">Principal</a></li>
  58.              <li><a href="mis_pedidos.php">Mis Pedidos</a></li>
  59.            </ul>
  60.  
  61.            </li>
  62.            <table width="200" border="2" align="right">
  63.              <tr>
  64.                <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>
  65.              </tr>
  66.            </table>
  67.          </div><!--/.nav-collapse -->
  68.          </a>
  69.        </div>
  70.      </div>
  71.    </div>
  72.  
  73.    <div class="container">
  74.  
  75.      <!-- Main hero unit for a primary marketing message or call to action -->
  76.      <div class="hero-unit" align="center">
  77.         <p><img src="file:///C|/Users/Secretaria/Desktop/Nueva carpeta/images/slogan-bg.jpg" class="img-polaroid"></p>
  78.  
  79.      </div>
  80.  
  81.      <!-- Example row of columns -->
  82.      <div class="row">
  83.  
  84.      </div>
  85.      <div align="center">
  86.  
  87.        <div class="row-fluid">
  88.     <div class="span8">
  89. <?php
  90.                $pa=mysql_query("SELECT * FROM producto where estado='s'");
  91.                while($row=mysql_fetch_array($pa)){
  92.            ?>                      
  93.         <table class="table table-bordered">
  94.             <tr><td>
  95.                 <div class="row-fluid">
  96.                     <div class="span4">
  97.                            <center><strong><?php echo $row['nombre']; ?></strong></center><br>
  98.                            <img src="img/producto/<?php echo $row['codigo']; ?>.jpg" class="img-polaroid">
  99.                        </div>
  100.                        <div class="span4"><br><br><br><br>
  101.                            <strong><?php echo $row['nota']; ?></strong><br><br>
  102.                            <strong>Valor: </strong>$ <?php echo number_format($row['valor'],2,",","."); ?>
  103.  
  104. LO QUERIA HACER AQUI MAS O MENOS ABAJO DE EL VALOR
  105. <strong>Existencia: </strong>$ <?php echo existencia($row['exis']; ?>
  106.  
  107.                        </div>
  108.                        <div class="span4"><br><br><br><br><br>
  109.                         <form name="form<?php $row['codigo']; ?>" method="post" action="">
  110.                             <input type="hidden" name="codigo" value="<?php echo $row['codigo']; ?>">
  111.                                <button type="submit" name="boton" class="btn btn-primary">
  112.                                    <i class="icon-shopping-cart"></i> <strong>Agregar al Carrito</strong>
  113.                                </button>
  114.                            </form>
  115.                        </div>
  116.                    </div>
  117.             </td></tr>
  118.         </table>
  119.         <?php } ?>
  120.         </div>
  121.            <div class="span4">
  122.            <?php
  123. if(!empty($_POST['codigo'])){
  124. $codigo=$_POST['codigo'];
  125. $pa=mysql_query("SELECT * FROM carrito WHERE codigo='$codigo'");
  126. if($row=mysql_fetch_array($pa)){
  127. $new_cant=$row['cantidad']+1;
  128. mysql_query("UPDATE carrito SET cantidad='$new_cant' WHERE codigo='$codigo'");
  129. }else{
  130. mysql_query("INSERT INTO carrito (codigo, cantidad) VALUES ('$codigo','1')");
  131. }
  132. }
  133. ?>
  134.               <div id="sidebar"><br><br><br>
  135.               <h2 align="center">Mis Pedidos</h2>
  136.               <table class="table table-bordered">
  137.                      <tr>
  138.                        <td height="153">
  139.                         <table class="table table-bordered table table-hover">
  140.                            <?php
  141. $neto=0;$tneto=0;
  142. $pa=mysql_query("SELECT * FROM carrito");
  143. while($row=mysql_fetch_array($pa)){
  144. $oProducto=new Consultar_Producto($row['codigo']);
  145. $neto=$oProducto->consultar('valor')*$row['cantidad'];
  146. $tneto=$tneto+$neto;
  147.  
  148. ?>
  149.                              <tr style="font-size:9px">
  150.                                <td><?php echo $oProducto->consultar('nombre'); ?></td>
  151.                                <td><?php echo $row['cantidad']; ?></td>
  152.                                <td>$ <?php echo number_format($neto,2,",","."); ?></td>
  153.                                <td>
  154.                                 <a href="index.php?del=<?php echo $row['codigo']; ?>" title="Eliminar de la Lista">
  155.                                 <i class="icon-remove"></i>
  156.                                    </a>
  157.                                </td>
  158.                              </tr>
  159.                            <?php }
  160. ?>
  161.                             <td colspan="4" style="font-size:9px"><div align="right">$<?php echo number_format($tneto,2,",","."); ?></div></td>
  162.                            <?php
  163. $pa=mysql_query("SELECT * FROM carrito");
  164. if(!$row=mysql_fetch_array($pa)){
  165. ?>
  166.                              <tr><div class="alert alert-success" align="center"><strong>No hay Productos Registrados</strong></div></tr>
  167.  <?php } ?>
  168.                            </table></td>
  169.                      </tr>
  170.                    </table>
  171.                </div>
  172.            </div>
  173.     </div>
  174.  
  175.      </div>
  176.  
  177.      <hr>
  178.  
  179.      <footer>
  180.        <p>&copy; Venezuela Computer 2014</p>
  181.        <p>&nbsp;</p>
  182.  
  183.      </footer>
  184.  
  185.    </div> <!-- /container -->
  186.  
  187.    <!-- Le javascript
  188.    ================================================== -->
  189.    <!-- Placed at the end of the document so the pages load faster -->
  190.    <script src="js/jquery.js"></script>
  191.    <script src="js/bootstrap-transition.js"></script>
  192.    <script src="js/bootstrap-alert.js"></script>
  193.    <script src="js/bootstrap-modal.js"></script>
  194.    <script src="js/bootstrap-dropdown.js"></script>
  195.    <script src="js/bootstrap-scrollspy.js"></script>
  196.    <script src="js/bootstrap-tab.js"></script>
  197.    <script src="js/bootstrap-tooltip.js"></script>
  198.    <script src="js/bootstrap-popover.js"></script>
  199.    <script src="js/bootstrap-button.js"></script>
  200.    <script src="js/bootstrap-collapse.js"></script>
  201.    <script src="js/bootstrap-carousel.js"></script>
  202.    <script src="js/bootstrap-typeahead.js"></script>
  203.    <script>
  204. $(function() {
  205.            var offset = $("#sidebar").offset();
  206.            var topPadding = 15;
  207.            $(window).scroll(function() {
  208.                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 */
  209.                    $("#sidebar").stop().animate({
  210.                        marginTop: $(window).scrollTop() - offset.top + topPadding
  211.                    });
  212.                } else {
  213.                    $("#sidebar").stop().animate({
  214.                        marginTop: 0
  215.                    });
  216.                };
  217.            });
  218.        });
  219. </script>
  220.  
  221.  </body>
  222. </html>
  223.  
26  Programación / PHP / Re: ocultar botones en php en: 29 Julio 2014, 15:02 pm
hola disculpen la tardanza en responder es que andaba en otras cosas que va no me sirvio eso no me deja en la misma pagina
27  Programación / PHP / Re: ocultar botones en php en: 22 Julio 2014, 20:08 pm
no se queda en el mismo sitio de pedir usuario y clave :-(

te lo puse hayi para que veas que el index no tiene redireccion
28  Programación / PHP / Re: ocultar botones en php en: 22 Julio 2014, 19:14 pm
inde.php

Código
  1. <?php
  2. include('php_conexion.php');
  3. $act="0";
  4. include_once("php_conexion.php");
  5. if(!empty($_GET['del'])){
  6. $id=$_GET['del'];
  7. mysql_query("DELETE FROM carrito WHERE codigo='$id'");
  8.    }
  9. ?>
  10.  
  11. <!DOCTYPE html>
  12. <html lang="es">
  13.  <head>
  14.    <meta charset="utf-8">
  15.    <title>Carrito de Compras</title>
  16.    <meta name="viewport" content="width=device-width, initial-scale=1.0">
  17.    <meta name="description" content="">
  18.    <meta name="author" content="">
  19.  
  20.    <!-- Le styles -->
  21.    <link href="css/bootstrap.css" rel="stylesheet">
  22.    <style type="text/css">
  23.      body {
  24.        padding-top: 60px;
  25.        padding-bottom: 40px;
  26.      }
  27.    </style>
  28.    <link href="css/bootstrap-responsive.css" rel="stylesheet">
  29.  
  30.    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
  31.    <!--[if lt IE 9]>
  32.      <script src="../assets/js/html5shiv.js"></script>
  33.    <![endif]-->
  34.  
  35.    <!-- Fav and touch icons -->
  36.  
  37.    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png">
  38.    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png">
  39.      <link rel="apple-touch-icon-precomposed" sizes="72x72" href="ico/apple-touch-icon-72-precomposed.png">
  40.                    <link rel="apple-touch-icon-precomposed" href="ico/apple-touch-icon-57-precomposed.png">
  41.                                   <link rel="shortcut icon" href="ico/favicon.png">
  42.  </head>
  43.  
  44.  <body>
  45.  
  46.    <div class="navbar navbar-inverse navbar-fixed-top">
  47.      <div class="navbar-inner">
  48.        <div class="container">
  49.          <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
  50.            <span class="icon-bar"></span>
  51.            <span class="icon-bar"></span>
  52.            <span class="icon-bar"></span>
  53.          </button>
  54.          <a class="brand" href="#">Tienda Venezuela Computer</a>
  55.          <div class="nav-collapse collapse">
  56.            <ul class="nav">
  57.              <li class="active"><a href="index.php">Principal</a></li>
  58.              <li><a href="mis_pedidos.php">Mis Pedidos</a></li>
  59.            </ul>
  60.  
  61.            </li>
  62.            <table width="200" border="2" align="right">
  63.              <tr>
  64.                <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>
  65.              </tr>
  66.            </table>
  67.          </div><!--/.nav-collapse -->
  68.          </a>
  69.        </div>
  70.      </div>
  71.    </div>
  72.  
  73.    <div class="container">
  74.  
  75.      <!-- Main hero unit for a primary marketing message or call to action -->
  76.      <div class="hero-unit" align="center">
  77.         <p><img src="file:///C|/Users/Secretaria/Desktop/Nueva carpeta/images/slogan-bg.jpg" class="img-polaroid"></p>
  78.  
  79.      </div>
  80.  
  81.      <!-- Example row of columns -->
  82.      <div class="row">
  83.  
  84.      </div>
  85.      <div align="center">
  86.  
  87.        <div class="row-fluid">
  88.     <div class="span8">
  89. <?php
  90.                $pa=mysql_query("SELECT * FROM producto where estado='s'");
  91.                while($row=mysql_fetch_array($pa)){
  92.            ?>                      
  93.         <table class="table table-bordered">
  94.             <tr><td>
  95.                 <div class="row-fluid">
  96.                     <div class="span4">
  97.                            <center><strong><?php echo $row['nombre']; ?></strong></center><br>
  98.                            <img src="img/producto/<?php echo $row['codigo']; ?>.jpg" class="img-polaroid">
  99.                        </div>
  100.                        <div class="span4"><br><br><br><br>
  101.                            <strong><?php echo $row['nota']; ?></strong><br><br>
  102.                            <strong>Valor: </strong>$ <?php echo number_format($row['valor'],2,",","."); ?>
  103.                        </div>
  104.                        <div class="span4"><br><br><br><br><br>
  105.                         <form name="form<?php $row['codigo']; ?>" method="post" action="">
  106.                             <input type="hidden" name="codigo" value="<?php echo $row['codigo']; ?>">
  107.                                <button type="submit" name="boton" class="btn btn-primary">
  108.                                    <i class="icon-shopping-cart"></i> <strong>Agregar al Carrito</strong>
  109.                                </button>
  110.                            </form>
  111.                        </div>
  112.                    </div>
  113.             </td></tr>
  114.         </table>
  115.         <?php } ?>
  116.         </div>
  117.            <div class="span4">
  118.            <?php
  119. if(!empty($_POST['codigo'])){
  120. $codigo=$_POST['codigo'];
  121. $pa=mysql_query("SELECT * FROM carrito WHERE codigo='$codigo'");
  122. if($row=mysql_fetch_array($pa)){
  123. $new_cant=$row['cantidad']+1;
  124. mysql_query("UPDATE carrito SET cantidad='$new_cant' WHERE codigo='$codigo'");
  125. }else{
  126. mysql_query("INSERT INTO carrito (codigo, cantidad) VALUES ('$codigo','1')");
  127. }
  128. }
  129. ?>
  130.               <div id="sidebar"><br><br><br>
  131.               <h2 align="center">Mis Pedidos</h2>
  132.               <table class="table table-bordered">
  133.                      <tr>
  134.                        <td height="153">
  135.                         <table class="table table-bordered table table-hover">
  136.                            <?php
  137. $neto=0;$tneto=0;
  138. $pa=mysql_query("SELECT * FROM carrito");
  139. while($row=mysql_fetch_array($pa)){
  140. $oProducto=new Consultar_Producto($row['codigo']);
  141. $neto=$oProducto->consultar('valor')*$row['cantidad'];
  142. $tneto=$tneto+$neto;
  143.  
  144. ?>
  145.                              <tr style="font-size:9px">
  146.                                <td><?php echo $oProducto->consultar('nombre'); ?></td>
  147.                                <td><?php echo $row['cantidad']; ?></td>
  148.                                <td>$ <?php echo number_format($neto,2,",","."); ?></td>
  149.                                <td>
  150.                                 <a href="index.php?del=<?php echo $row['codigo']; ?>" title="Eliminar de la Lista">
  151.                                 <i class="icon-remove"></i>
  152.                                    </a>
  153.                                </td>
  154.                              </tr>
  155.                            <?php }
  156. ?>
  157.                             <td colspan="4" style="font-size:9px"><div align="right">$<?php echo number_format($tneto,2,",","."); ?></div></td>
  158.                            <?php
  159. $pa=mysql_query("SELECT * FROM carrito");
  160. if(!$row=mysql_fetch_array($pa)){
  161. ?>
  162.                              <tr><div class="alert alert-success" align="center"><strong>No hay Productos Registrados</strong></div></tr>
  163.  <?php } ?>
  164.                            </table></td>
  165.                      </tr>
  166.                    </table>
  167.                </div>
  168.            </div>
  169.     </div>
  170.  
  171.      </div>
  172.  
  173.      <hr>
  174.  
  175.      <footer>
  176.        <p>&copy; Venezuela Computer 2014</p>
  177.        <p>&nbsp;</p>
  178.  
  179.      </footer>
  180.  
  181.    </div> <!-- /container -->
  182.  
  183.    <!-- Le javascript
  184.    ================================================== -->
  185.    <!-- Placed at the end of the document so the pages load faster -->
  186.    <script src="js/jquery.js"></script>
  187.    <script src="js/bootstrap-transition.js"></script>
  188.    <script src="js/bootstrap-alert.js"></script>
  189.    <script src="js/bootstrap-modal.js"></script>
  190.    <script src="js/bootstrap-dropdown.js"></script>
  191.    <script src="js/bootstrap-scrollspy.js"></script>
  192.    <script src="js/bootstrap-tab.js"></script>
  193.    <script src="js/bootstrap-tooltip.js"></script>
  194.    <script src="js/bootstrap-popover.js"></script>
  195.    <script src="js/bootstrap-button.js"></script>
  196.    <script src="js/bootstrap-collapse.js"></script>
  197.    <script src="js/bootstrap-carousel.js"></script>
  198.    <script src="js/bootstrap-typeahead.js"></script>
  199.    <script>
  200. $(function() {
  201.            var offset = $("#sidebar").offset();
  202.            var topPadding = 15;
  203.            $(window).scroll(function() {
  204.                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 */
  205.                    $("#sidebar").stop().animate({
  206.                        marginTop: $(window).scrollTop() - offset.top + topPadding
  207.                    });
  208.                } else {
  209.                    $("#sidebar").stop().animate({
  210.                        marginTop: 0
  211.                    });
  212.                };
  213.            });
  214.        });
  215. </script>
  216.  
  217.  </body>
  218. </html>
  219.  



index1.php

Código
  1. <?php
  2. include('php_conexion.php');
  3. $act="0";
  4. ?>
  5. <!DOCTYPE html>
  6. <html lang="en">
  7.  <head>
  8.    <meta charset="utf-8">
  9.    <title>Entrar</title>
  10.    <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11.    <meta name="description" content="">
  12.    <meta name="author" content="">
  13.  
  14.    <!-- Le styles -->
  15.    <link href="css/bootstrap.css" rel="stylesheet">
  16.    <style type="text/css">
  17.      body {
  18. padding-top: 40px;
  19. padding-bottom: 40px;
  20. background-color: #f5f5f5;
  21. background-image: url(img/fondoP.png);
  22.      }
  23.  
  24.      .form-signin {
  25.        max-width: 300px;
  26.        padding: 19px 29px 29px;
  27.        margin: 0 auto 20px;
  28.        background-color: #fff;
  29.        border: 1px solid #e5e5e5;
  30.        -webkit-border-radius: 5px;
  31.           -moz-border-radius: 5px;
  32.                border-radius: 5px;
  33.        -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
  34.           -moz-box-shadow: 0 1px 2px rgba(0,0,0,.05);
  35.                box-shadow: 0 1px 2px rgba(0,0,0,.05);
  36.      }
  37.      .form-signin .form-signin-heading,
  38.      .form-signin .checkbox {
  39.        margin-bottom: 10px;
  40.      }
  41.      .form-signin input[type="text"],
  42.      .form-signin input[type="password"] {
  43.        font-size: 16px;
  44.        height: auto;
  45.        margin-bottom: 15px;
  46.        padding: 7px 9px;
  47.      }
  48.  
  49.    </style>
  50.    <link href="css/bootstrap-responsive.css" rel="stylesheet">
  51.  
  52.    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
  53.    <!--[if lt IE 9]>
  54.      <script src="../assets/js/html5shiv.js"></script>
  55.    <![endif]-->
  56.  
  57.    <!-- Fav and touch icons -->
  58.    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png">
  59.    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png">
  60.    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="ico/apple-touch-icon-72-precomposed.png">
  61.    <link rel="apple-touch-icon-precomposed" href="ico/apple-touch-icon-57-precomposed.png">
  62.    <link rel="shortcut icon" href="ico/favicon.png">
  63.  </head>
  64.  
  65.  <body>
  66.  
  67.    <div class="container">
  68.      <form name="form1" method="post" action="" class="form-signin">
  69.        <h2 class="form-signin-heading">
  70.        <?php
  71. $act="1";
  72. $changeLocation = true;
  73. if(isset($_POST['usuario']) || isset($_POST['contra'])){
  74. if(!empty($_POST['usuario']) and !empty($_POST['contra'])){
  75. $usuario=trim($_POST['usuario']);
  76. $contra=trim($_POST['contra']);
  77. $can=mysql_query("SELECT * FROM usuarios WHERE (usu='".$usuario."' or ced='".$usuario."') and con='".$contra."'");
  78. if($dato=mysql_fetch_array($can)){
  79. $_SESSION['username']=$dato['usu'];
  80. $_SESSION['tipo_usu']=$dato['tipo'];
  81. }else{
  82. $changeLocation = false;
  83. if($act=="1"){echo '<div class="alert alert-error" align="center">Usuario y Contraseña Incorrecta</div>';}else{$act="0";}
  84. }
  85. }
  86. if($changeLocation) { header('location:index.php'); die();}
  87. }
  88. ?>
  89.        Bienvenid@s</h2>
  90.        <input type="text" name="usuario" class="input-block-level" placeholder="Usuario">
  91.        <input type="password" name="contra" class="input-block-level" placeholder="Contraseña">
  92.        <button class="btn btn-large btn-primary" type="submit">Iniciar</button>
  93.        <p>&nbsp;</p>
  94.      </form>
  95.    </div> <!-- /container -->
  96.  
  97.    <!-- Le javascript
  98.    ================================================== -->
  99.    <!-- Placed at the end of the document so the pages load faster -->
  100.    <script src="js\jquery.js"></script>
  101.    <script src="js\bootstrap-transition.js"></script>
  102.    <script src="js\bootstrap-alert.js"></script>
  103.    <script src="js\bootstrap-modal.js"></script>
  104.    <script src="js\bootstrap-dropdown.js"></script>
  105.    <script src="js\bootstrap-scrollspy.js"></script>
  106.    <script src="js\bootstrap-tab.js"></script>
  107.    <script src="js\bootstrap-tooltip.js"></script>
  108.    <script src="js\bootstrap-popover.js"></script>
  109.    <script src="js\bootstrap-button.js"></script>
  110.    <script src="js\bootstrap-collapse.js"></script>
  111.    <script src="js\bootstrap-carousel.js"></script>
  112.    <script src="js\bootstrap-typeahead.js"></script>
  113.  
  114.  </body>
  115. </html>
  116.  
29  Programación / PHP / Re: ocultar botones en php en: 22 Julio 2014, 17:52 pm
nah igual me deja en la pagina de ingresar el campo usuario y contraseña
30  Programación / PHP / Re: ocultar botones en php en: 22 Julio 2014, 17:04 pm
una pregunta que la hago aqui mismo, yo puedo hacer que cuando el usuario entre sin llenar los campos de usuario y contraseña pase a la pagina del carrito de compras???

es decir tengo la pagina index1.php la cual tiene un formulario de llanar nombre de usuario y contraseña la cual si son correctos los redirije a la pagina index.php la cual es un carrito de compras bien ya me explique esto

es posible que si el usuario no esta registrado igual lo lleve a la pagina index.php??

Código
  1. <?php
  2. include('php_conexion.php');
  3. $act="0";
  4. ?>
  5. <!DOCTYPE html>
  6. <html lang="en">
  7.  <head>
  8.    <meta charset="utf-8">
  9.    <title>Entrar</title>
  10.    <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11.    <meta name="description" content="">
  12.    <meta name="author" content="">
  13.  
  14.    <!-- Le styles -->
  15.    <link href="css/bootstrap.css" rel="stylesheet">
  16.    <style type="text/css">
  17.      body {
  18. padding-top: 40px;
  19. padding-bottom: 40px;
  20. background-color: #f5f5f5;
  21. background-image: url(img/fondoP.png);
  22.      }
  23.  
  24.      .form-signin {
  25.        max-width: 300px;
  26.        padding: 19px 29px 29px;
  27.        margin: 0 auto 20px;
  28.        background-color: #fff;
  29.        border: 1px solid #e5e5e5;
  30.        -webkit-border-radius: 5px;
  31.           -moz-border-radius: 5px;
  32.                border-radius: 5px;
  33.        -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
  34.           -moz-box-shadow: 0 1px 2px rgba(0,0,0,.05);
  35.                box-shadow: 0 1px 2px rgba(0,0,0,.05);
  36.      }
  37.      .form-signin .form-signin-heading,
  38.      .form-signin .checkbox {
  39.        margin-bottom: 10px;
  40.      }
  41.      .form-signin input[type="text"],
  42.      .form-signin input[type="password"] {
  43.        font-size: 16px;
  44.        height: auto;
  45.        margin-bottom: 15px;
  46.        padding: 7px 9px;
  47.      }
  48.  
  49.    </style>
  50.    <link href="css/bootstrap-responsive.css" rel="stylesheet">
  51.  
  52.    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
  53.    <!--[if lt IE 9]>
  54.      <script src="../assets/js/html5shiv.js"></script>
  55.    <![endif]-->
  56.  
  57.    <!-- Fav and touch icons -->
  58.    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png">
  59.    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png">
  60.    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="ico/apple-touch-icon-72-precomposed.png">
  61.    <link rel="apple-touch-icon-precomposed" href="ico/apple-touch-icon-57-precomposed.png">
  62.    <link rel="shortcut icon" href="ico/favicon.png">
  63.  </head>
  64.  
  65.  <body>
  66.  
  67.    <div class="container">
  68.      <form name="form1" method="post" action="" class="form-signin">
  69.        <h2 class="form-signin-heading">
  70.          <?php
  71. $act="1";
  72. if(!empty($_POST['usuario']) and !empty($_POST['contra'])){
  73. $usuario=trim($_POST['usuario']);
  74. $contra=trim($_POST['contra']);
  75. $can=mysql_query("SELECT * FROM usuarios WHERE (usu='".$usuario."' or ced='".$usuario."') and con='".$contra."'");
  76. if($dato=mysql_fetch_array($can)){
  77. $_SESSION['username']=$dato['usu'];
  78. $_SESSION['tipo_usu']=$dato['tipo'];
  79. ///////////////////////////////
  80. if($_SESSION['tipo_usu']=='a' or $_SESSION['tipo_usu']=='ca'){
  81. header('location:index.php');
  82. }
  83. }else{
  84. if($act=="1"){echo '<div class="alert alert-error" align="center">Usuario y Contraseña Incorrecta</div>';}else{$act="0";}
  85. }
  86. }else{
  87.  
  88. }
  89. ?>
  90.        Bienvenid@s</h2>
  91.        <input type="text" name="usuario" class="input-block-level" placeholder="Usuario">
  92.        <input type="password" name="contra" class="input-block-level" placeholder="Contraseña">
  93.        <button class="btn btn-large btn-primary" type="submit">Iniciar</button>
  94.        <p>&nbsp;</p>
  95.      </form>
  96.    </div> <!-- /container -->
  97.  
  98.    <!-- Le javascript
  99.    ================================================== -->
  100.    <!-- Placed at the end of the document so the pages load faster -->
  101.    <script src="js\jquery.js"></script>
  102.    <script src="js\bootstrap-transition.js"></script>
  103.    <script src="js\bootstrap-alert.js"></script>
  104.    <script src="js\bootstrap-modal.js"></script>
  105.    <script src="js\bootstrap-dropdown.js"></script>
  106.    <script src="js\bootstrap-scrollspy.js"></script>
  107.    <script src="js\bootstrap-tab.js"></script>
  108.    <script src="js\bootstrap-tooltip.js"></script>
  109.    <script src="js\bootstrap-popover.js"></script>
  110.    <script src="js\bootstrap-button.js"></script>
  111.    <script src="js\bootstrap-collapse.js"></script>
  112.    <script src="js\bootstrap-carousel.js"></script>
  113.    <script src="js\bootstrap-typeahead.js"></script>
  114.  
  115.  </body>
  116. </html>
  117.  

este es mi codigo
Páginas: 1 2 [3] 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ... 20
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines