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

 

 


Tema destacado: Tutorial básico de Quickjs


  Mostrar Temas
Páginas: [1]
1  Programación / Desarrollo Web / DataTables porqué no lo detecta en: 4 Abril 2021, 12:59 pm
Hola os paso entero el código porque no consigo que me inmobilice la columna izquierda

hice otro post pero no copié bien

script.js

Creo que no estoy llamando bien a las librerias pero no sé cómo ver donde hay un error.

Código
  1.  
  2.  
  3.  
  4. $(document).ready(function(){
  5. var dataTable = $('#personal').DataTable({
  6.  "paging": false,
  7.  
  8. "language": {
  9. "url": "//cdn.datatables.net/plug-ins/1.10.24/i18n/Spanish.json" },
  10. "fixedColumns":   {
  11.            leftColumns: 1
  12.        },
  13. "bFilter": false,
  14.  
  15. "bInfo": false,
  16.  "processing" : true,
  17.  "serverSide" : true,
  18. "responsive": true,
  19.  "order" : [],
  20.  "ajax" : {
  21.   url:"datos.php",
  22.   type:"POST"
  23.  }
  24.  
  25. });
  26.  
  27.  
  28.  
  29.  
  30.  
  31. $('#personal').on('draw.dt', function(){/*`Oscar``Elena``Carmen``Garijo``Nacho``Prado``Juan``Ondina``Marta``Cristobal``Angeles``Gerardo``Antonio``Gaspar``Raquel``Victor``Reyes``Vanesa`*/
  32.  $('#personal').Tabledit({
  33.   url:'edicion.php',
  34.   dataType:'json',
  35.   columns:{
  36.    identifier : [0, 'idp'],
  37. editable:[[1, 'Oscar'], [2, 'Elena'], [3, 'Carmen'],[4, 'Garijo'],[5, 'Nacho'],[6, 'Prado'],[7, 'Juan'],[8, 'Ondina'],[9, 'Marta'],[10, 'Cristobal'],[11, 'Angeles'],[12, 'Gerardo'],[13, 'Antonio'],[14, 'Gaspar'],[15, 'Raquel'],[16, 'Victor'],[17, 'Reyes'],[18, 'Vanesa']]
  38.   },
  39.   restoreButton:false,
  40.   onSuccess:function(data, textStatus, jqXHR)
  41.   {
  42.    if(data.action == 'delete')
  43.    {
  44.     $('#' + data.idp).remove();
  45.     $('#personal').DataTable().ajax.reload();
  46.    }
  47.   }
  48.  });
  49. });
  50.  
  51. });
  52.  

index.php

Código
  1. <html>
  2. <head>
  3.  <title>Cuadrante de Visitas</title>
  4.  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
  5.  
  6.  
  7.  <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.24/css/jquery.dataTables.css">
  8.  <link rel="stylesheet" type="text/css" href="DataTables/datatables.min.css"/>
  9.  
  10. <script type="text/javascript" src="DataTables/datatables.min.js"></script>
  11.  
  12. <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.js"></script>
  13.  
  14.  
  15.  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
  16.  
  17.  <link rel="stylesheet" href="https://cdn.datatables.net/1.10.12/css/dataTables.bootstrap.min.css" />
  18.  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  19.  <script src="https://markcell.github.io/jquery-tabledit/assets/js/tabledit.min.js"></script>
  20. </script>
  21.  
  22. <script src="https://cdn.datatables.net/fixedcolumns/3.3.2/js/dataTables.fixedColumns.min.js"></script>
  23. </head>
  24. <body>
  25.  <div class="container">
  26.   <h3 align="left">Cu Visit</h3>
  27.   <br />
  28.   <div class="panel panel-primary">
  29.    <div class="panel-heading">Anem a més</div>
  30.    <div class="panel-body">
  31.     <div class="table-responsive">
  32.      <table id="personal" class="table table-bordered table-striped">
  33.       <thead class="fixedHeader">
  34.  
  35.        <tr>
  36.         <th>ID</th>
  37.         <th>Osc</th>
  38.         <th>El</th>
  39.         <th>Carmen</th>
  40.                  <th>Gar</th>
  41.                    <th>Na</th>
  42.         <th>Pra</th>
  43.         <th>Juan</th>
  44.           <th>On</th>
  45.         <th>Marta</th>
  46.         <th>Cris</th>
  47.           <th>Angeles</th>
  48.         <th>Gerardo</th>
  49.         <th>Antonio</th>
  50.           <th>Gaspar</th>
  51.         <th>Raq</th>
  52.         <th>Vic</th>
  53.           <th>Re</th>
  54.         <th>Vanesa</th>
  55.  
  56.        </tr>
  57.       </thead>
  58.       <tbody></tbody>
  59.      </table>
  60.     </div>
  61.    </div>
  62.   </div>
  63.  </div>
  64.  <br />
  65.  <br />
  66. </body>
  67. </html>
  68.  
  69. <script type="text/javascript" language="javascript" src="script.js"></script>
  70.  
  71.  
  72.  
  73.  


2  Programación / PHP / Data Tables fijar columna no funciona en: 3 Abril 2021, 11:23 am
Hola encontré DataTables y me encanta, intento fijar la columna izquierda y la derecha pero no me funciona.

¿Qué podría estar mal?

Mi index

Código
  1.  
  2. <html>
  3. <head>
  4.  <title>Cuadrante de Visitas</title>
  5.  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
  6.  
  7.  <script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
  8.  <script src="https://cdn.datatables.net/1.10.12/js/dataTables.bootstrap.min.js"></script>  
  9.  
  10.  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
  11.  
  12.  <link rel="stylesheet" href="https://cdn.datatables.net/1.10.12/css/dataTables.bootstrap.min.css" />
  13.  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  14.  <script src="https://markcell.github.io/jquery-tabledit/assets/js/tabledit.min.js"></script>
  15. </script>
  16.  
  17. <script src="https://cdn.datatables.net/fixedcolumns/3.3.2/js/dataTables.fixedColumns.min.js"></script>
  18. </head>
  19. <body>
  20.  <div class="container">
  21.   <h3 align="left">Cuadrante de Visitas</h3>
  22.   <br />
  23.   <div class="panel panel-primary">
  24.    <div class="panel-heading">Anem a més</div>
  25.    <div class="panel-body">
  26.     <div class="table-responsive">
  27.      <table id="personal" class="table table-bordered table-striped">
  28.       <thead class="fixedHeader">
  29.  
  30.        <tr>
  31.         <th>ID</th>
  32.         <th>Osdcar</th>
  33.         <th>Elexna</th>
  34.         <th>Carmden</th>
  35.                  <th>Gar</th>
  36.                    <th>Nacho</th>
  37.         <th>Prado</th>
  38.  
  39.  
  40.        </tr>
  41.       </thead>
  42.       <tbody></tbody>
  43.      </table>
  44.     </div>
  45.    </div>
  46.   </div>
  47.  </div>
  48.  <br />
  49.  <br />
  50. </body>
  51. </html>
  52.  
  53. <script type="text/javascript" language="javascript" src="script.js"></script>
  54.  
  55.  
  56.  


El script

Código
  1.  
  2.  
  3. $(document).ready(function(){
  4.  
  5. var dataTable = $('#personal').DataTable({
  6.  "language": {
  7.  "url": "//cdn.datatables.net/plug-ins/1.10.20/i18n/Spanish.json",
  8. "url": "//code.jquery.com/jquery-3.5.1.js",
  9. "url": "//cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js",
  10. "url": "//cdn.datatables.net/fixedcolumns/3.3.2/js/dataTables.fixedColumns.min.js"
  11.  },
  12. "bFilter": false,
  13. "bInfo": false,
  14.  "processing" : true,
  15.  "serverSide" : true,
  16. "responsive": true,
  17. "fixedColumns": true,
  18. "paging":false,
  19.        "fixedColumns":   {
  20.            "leftColumns": 1,
  21.            "rightColumns": 1
  22.        },
  23.  "order" : [],
  24.  "ajax" : {
  25.   url:"datos.php",
  26.   type:"POST"
  27.  }
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34. });
  35.  
  36. $('#personal').on('draw.dt', function(){/*`Oscar``Elena``Carmen``Ga``Nacho``Prado`*/
  37.  $('#personal').Tabledit({
  38.   url:'edicion.php',
  39.   dataType:'json',
  40.   columns:{
  41.    identifier : [0, 'idp'],
  42. editable:[[1, 'Oscar'], [2, 'Elena'], [3, 'Carmen'],[4, 'Ga'],[5, 'Nacho'],[6, 'Prado']]
  43.   },
  44.   restoreButton:false,
  45.   onSuccess:function(data, textStatus, jqXHR)
  46.   {
  47.    if(data.action == 'delete')
  48.    {
  49.     $('#' + data.idp).remove();
  50.     $('#personal').DataTable().ajax.reload();
  51.    }
  52.   }
  53.  });
  54. });
  55.  
  56. });
  57.  
  58.  
  59.  
3  Programación / Desarrollo Web / Tabla con controles cruzados en: 25 Marzo 2021, 08:25 am
Hola,

Hace mucho que no programo y estoy retomando php.

Quiero hacer una tabla "cruzada" donde las filas van de 1 a 5 y las columnas son 4 nombres

Dia Juan Pedro Pablo Lucas

1    Pablo  Lucas

2

3

4

5


El tema es que quiero crear una tabla con desplegables por cada fila pueda elegir (en la fija uno en la columna de Juan he elegido a Pablo). Pueda elegir blaco o los otros tres, Y si el caso del Ejemplo he puesto "Pablo" que automáticamente me rellene en la columna de Pablo  "juan" y a la inversa.  Así para todas las filas.

Esto con php lo podría hacer?

Qué fuciones podría utilizar o donde buscar info similar? A ver si me podéis orientar un poco y muchas gracias.


4  Programación / PHP / Hash y control de usuario en: 1 Mayo 2020, 18:01 pm
Hola,

Hace mucho tiempo que no programaba (y estoy recuperando códigos hechos con mysql, que debo pasar a mysqli.

También veo que la cifrado md5 ya no es la más segura y estoy intentando pasar a un hash diferente.

La cuestión es en el archivo que yo llamaba validar.php


Utilizaba la expresión   
Código
  1. $pw_enc = md5($pw);
 

Y ahora quisiera en ese código utilizar

Código
  1. $pw_enc =password_hash($pw, PASSWORD_DEFAULT, array("cost"=>12));
  2.  


Pero tal y como está parece que ya no valdría el código (sé que hay que transformarlo a mysqli pero me refiero a que por lo que leo habría que añadir en algún punto un password_verify para que cotejara que son el mismo, ¿cómo podría hacerse esto? ¿es necesario el password verify? Y si es así, me podríais ayudar a saber dónde?


validar.php


Código
  1. <?php
  2.  
  3.  
  4.    //conectar BD
  5.    include("conectar_bd.php");  
  6.    conectar_bd();
  7.  
  8.    $usr = $_POST['usuario'];
  9.    $pw = $_POST['password'];
  10.    //Obtengo la version cifrada del password
  11.    $pw_enc = md5($pw);
  12.  
  13.  
  14.  
  15.  
  16.    $result=$conexio->query("SELECT id_usuario FROM tbl_users
  17.            INNER JOIN ctg_tiposusuario
  18.            ON tbl_users.id_TipoUsuario = ctg_tiposusuario.id_TipoUsuario
  19.            WHERE tx_username = '".$usr."'
  20.            AND tx_password = '".$pw_enc."' ");
  21.  
  22.    $uid = "";
  23.  
  24.    //Si existe al menos una fila
  25.    if( $fila=$result->fetch_array(MYSQLI_ASSOC))
  26.    {      
  27.        //Obtener el Id del usuario en la BD        
  28.        $uid = $fila['id_usuario'];
  29.        //Iniciar una sesion de PHP
  30.        session_start();
  31.        //Crear una variable para indicar que se ha autenticado
  32.        $_SESSION['autenticado'] = 'SI';
  33.        //Crear una variable para guardar el ID del usuario para tenerlo siempre disponible
  34.        $_SESSION['uid'] = $uid;
  35.        //CODIGO DE SESION
  36.  
  37.        //Crear un formulario para redireccionar al usuario y enviar oculto su Id
  38. ?>
  39.        <form name="formulario" method="post" action="principalcero.php">
  40.            <input type="hidden" name="idUsr" value='<?php echo $uid ?>' />
  41.        </form>
  42. <?php
  43.    }
  44.    else {
  45.        //En caso de que no exista una fila...
  46.        //..Crear un formulario para redireccionar al usuario a la pagina de login
  47.        //enviandole un codigo de error
  48. ?>
  49.        <form name="formulario" method="post" action="index.php">
  50.            <input type="hidden" name="msg_error" value="1">
  51.        </form>
  52. <?php
  53.    }
  54. ?>
  55.  
  56. <script type="text/javascript">
  57.    //Redireccionar con el formulario creado
  58.    document.formulario.submit();
  59. </script>
  60.  
  61.  
  62.  
  63.  
  64.  
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines