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

 

 


Tema destacado: Trabajando con las ramas de git (tercera parte)


  Mostrar Mensajes
Páginas: 1 ... 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 [26] 27 28 29
251  Programación / Bases de Datos / Error en el calendario php mysql en: 18 Abril 2017, 23:08 pm
Hola, he cogido un código que he visto y lo he modificado a mi gusto, pero tengo unos problemas.
Tengo el calendario y un formulario que hice yo, que añade los datos en la DB. El calendario no me muestra los datos guardados en la DB, es decir me lo muestra pero sin los datos, y tendría que guardarlo en la fecha correspondiente (que yo la añada) pero lo guarda en la fecha actual, y si añado más de una, también. No entiendo que pasa.

Yo pensé que era por este código:
// si el día del evento coincide lo marcamos y guardamos la información
Código:
if($event_day == $day)
                {
                    $marked = true;
                    $events_list = $event;
                    break;
                }
               
Que hay una variable
Código:
$day
cuya variable es
Código:
$day= $start_date->format('j');
Creo que lo que esta diciendo el código es que añada los datos en el día actual y yo lo quiero dependiendo de lo  que ponga en el input databox tipo date, no sería así
Código:
$day=$start_date->$_POST['materiabox'];
pero lo hice y me da error.

Código:
Código:
<!-- Codigo javascript -->
<script>
    $(function dias_seleccionados() {
        var events = ['15-1-2011', '02-1-2011', '17-1-2011', '17-2-2011'];
    
        $( "#datepicker" ).datepicker({
            beforeShowDay: function(date) {
                var current = $.datepicker.formatDate('dd-m-yy', date);
                return jQuery.inArray(current, events) == -1 ? [true, ''] : [true, 'ui-state-hover', 'ui-state-highlight'];
            }
        });
    });
    </script>
<script type='text/javascript'>
    document.getElementById('tipoEventos').addEventListener('change', function(){
        var valor = this.value;
 
        // Si el valor elegido del select == otro, habilitar la caja de texto.
        if(valor === 'otro'){
            var cajaTexto = document.getElementById('otroTipoEventos');
            cajaTexto.disabled = false;
            cajaTexto.style.display = 'none';
 
        }
    });
</script>
<style>
  .btnmás {
    background-color:transparent;
    border: transparent;
    font-size: 30px;
    cursor: pointer;
    border-radius: 1000px;
    font-family: segoe script;
  }
</style>
<style>
  .textbox {
    background: transparent;
    font-family: segoe script;
    border: none;
  }
</style>
<style>
  .btn1 {
    background: #e09410;
    background-image: -webkit-linear-gradient(top, #e09410, #ffb700);
    background-image: -moz-linear-gradient(top, #e09410, #ffb700);
    background-image: -ms-linear-gradient(top, #e09410, #ffb700);
    background-image: -o-linear-gradient(top, #e09410, #ffb700);
    background-image: linear-gradient(to bottom, #e09410, #ffb700);
    -webkit-border-radius: 60;
    -moz-border-radius: 60;
    border-radius: 10px;
    border: none;
    font-size:15px;
    font-family: segoe script;
    padding: 1px 20px 2px 5px;
    text-decoration: none;
    width: 1px;
   height: 30px;
   cursor: pointer;
  }
 .btn1:hover {
   background: #ffcc00;
   text-decoration: none;
  }
</style>
<style>
  .btn2 {
    background: #e09410;
    background-image: -webkit-linear-gradient(top, #e09410, #ffb700);
    background-image: -moz-linear-gradient(top, #e09410, #ffb700);
    background-image: -ms-linear-gradient(top, #e09410, #ffb700);
    background-image: -o-linear-gradient(top, #e09410, #ffb700);
    background-image: linear-gradient(to bottom, #e09410, #ffb700);
    -webkit-border-radius: 60;
    -moz-border-radius: 60;
    border-radius: 10px;
    border: none;
    font-size:15px;
    font-family: segoe script;
    padding: 1px 120px 2px 5px;
    text-decoration: none;
    width: 1px;
   height: 30px;
   cursor: pointer;
  }
 .btn2:hover {
   background: #ffcc00;
   text-decoration: none;
  }
</style>
<style>
  .btn3 {
    background: #e09410;
    background-image: -webkit-linear-gradient(top, #e09410, #ffb700);
    background-image: -moz-linear-gradient(top, #e09410, #ffb700);
    background-image: -ms-linear-gradient(top, #e09410, #ffb700);
    background-image: -o-linear-gradient(top, #e09410, #ffb700);
    background-image: linear-gradient(to bottom, #e09410, #ffb700);
    -webkit-border-radius: 60;
    -moz-border-radius: 60;
    border-radius: 10px;
    border: none;
    font-size:15px;
    font-family: segoe script;
    padding: 1px 170px 2px 5px;
    text-decoration: none;
    width: 1px;
   height: 30px;
   cursor: pointer;
  }
 .btn3:hover {
   background: #ffcc00;
   text-decoration: none;
  }
</style>
<style>
  .btn4 {
    background: #e09410;
    background-image: -webkit-linear-gradient(top, #e09410, #ffb700);
    background-image: -moz-linear-gradient(top, #e09410, #ffb700);
    background-image: -ms-linear-gradient(top, #e09410, #ffb700);
    background-image: -o-linear-gradient(top, #e09410, #ffb700);
    background-image: linear-gradient(to bottom, #e09410, #ffb700);
    -webkit-border-radius: 60;
    -moz-border-radius: 60;
    border-radius: 10px;
    border: none;
    font-size:15px;
    font-family: segoe script;
    padding: 1px 120px 2px 5px;
    text-decoration: none;
    width: 1px;
   height: 30px;
   cursor: pointer;
  }
 .btn4:hover {
   background: #ffcc00;
   text-decoration: none;
  }
</style>
<style type='text/css'>
 
#tipoEventos {
    border: inset;
    border-color: orange;
    opacity: 0.8;
    font-family: sgoe script;
    font-size: 14px;
}
 
    #tipoEventos option {
        font-family: sgoe script;
        color: #333;
        font-size: 1.5em;
    }
 
    #otroTipoEventos {
        display: none;
        border: inset;
        border-color: orange;
        opacity: 0.8;
        font-family:segoe script;
        font-size: 14px;
        position: center;
    }
 
</style>
<?php
// Establecer el idioma al Español para strftime().
setlocale( LC_TIME, 'spanish' );
// Si no se ha seleccionado mes, ponemos el actual y el año
$month = isset( $_GET[ 'month' ] ) ? $_GET[ 'month' ] : date( "Y-n" );
$week = 1;
for ( $i=1;$i<=date( 't', strtotime( $month ) );$i++ ) {
  
  $day_week = date( 'N', strtotime( $month.'-'.$i )  );
  
  $calendar[ $week ][ $day_week ] = $i;
  if ( $day_week == 7 )
    $week++;
  
}
?>

<!DOCTYPE html>

<html>

  <head>
  
    <title>Calendario PHP/HTML5</title>
    <script src='https://www.google.com/recaptcha/api.js'></script>
    <style type="text/css">body{margin:0;font-family:Lato;}ul,li{list-style-type:none; margin:0;padding:0;}.calendar{padding:30px;}.calendar .day{background:#ecf0f1;border-bottom:2px solid #bdc3c7;float:left;margin:3px;position:relative;height:120px;width:120px;}.day.marked{background:#3498db;border-color:#2980b9;}.day .day-number{color:#7f8c8d;left:5px;position:absolute;top:5px;}.day.marked .day-number{color:white;}.day .events{color:white;margin:29px 7px 7px;height:78px;overflow-x:hidden;overflow-y:hidden;}.day .events h5{margin:0 0 5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%;}.day .events strong,.day .events span{display:block;font-size:11px;}.day .events ul{}.day .events li{}
    </style>
  </head>
  
  <body style="background-image: url('imagenes/fondo ies calvia proyecto.jpg'); background-repeat: no-repeat; background-position: all; background-attachment: fixed; background-size: cover;">  
  <div class="calendar">
      <?php

        $mysqli = new mysqli('censurado', 'censurado', 'censurado', 'censurado');

        if ( $mysqli->connect_errno )
        {
            die( $mysqli->mysqli_connect_error() );
        }

        $result = $mysqli->query('SELECT fecha, tipoevento, otro, materia, asunto, tarea, evento FROM 1esoacalendar');

        if( !$result )
            die( $mysqli->error );

        $events = array();

        while($rows = $result->fetch_assoc())
        {
            $start_date = new DateTime($rows['fecha_inicio']);
            $end_date = new DateTime($rows['fecha_fin']);
            $day = $start_date->format('j');

            $events[$day][] = array(
              'start_hour' => $start_date->format('G:i a'),
              'end_hour' => $end_date->format('G:i a'),
              'team_code' => $rows['cod_equipo'],
              'description' => $rows['descripcion'],
              'tipoevento' => $rows['tipoEventos'],
              'otro' => $rows['otroTipoEventos'],
              'materia' => $rows['materiabox'],
              'asunto' => $rows['asuntobox'],
              'tarea' => $rows['tareabox'],
              'evento' => $rows['eventobox'],
            );
        }

        $datetime = new DateTime();

        // mes en texto
        $txt_months = array(
            'Enero', 'Febrero', 'Marzo',
            'Abril', 'Mayo', 'Junio',
            'Julio', 'Agosto', 'septiembre',
            'Octubre', 'Noviembre', 'Diciembre'
        );

        $month_txt = $txt_months[$datetime->format('n')-1];

        // ultimo dia del mes
        $month_days = date('j', strtotime("last day of"));

        echo '<h1>' . $month_txt . '</h1>';

        foreach(range(1, $month_days) as $day)
        {
            $marked = false;
            $events_list = array();

            foreach($events as $event_day => $event)
            {
                // si el dia del evento coincide lo marcamos y guardamos la informacion
                if($event_day == $day)
                {
                    $marked = true;
                    $events_list = $event;
                    break;
                }
            }

            echo '
            <div class="day' . ($marked ? ' marked' : '') . '">
                <strong class="day-number">' . $day . '</strong>
                <div class="events"><ul>';

                    foreach($events_list as $event)
                    {
                        echo '<li>
                            <div>
                                <strong>Tipo de evento:</strong>
                                <span>' . $event['tipoevento'] . '</span>
                            </div>

                            <div>
                                <strong>Otro:</strong>
                                <font>' . $event['otro'] . '</font>
                            </div>
                            <div>
                                <strong>Materia:</strong>
                                <font>' . $event['materia'] . '</font>
                            </div>
                            <div>
                                <strong>Asunto:</strong>
                                <font>' . $event['asunto'] . '</font>
                            </div>
                            <div>
                                <strong>Tarea:</strong>
                                <font>' . $event['tarea'] . '</font>
                            </div>
                            <div>
                                <strong>Evento:</strong>
                                <font>' . $event['evento'] . '</font>
                            </div>
                        </li>';
                    }

                echo '</ul></div>
            </div>';
        }
      ?>
</div>        
    <form id="demo" align="center" action="añadirevento.php" method="post">
      <font face="segoe script" size="+6" color="#333333">Insertar eventos</font>
      <br>
      <font face="segoe script" size="+1" color="#333333">Data:</font>&nbsp;<input type="date" name="databox" style="border: inset;border-color: orange; opacity: 0.8; font-family: segoe script; font-size:14px;" required>
      <br>
      <font face="segoe script" size="+1" color="#333333">Tipo de evento:</font>&nbsp;
      <select name="tipoEventos" id="tipoEventos" style="border: inset;border-color: orange; opacity: 0.8; font-family: segoe script; font-size: 14px;" required>
 
        <option value="null" selected disabled><font face="segoe script" size="+1">---Eligir tipo de evento---</font></option>
        <option value="deberes"><font face="segoe script" size="+1">Deberes</font></option>
        <option value="trabajos"><font face="segoe script" size="+1">Trabajos</font></option>
        <option value="controles"><font face="segoe script" size="+1">Controles</font></option>
        <option value="salidas"><font face="segoe script" size="+1">Salidas</font></option>
        <option value="vacaciones"><font face="segoe script" size="+1">Vacaciones</font></option>
        <option value="otro"><font face="segoe script" size="+1">Otro...</font></option>
 
     </select>
     <script type='text/javascript'>
        document.getElementById('tipoEventos').addEventListener('change', function(){
        var valor = this.value;
 
        // Si el valor elegido del select == otro, habilitar la caja de texto.
        if(valor === 'otro'){
            var cajaTexto = document.getElementById('otroTipoEventos');
            cajaTexto.disabled = false;
            cajaTexto.style.display = 'inherit';
            var display = document.getElementById('cambiartexto');
            display.innerHTML='Asunto:';
            var none = document.getElementById('cambiartextarea');
            none.innerHTML='Evento:';
        }
       });
     </script>
     <script type='text/javascript'>
       document.getElementById('tipoEventos').addEventListener('change', function(){
        var valor = this.value;
        if(valor === 'vacaciones'){
            var display = document.getElementById('cambiartexto');
            display.innerHTML='Asunto:';
            var none = document.getElementById('cambiartextarea');
            none.innerHTML='Evento:';
        }
        if (valor == 'salidas') {
          var display = document.getElementById('cambiartexto');
          display.innerHTML='Asunto:';
          var none = document.getElementById('cambiartextarea');
          none.innerHTML='Evento:';
        }
        if (valor == 'deberes') {
          var display = document.getElementById('cambiartexto');
          display.innerHTML='Materia:';
          var none = document.getElementById('cambiartextarea');
          none.innerHTML='Tarea:';
        }
        if (valor == 'trabajos') {
          var display = document.getElementById('cambiartexto');
          display.innerHTML='Materia:';
          var none = document.getElementById('cambiartextarea');
          none.innerHTML='Tarea:';
        }
        if (valor == 'controles') {
          var display = document.getElementById('cambiartexto');
          display.innerHTML='Materia:';
          var none = document.getElementById('cambiartextarea');
          none.innerHTML='Tarea:';
        }
       });
     </script>
     <script>
       document.getElementById('tipoEventos').addEventListener('change', function(){
       var valor= this.value;
       if (valor=='deberes') {
         var cajaTexto = document.getElementById('otroTipoEventos');
            cajaTexto.disabled = false;
            cajaTexto.style.display = 'none';
        }
        if (valor=='trabajos') {
         var cajaTexto = document.getElementById('otroTipoEventos');
           cajaTexto.disabled = false;
            cajaTexto.style.display = 'none';
        }
        if (valor=='controles') {
         var cajaTexto = document.getElementById('otroTipoEventos');
            cajaTexto.disabled = false;
            cajaTexto.style.display = 'none';
        }
        if (valor=='salidas') {
         var cajaTexto = document.getElementById('otroTipoEventos');
            cajaTexto.disabled = false;
            cajaTexto.style.display = 'none';
        }
        if (valor=='vacaciones') {
         var cajaTexto = document.getElementById('otroTipoEventos');
            cajaTexto.disabled = false;
            cajaTexto.style.display = 'none';
        }
        });
      </script>
      <script>
        document.getElementById('tipoEventos').addEventListener('change', function(){
        var valor = this.value;
        if(valor === 'otro'){
            var cambiarmateriabox1 = document.getElementById("materia");
            cambiarmateriabox1.setAttribute("name","asuntobox");
            var cambiartareabox1 = document.getElementById("tarea");
            cambiartareabox1.setAttribute("name","eventobox");
        }
        });
      </script>
      <script>
       document.getElementById('tipoEventos').addEventListener('change', function(){
        var valor = this.value;
        if(valor === 'vacaciones'){
          var cambiarmateriabox2 = document.getElementById("materia");
            cambiarmateriabox2.setAttribute("name","asuntobox");
          var cambiartareabox2 = document.getElementById("tarea");
            cambiartareabox2.setAttribute("name","eventobox");
        }
        if (valor == 'salidas') {
          var cambiarmateriabox3 = document.getElementById("materia");
            cambiarmateriabox3.setAttribute("name","asuntobox");
          var cambiartareabox3 = document.getElementById("tarea");
            cambiartareabox3.setAttribute("name","eventobox");
        }
        if (valor == 'deberes') {
          var cambiarmateriabox4 = document.getElementById("materia");
            cambiarmateriabox4.setAttribute("name","materiabox");
          var cambiartareabox4 = document.getElementById("tarea");
          cambiartareabox4.setAttribute("name","tareabox");
        }
        if (valor == 'trabajos') {
          var cambiarmateriabox5 = document.getElementById("materia");
            cambiarmateriabox5.setAttribute("name","materiabox");
          var cambiartareabox5 = document.getElementById("tarea");
          cambiartareabox5.setAttribute("name","tareabox");
        }
        if (valor == 'controles') {
          var cambiarmateriabox6 = document.getElementById("materia");
            cambiarmateriabox6.setAttribute("name","materiabox");
          var cambiartareabox6 = document.getElementById("tarea");
          cambiartareabox6.setAttribute("name","tareabox");
        }
        });
      </script>
     <input type="text" name="otroTipoEventos" id="otroTipoEventos" style="position:relative; left:880px; top: -30px; display: none;" disabled>
     <br>
     <font face="segoe script" size="+1" color="#333333" id="cambiartexto">Materia:</font>
     <br>
     <input type="text" name="materiabox" style="border:inset; border-color: orange; opacity: 0.8; font-family: segoe script; font-size: 14px;" oncut="return false" onpaste="return false" oncut="return false" placeholder=" Escribe aqu&iacute;..." required id="materia">
     <br>
     <font face="segoe script" size="+1" color="#333333" id="cambiartextarea">Tarea:</font>
     <br>
     <textarea name="tareabox" style="border:inset; border-color: orange; opacity: 0.8; font-family: segoe script; font-size:14px;" cols="50" rows="10" placeholder="Escribe aqu&iacute;..." required id="tarea"></textarea>
     <br>
     <center>
     <div class="g-recaptcha" data-sitekey="6Lc87RwUAAAAAJNPN8mZSXyelFGykTxpJ3rx3WQ9"></div>
     </center>
     <br>
     <input type="submit" name="Enviar" value="Guardar datos" class="btn2">&nbsp;&nbsp;<input type="reset" name="eliminar" class="btn3" value="Limpiar formulario">
    </form>
  </body>
  
</html>

Yo no sé si es eso, pero no se cual es el error.

Me sale así:
https://drive.google.com/file/d/0B6mh5xJztGS9NUtPdDF2NllReTg/view?usp=sharing
Base de datos:
https://drive.google.com/open?id=0B6mh5xJztGS9UUlkeUcycGVOUUk
Gracias
252  Programación / Desarrollo Web / Re: Como hacer en una etiqueta <option> una función dentro de <select> en: 18 Marzo 2017, 23:33 pm
 Muchas gracias #!drvy. Va perfecto! ;D
253  Programación / Desarrollo Web / Como hacer en una etiqueta <option> una función dentro de <select> en: 17 Marzo 2017, 23:09 pm
Hola estoy haciendo una etiqueta select que cuando clique en otro... me salga otra caja devtexto pero hice un onclick en option de otro... y no me va pero no se como se hace.
Código:
<select name="Tipo de eventos" style="border: inset;border-color: orange; opacity: 0.8; font-family: segoe script; font-size: 14px;">
        <option value="---Eligir tipo de evento---" selected onchange="populate(this.id,'otro')"><font face="segoe script" size="+1" color="#333333">---Eligir tipo de evento---</font></option>
        <option value="Deberes"><font face="segoe script" size="+1" color="#333333">Deberes</font></option>
        <option value="Trabajos"><font face="segoe script" size="+1" color="#333333">Trabajos</font></option>
        <option value="Salidas"><font face="segoe script" size="+1" color="#333333">Salidas</font></option>
        <option value="Vacaciones"><font face="segoe script" size="+1" color="#333333">Vacaciones</font></option>
        <option value="Otro..." id="otro"><font face="segoe script" size="+1" color="#333333">Otro...</font></option>
      </select>
      &nbsp;
      <input type="text" name="Tipo de eventos2" style="display: none; border: inset;border-color: orange; opacity: 0.8; font-family:segoe script; font-size: 14px;" id="otro">

Gracias.
254  Programación / PHP / Cambiar mes por mes en calendario php. en: 27 Febrero 2017, 16:49 pm
Hola,tengo un calendario php.

Código:
<?php

$week = 1;


for ($i=1; $i<=date('t'); $i++) {

$day_week = date('N', strtotime(date('Y-m').'-'.$i));

$calendar [$week] [$day_week] = $i;

if ($day_week == 7) { $week++; };
}
?>
<?php
$Nombre_mes = date("F");
$Nombre_año = date("Y");
?>
<!DOCTYPE html>
<html>
<head>

</head>

<body>

<table border="4" id="calendar" style="border: solid; border-color: #B45F04; background-color: #F7D358; font-family: segoe script;">

<thead>
<tr>
<td><center><input type="button" name="previousbutton" style="width:40px; cursor: pointer;" value="<<"></center></td>
<td colspan="5"><center><b><?php echo $Nombre_mes."&nbsp;de&nbsp;".$Nombre_año; ?></b></center></td>
<td><center><input type="button" name="nextbutton" style="width:60px; cursor: pointer;" value=">>"></center></td>
</tr>
<tr>
<td><center><b>Lunes</b></center></td>
<td><center><b>Martes</b></center></td>
<td><center><b>Mi&eacute;rcoles</b></center></td>
<td><center><b>Jueves</b></center></td>
<td><center><b>Viernes</b></center></td>
<td><center><b>S&aacute;bado</b></center></td>
<td><center><b>Domingo</b></center></td>
</tr>
</thead>
<tbody>
<?php foreach($calendar as $days) :?>
<tr>
<?php  for ($i=1;$i<=7;$i++) :?>
<td>
<?php  echo isset($days[$i]) ? $days[$i] : ''; ?>
</td>
<?php  endfor; ?>
</tr>
<?php endforeach ?>
</tbody>
</table>
</body>
</html>

Tengo arriba dos botones para cambiar los meses (mes por mes, y cuando se acaba los meses, cambia a un año más y atrás) y lo tengo que hacer pero no se como hacerlo, me ayudé de un vídeo pero no me funciona, no sé como buscarlo en google, y lo busco pero no encuentro.

Gracias
255  Programación / Desarrollo Web / Re: Los texos se ven mal en mi plantilla en: 27 Febrero 2017, 09:46 am
Gracias por la ayuda... ya no sabia que pensar

Denada, para esto estamos aquí, para ayudarnos entre todos y aprender
256  Programación / Desarrollo Web / Re: Los texos se ven mal en mi plantilla en: 26 Febrero 2017, 21:45 pm
Hola la solución es que cuando pones texto en el lenguaje html, con acentos, al abrirlo en el navegador, el ordenador no lo lee

ej: (Tu pones este texto en el editor de html)

 Editor de Html
<font>Tengo más de 30 años</font>

En el navegador no lee los acentos

Navegador:

Tengo mÃs de 30 años

Sale Ã

Tienes que poner códigos cada palabra con acento ya sea abierto o cerrado van con códigos

Editor de html
<font>Tengo m&aacute;s de 30 años</font>
Navegador
Tengo más de 30 años

Aquí una lista de códigos de caracteres especiales para html: http://ascii.cl/es/codigos-html.htm

Espero haberte ayudado  :)
257  Programación / PHP / Hola, mi calendario php, da un fallo en los días. (solo muestra el primer día) en: 26 Febrero 2017, 21:28 pm
La solución fue:

Código:
<?php

$week = 1;


for ($i=1; $i<=date('t'); $i++) {

$day_week = date('N', strtotime(date('Y-m').'-'.$i));

$calendar [$week] [$day_week] = $i;

if ($day_week == 7) { $week++; };
}
?>
<?php
$Nombre_mes = date("F");
$Nombre_año = date("Y");
?>
<!DOCTYPE html>
<html>
<head>
<script>
function goLastMonth(month, year){
if (month == 1) {
--year;
month = 12;
}
document.location.href = "<?php $_SERVER['PHP_SELF'];?>?month="+month+"&year="+year;
}

function goNextMonth(month, year){
if (month == 12) {
++year
month = 1;
}
document.location.href = "<?php $_SERVER['PHP_SELF'];?>?month="+month+"&year"+year;
}
</script>
</head>

<body>

<table border="4" id="calendar" style="border: solid; border-color: #B45F04; background-color: #F7D358; font-family: segoe script;">

<thead>
<tr>
<td><center><input type="button" name="previousbutton" onclick="goLastMonth(<?php echo $month.",".$year ?>)" style="width:40px; cursor: pointer;" value="<<"></center></td>
<td colspan="5"><center><b><?php echo $Nombre_mes."&nbsp;de&nbsp;".$Nombre_año; ?></b></center></td>
<td><center><input type="button" name="nextbutton" onclick="goNextMonth(<?php echo $month.",".$year ?>)" style="width:60px; cursor: pointer;" value=">>"></center></td>
</tr>
<tr>
<td><center><b>Lunes</b></center></td>
<td><center><b>Martes</b></center></td>
<td><center><b>Mi&eacute;rcoles</b></center></td>
<td><center><b>Jueves</b></center></td>
<td><center><b>Viernes</b></center></td>
<td><center><b>S&aacute;bado</b></center></td>
<td><center><b>Domingo</b></center></td>
</tr>
</thead>
<tbody>
<?php foreach($calendar as $days) :?>
<tr>
<?php  for ($i=1;$i<=7;$i++) :?>
<td>
<?php  echo isset($days[$i]) ? $days[$i] : ''; ?>
</td>
<?php  endfor; ?>
</tr>
<?php endforeach ?>
</tbody>
</table>
</body>
</html>
258  Programación / Bases de Datos / Hola, me podrían ayudar? en: 25 Febrero 2017, 19:59 pm
Hola estoy haciendo un calendario php mysql, ayudandome de un video.

https://www.youtube.com/watch?feature=player_embedded&v=T0y32_nEbys

hay un paso en que tienes que hacer "el contenido del calendario" los días en números.

Lo hice bien pero cuando lo subo a mi servidor el resultado no es el mismo.
la imagen esta en el enlace
https://drive.google.com/file/d/0B6mh5xJztGS9bHZrd0tJNDA5cTg/view?usp=sharing

Código:
<style>
    table.calendar{
        border: solid;
        border-color: #B45F04;
        background-color: #F7D358;
        font-family: segoe script;
    }
</style>
<html lang="es">
    <head>

    </head>
    <body>
    <?php
     if (isset($_GET['day'])) {
       $day = $_GET['day'];
      }else{
       $day = date("j");
      }

     if (isset($_GET['month'])) {
       $month = $_GET['month'];
      }else{
       $month = date("n");
      }

     if (isset($_GET['year'])) {
       $year = $_GET['year'];
      }else{
       $year = date("Y");
      }
    
     //calender variable
     $currentTimeStamp = strtotime("$year-$month-$day");
     $monthName = date("F", $currentTimeStamp);
     $numDays = date("t", $currentTimeStamp);
     $counter = 0;
    ?>
           <table border="1" class="calendar">
                   <tr>
                       <td><input width="50px" type="button" value="<" name="previousbutton" style="cursor: pointer;"></td>
                       <td colspan="5"><center><b><?php echo $monthName ."&nbsp;de&nbsp;".$year ?></b></center></td>
                       <td><input  width="50px" type="button" value=">" name="nextbutton" style="cursor: pointer;"></td>
                   </tr>
                   <tr>
                       <td width="50px"><center><b>Lunes</b></center></td>
                       <td width="50px"><center><b>Martes</b></center></td>
                       <td width="50px"><center><b>Mi&eacute;rcoles</b></center></td>
                       <td width="50px"><center><b>Jueves</b></center></td>
                       <td width="50px"><center><b>Viernes</b></center></td>
                       <td width="50px"><center><b>S&aacute;bado</b></center></td>
                       <td width="50px"><center><b>Domingo</b></center></td>
                   </tr>
                   <?php
                        echo "<tr>";

                        for ($i = 1; $i < $numDays+1; $i++, $counter++) {
                          $timeStamp = strtotime("$year-$month-$i");
                          if ($i == 1) {
                            $firstDay = date("w", $timeStamp);
                            for($j = 0; $j < $firstDay; $j++, $counter++) {
                             //black space
                             echo "<td>&nbsp;</td>";
                            }
                          }
                         if ($counter % 7 == 0) {
                           echo "<tr></tr>";
                           echo "<td align='center'>".$i."</td>";
                          }
                        }
                        echo "</tr>";
                   ?>
           </table>
    </body>
</html>

No sé lo que está mal lo revisé todo dos veces y no sé donde está el fallo.

Gracias.
259  Programación / PHP / Hola alguien me podria ayudar con un calendario php mysql? Gracias en: 19 Febrero 2017, 23:12 pm
Hola estoy haciendo un calendario php mysql, ayudandome de un video.

https://www.youtube.com/watch?feature=player_embedded&v=T0y32_nEbys

hay un paso en que tienes que hacer "el contenido del calendario" los días en números.

Lo hice bien pero cuando lo subo a mi servidor el resultado no es el mismo.
la imagen esta en el enlace
https://drive.google.com/file/d/0B6mh5xJztGS9bHZrd0tJNDA5cTg/view?usp=sharing

Código:
<style>
    table.calendar{
        border: solid;
        border-color: #B45F04;
        background-color: #F7D358;
        font-family: segoe script;
    }
</style>
<html lang="es">
    <head>

    </head>
    <body>
    <?php
     if (isset($_GET['day'])) {
       $day = $_GET['day'];
      }else{
       $day = date("j");
      }

     if (isset($_GET['month'])) {
       $month = $_GET['month'];
      }else{
       $month = date("n");
      }

     if (isset($_GET['year'])) {
       $year = $_GET['year'];
      }else{
       $year = date("Y");
      }
    
     //calender variable
     $currentTimeStamp = strtotime("$year-$month-$day");
     $monthName = date("F", $currentTimeStamp);
     $numDays = date("t", $currentTimeStamp);
     $counter = 0;
    ?>
           <table border="1" class="calendar">
                   <tr>
                       <td><input width="50px" type="button" value="<" name="previousbutton" style="cursor: pointer;"></td>
                       <td colspan="5"><center><b><?php echo $monthName ."&nbsp;de&nbsp;".$year ?></b></center></td>
                       <td><input  width="50px" type="button" value=">" name="nextbutton" style="cursor: pointer;"></td>
                   </tr>
                   <tr>
                       <td width="50px"><center><b>Lunes</b></center></td>
                       <td width="50px"><center><b>Martes</b></center></td>
                       <td width="50px"><center><b>Mi&eacute;rcoles</b></center></td>
                       <td width="50px"><center><b>Jueves</b></center></td>
                       <td width="50px"><center><b>Viernes</b></center></td>
                       <td width="50px"><center><b>S&aacute;bado</b></center></td>
                       <td width="50px"><center><b>Domingo</b></center></td>
                   </tr>
                   <?php
                        echo "<tr>";

                        for ($i = 1; $i < $numDays+1; $i++, $counter++) {
                          $timeStamp = strtotime("$year-$month-$i");
                          if ($i == 1) {
                            $firstDay = date("w", $timeStamp);
                            for($j = 0; $j < $firstDay; $j++, $counter++) {
                             //black space
                             echo "<td>&nbsp;</td>";
                            }
                          }
                         if ($counter % 7 == 0) {
                           echo "<tr></tr>";
                           echo "<td align='center'>".$i."</td>";
                          }
                        }
                        echo "</tr>";
                   ?>
           </table>
    </body>
</html>

No sé lo que está mal lo revisé todo dos veces y no sé donde está el fallo.

Gracias.
260  Programación / PHP / Como prevenir los ataques de inyeccion sql en un formulario de base de datos. en: 9 Enero 2017, 21:35 pm
Hola no se mucho para prevenir ataques SQL, puse un CAPTCHA y me gustaria poner
Código :
Código:
mysql_real_escape_string
que es para escapar los caracteres especiales, eso que significa? Significa que impide los caracteres como comillas simples ('), comillas dobles ("), barras inclinadas (/). y que más?

Como lo podría usar? Me podrían dar un ejemplo?

Gracias.
Páginas: 1 ... 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 [26] 27 28 29
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines